From 57d3565e4d54f767bde98a32a1d6e0bd8b2a0dd7 Mon Sep 17 00:00:00 2001 From: Artur Troian Date: Thu, 5 Dec 2024 10:22:25 -0500 Subject: [PATCH] fix(inventory): skip persistent volume if it references non existing storageclass (#258) fixes akash-network/support#268 Signed-off-by: Artur Troian --- operator/inventory/rancher.go | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/operator/inventory/rancher.go b/operator/inventory/rancher.go index aefe6d394..7c5aeae7f 100644 --- a/operator/inventory/rancher.go +++ b/operator/inventory/rancher.go @@ -222,7 +222,13 @@ func (c *rancher) run(startch chan<- struct{}) error { continue } - params := scs[pv.Spec.StorageClassName] + params, exists := scs[pv.Spec.StorageClassName] + // pv can be created with non-existing storage class, so just skip it for now + // todo @troian may need to recount volume if storageclass is added later + if !exists { + continue + } + params.allocated += uint64(capacity.Value()) // nolint: gosec pvMap[pv.Name] = pv