From bcb32c84dda6c610798d5bf8a835d4ebb0d45c5e Mon Sep 17 00:00:00 2001 From: Barni Seetharaman Date: Thu, 16 Oct 2025 17:11:02 +0000 Subject: [PATCH] clear service from status on sandbox expiry --- controllers/sandbox_controller.go | 5 ++--- test/e2e/shutdown_test.go | 6 +++--- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/controllers/sandbox_controller.go b/controllers/sandbox_controller.go index e088d40..1651dc0 100644 --- a/controllers/sandbox_controller.go +++ b/controllers/sandbox_controller.go @@ -422,6 +422,8 @@ func (r *SandboxReconciler) handleSandboxExpiry(ctx context.Context, sandbox *sa allErrors = errors.Join(allErrors, fmt.Errorf("failed to delete service: %w", err)) } + // Clear all status fields explicitly + sandbox.Status = sandboxv1alpha1.SandboxStatus{} // Update status to remove Ready condition meta.SetStatusCondition(&sandbox.Status.Conditions, metav1.Condition{ Type: string(sandboxv1alpha1.SandboxConditionReady), @@ -431,9 +433,6 @@ func (r *SandboxReconciler) handleSandboxExpiry(ctx context.Context, sandbox *sa Message: "Sandbox has expired", }) - sandbox.Status.Replicas = 0 - sandbox.Status.LabelSelector = "" - return allErrors } diff --git a/test/e2e/shutdown_test.go b/test/e2e/shutdown_test.go index c730866..03c178c 100644 --- a/test/e2e/shutdown_test.go +++ b/test/e2e/shutdown_test.go @@ -74,9 +74,9 @@ func TestSandboxShutdownTime(t *testing.T) { // Wait for sandbox status to reflect new state p = []predicates.ObjectPredicate{ predicates.SandboxHasStatus(sandboxv1alpha1.SandboxStatus{ - // TODO: should Service/ServiceFQDN be cleared from status when the Service is deleted? - Service: "my-sandbox", - ServiceFQDN: "my-sandbox.my-sandbox-ns.svc.cluster.local", + // Service/ServiceFQDN should be cleared from status when the Service is deleted + Service: "", + ServiceFQDN: "", Replicas: 0, Conditions: []metav1.Condition{ {