Skip to content

Conversation

@zijun726911
Copy link
Contributor

@zijun726911 zijun726911 commented Sep 6, 2023

…8sService deletion

What type of PR is this?

Which issue does this PR fix: bug fix for #331
It's quite possible that this previous refactoring service_controller.go, cause a regression that "deleting k8sService do NOT de-registering targets". Bring back the (r *serviceReconciler) reconcileTargetsResource() logic to handle the k8sService deletion could fix this issue

What does this PR do / Why do we need it: bug fix for #331

If an issue # is not available please add repro steps and logs from aws-gateway-controller showing the issue:

Testing done on this change:

Automation added to e2e:

newly un-commented e2etest case pass, all test cases pass

Ran 29 of 29 Specs in 1876.938 seconds
SUCCESS! -- 29 Passed | 0 Failed | 0 Pending | 0 Skipped
--- PASS: TestIntegration (1877.46s)
PASS

E2E tests for new revision also pass

Will this PR introduce any new dependencies?:

Will this break upgrades or downgrades. Has updating a running cluster been tested?:

Does this PR introduce any user-facing change?:


By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

Copy link
Contributor

@solmonk solmonk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you also check manually that target de-registration is happening?

@zijun726911
Copy link
Contributor Author

can you also check manually that target de-registration is happening?

Already did the manual test, single step debug to trace the build_model and synthesizer de-registering targets
code path, it works as expected

- Add reconcileTargetsResource error handling logic
Copy link
Contributor

@solmonk solmonk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@liwenwu-amazon
Copy link
Contributor

Please make sure the e2e test cover this scenario! So that we will NOT have another regression in future

Copy link
Contributor

@liwenwu-amazon liwenwu-amazon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You need finalizer. Otherwise, the service delete event can be lost.

@zijun726911
Copy link
Contributor Author

zijun726911 commented Sep 6, 2023

You need finalizer. Otherwise, the service delete event can be lost.

finalizer added at line 126, please check the controllers/service_controller.go
code, for k8sService creation, it only add the finalizer. for k8sService deletion, it does de-registering targets and then remove finalizer.

deregister_targets_test.go e2etest covered these use cases

// verifyNoTargetsForTargetGroup(targetGroup)
//})

It("Kubernetes Deployment deletion triggers targets de-registering", func() {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do u delete this particular case?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@zijun726911 zijun726911 merged commit f5b9033 into aws:main Sep 6, 2023
@zijun726911 zijun726911 deleted the delete-svc-deregister-targets2 branch November 2, 2023 22:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants