Skip to content

Commit 5a10494

Browse files
Fix GlobalService Deletion
Reconciling global service deletion events will error and end up looping forever. Example logs: ``` [ERROR] semaphore-service-mirror: reconcile error: queue=aws-global-service namespace=auth name=iam-proxy-auth err="finding global service in the store: not found" ``` This will make sure we exit the reconcile loop after a successful deletion of the local representation of a global service.
1 parent 231bb35 commit 5a10494

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

Diff for: global_runner.go

+1
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,7 @@ func (gr *GlobalRunner) reconcileGlobalService(name, namespace string) error {
170170
if err := kube.DeleteService(gr.ctx, gr.client, globalSvcName, gr.namespace); err != nil && !errors.IsNotFound(err) {
171171
return fmt.Errorf("deleting service %s/%s: %v", gr.namespace, globalSvcName, err)
172172
}
173+
return nil // return on successful service deletion, nothing else to do here.
173174
}
174175
} else if err != nil {
175176
return fmt.Errorf("getting remote service: %v", err)

Diff for: global_runner_test.go

+4-2
Original file line numberDiff line numberDiff line change
@@ -413,12 +413,14 @@ func TestDeleteGlobalServiceMultipleClusters(t *testing.T) {
413413
}}
414414
assertExpectedGlobalServices(ctx, t, expectedSvcs, fakeClient)
415415
// Deleting the service from cluster A should only edit the respective label
416-
testRunnerA.reconcileGlobalService("test-svc", "remote-ns")
416+
err := testRunnerA.reconcileGlobalService("test-svc", "remote-ns")
417+
assert.Equal(t, nil, err)
417418
expectedSvcs[0].Annotations[globalSvcClustersAnno] = "runnerB"
418419
assertExpectedGlobalServices(ctx, t, expectedSvcs, fakeClient)
419420

420421
// Deleting the service from cluster B should delete the global service
421-
testRunnerB.reconcileGlobalService("test-svc", "remote-ns")
422+
err = testRunnerB.reconcileGlobalService("test-svc", "remote-ns")
423+
assert.Equal(t, nil, err)
422424
assertExpectedServices(ctx, t, []TestSvc{}, fakeClient)
423425
}
424426

0 commit comments

Comments
 (0)