From daa7f523e0f8ba13b16127c8489223ffbc3b60f0 Mon Sep 17 00:00:00 2001 From: mdryaan Date: Tue, 12 May 2026 05:42:59 +0530 Subject: [PATCH 1/2] fix: return nil explicitly in SliceGateway NONET early-exit path Signed-off-by: mdryaan --- controllers/slicegateway/reconciler.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/controllers/slicegateway/reconciler.go b/controllers/slicegateway/reconciler.go index c96ae4807..404f6b7af 100644 --- a/controllers/slicegateway/reconciler.go +++ b/controllers/slicegateway/reconciler.go @@ -134,7 +134,7 @@ func (r *SliceGwReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ct if slice.Status.SliceConfig != nil && slice.Status.SliceConfig.SliceOverlayNetworkDeploymentMode == v1alpha1.NONET { log.Info("No communication slice. Skipping slicegw reconcilation") - return ctrl.Result{}, err + return ctrl.Result{}, nil } // Check if slice router network service endpoint (NSE) is present before spawning slice gateway pod. From b5f2c260d76022520160d2480631a1c54f44aedf Mon Sep 17 00:00:00 2001 From: mdryaan Date: Tue, 12 May 2026 06:30:23 +0530 Subject: [PATCH 2/2] fix: detect pod IP changes in isAppPodStatusChanged Signed-off-by: mdryaan --- controllers/slice/app_pod.go | 2 +- controllers/slice/reconciler_unit_test.go | 69 +++++++++++++++++++++++ 2 files changed, 70 insertions(+), 1 deletion(-) diff --git a/controllers/slice/app_pod.go b/controllers/slice/app_pod.go index 1b142406a..4b06c9503 100644 --- a/controllers/slice/app_pod.go +++ b/controllers/slice/app_pod.go @@ -44,7 +44,7 @@ func isAppPodStatusChanged(current []kubeslicev1beta1.AppPod, old []kubeslicev1b } for _, cp := range current { - if _, ok := oldPodMap[cp.PodName]; !ok { + if oldPodMap[cp.PodName] != cp.PodIP { return true } } diff --git a/controllers/slice/reconciler_unit_test.go b/controllers/slice/reconciler_unit_test.go index 4202e77e0..b4bae3200 100644 --- a/controllers/slice/reconciler_unit_test.go +++ b/controllers/slice/reconciler_unit_test.go @@ -196,3 +196,72 @@ func TestHandleDnsSvc(t *testing.T) { }) } } + +func TestIsAppPodStatusChanged(t *testing.T) { + tests := []struct { + name string + current []kubeslicev1beta1.AppPod + old []kubeslicev1beta1.AppPod + want bool + }{ + { + name: "same pods same IPs", + current: []kubeslicev1beta1.AppPod{ + {PodName: "pod-a", PodIP: "10.0.0.1"}, + {PodName: "pod-b", PodIP: "10.0.0.2"}, + }, + old: []kubeslicev1beta1.AppPod{ + {PodName: "pod-a", PodIP: "10.0.0.1"}, + {PodName: "pod-b", PodIP: "10.0.0.2"}, + }, + want: false, + }, + { + name: "same pod name different IP", + current: []kubeslicev1beta1.AppPod{ + {PodName: "pod-a", PodIP: "10.0.0.99"}, + }, + old: []kubeslicev1beta1.AppPod{ + {PodName: "pod-a", PodIP: "10.0.0.1"}, + }, + want: true, + }, + { + name: "pod added to current", + current: []kubeslicev1beta1.AppPod{ + {PodName: "pod-a", PodIP: "10.0.0.1"}, + {PodName: "pod-b", PodIP: "10.0.0.2"}, + }, + old: []kubeslicev1beta1.AppPod{ + {PodName: "pod-a", PodIP: "10.0.0.1"}, + }, + want: true, + }, + { + name: "pod removed from current", + current: []kubeslicev1beta1.AppPod{ + {PodName: "pod-a", PodIP: "10.0.0.1"}, + }, + old: []kubeslicev1beta1.AppPod{ + {PodName: "pod-a", PodIP: "10.0.0.1"}, + {PodName: "pod-b", PodIP: "10.0.0.2"}, + }, + want: true, + }, + { + name: "both empty", + current: []kubeslicev1beta1.AppPod{}, + old: []kubeslicev1beta1.AppPod{}, + want: false, + }, + } + + for _, test := range tests { + t.Run(test.name, func(t *testing.T) { + got := isAppPodStatusChanged(test.current, test.old) + if got != test.want { + t.Errorf("isAppPodStatusChanged() = %v, want %v", got, test.want) + } + }) + } +}