From 426a5ae74dd975c34e97511a2b96938aa1dac607 Mon Sep 17 00:00:00 2001 From: Mridul Gain Date: Tue, 26 Nov 2024 16:31:30 +0530 Subject: [PATCH] fix: svcexp waiting for app ns, index out of range during gw recycle Signed-off-by: Mridul Gain --- controllers/serviceexport/reconciler.go | 2 +- controllers/slicegateway/utils.go | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/controllers/serviceexport/reconciler.go b/controllers/serviceexport/reconciler.go index c4d17a331..563bb7746 100644 --- a/controllers/serviceexport/reconciler.go +++ b/controllers/serviceexport/reconciler.go @@ -218,7 +218,7 @@ func isValidNameSpace(ns string, slice *kubeslicev1beta1.Slice) bool { if ns == fmt.Sprintf(sliceController.VPC_NS_FMT, slice.Name) { return true } - return arrayContainsString(slice.Status.ApplicationNamespaces, ns) + return arrayContainsString(slice.Status.SliceConfig.NamespaceIsolationProfile.ApplicationNamespaces, ns) } // Setup ServiceExport Reconciler diff --git a/controllers/slicegateway/utils.go b/controllers/slicegateway/utils.go index 7e32a9ecb..99cf6334c 100644 --- a/controllers/slicegateway/utils.go +++ b/controllers/slicegateway/utils.go @@ -357,6 +357,9 @@ func GetPodForGwDeployment(ctx context.Context, c client.Client, depName string) if err := c.List(ctx, &podList, listOpts...); err != nil { return nil, err } + if len(podList.Items) == 0 { + return nil, fmt.Errorf("No pods found with matching labels") + } return &podList.Items[0], nil }