Skip to content

Commit 36c411a

Browse files
authored
clear service from status on sandbox expiry (#102)
1 parent 1859a3c commit 36c411a

File tree

2 files changed

+5
-6
lines changed

2 files changed

+5
-6
lines changed

controllers/sandbox_controller.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -486,6 +486,8 @@ func (r *SandboxReconciler) handleSandboxExpiry(ctx context.Context, sandbox *sa
486486
allErrors = errors.Join(allErrors, fmt.Errorf("failed to delete service: %w", err))
487487
}
488488

489+
// Clear all status fields explicitly
490+
sandbox.Status = sandboxv1alpha1.SandboxStatus{}
489491
// Update status to remove Ready condition
490492
meta.SetStatusCondition(&sandbox.Status.Conditions, metav1.Condition{
491493
Type: string(sandboxv1alpha1.SandboxConditionReady),
@@ -495,9 +497,6 @@ func (r *SandboxReconciler) handleSandboxExpiry(ctx context.Context, sandbox *sa
495497
Message: "Sandbox has expired",
496498
})
497499

498-
sandbox.Status.Replicas = 0
499-
sandbox.Status.LabelSelector = ""
500-
501500
return allErrors
502501
}
503502

test/e2e/shutdown_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -74,9 +74,9 @@ func TestSandboxShutdownTime(t *testing.T) {
7474
// Wait for sandbox status to reflect new state
7575
p = []predicates.ObjectPredicate{
7676
predicates.SandboxHasStatus(sandboxv1alpha1.SandboxStatus{
77-
// TODO: should Service/ServiceFQDN be cleared from status when the Service is deleted?
78-
Service: "my-sandbox",
79-
ServiceFQDN: "my-sandbox.my-sandbox-ns.svc.cluster.local",
77+
// Service/ServiceFQDN should be cleared from status when the Service is deleted
78+
Service: "",
79+
ServiceFQDN: "",
8080
Replicas: 0,
8181
Conditions: []metav1.Condition{
8282
{

0 commit comments

Comments
 (0)