-
Notifications
You must be signed in to change notification settings - Fork 325
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Net-5510][Net-5455]: CRD controller should only patch the finalizer in the metadata of a CRD, rather than the whole object #3362
Conversation
RemoveFinalizersPatch(obj client.Object, finalizers ...string) *FinalizerPatch | ||
// Patch patches the object. This should only ever be used for updating the metadata of an object, and not object | ||
// spec or status. Updating the spec could have unintended consequences like defaulting zero values. | ||
Patch(ctx context.Context, obj client.Object, patch client.Patch, opts ...client.PatchOption) error |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@hashi-derek does this interface look ok? I tried keeping it as AddFinalizers and RemoveFinalizers, implemented by the FinalizerPatcher in finalizer_patch.go but if I do the patching within those functions, I'd need to pass in the k8s client to to the FinalizerPatcher. Keeping Patch as a function on the controller allows the FinalizerPatcher to not need another k8s client that's already being embedded in the controller implementations.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, this is fine. It's simpler than having the client passed in on each function call.
RemoveFinalizersPatch(obj client.Object, finalizers ...string) *FinalizerPatch | ||
// Patch patches the object. This should only ever be used for updating the metadata of an object, and not object | ||
// spec or status. Updating the spec could have unintended consequences like defaulting zero values. | ||
Patch(ctx context.Context, obj client.Object, patch client.Patch, opts ...client.PatchOption) error |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, this is fine. It's simpler than having the client passed in on each function call.
control-plane/config-entries/controllers/configentry_controller.go
Outdated
Show resolved
Hide resolved
42e231c
to
33effff
Compare
Co-authored-by: Derek Menteer <[email protected]>
33effff
to
962f047
Compare
…in the metadata of a CRD, rather than the whole object (#3362) Finalizer patcher Co-authored-by: Derek Menteer <[email protected]>
…in the metadata of a CRD, rather than the whole object (#3362) Finalizer patcher Co-authored-by: Derek Menteer <[email protected]>
…atch the finalizer in the metadata of a CRD, rather than the whole object into release/1.2.x (#3414) * [Net-5510][Net-5455]: CRD controller should only patch the finalizer in the metadata of a CRD, rather than the whole object (#3362) Finalizer patcher Co-authored-by: Derek Menteer <[email protected]>
…atch the finalizer in the metadata of a CRD, rather than the whole object into release/1.1.x (#3415) * [Net-5510][Net-5455]: CRD controller should only patch the finalizer in the metadata of a CRD, rather than the whole object (#3362) Finalizer patcher Co-authored-by: Derek Menteer <[email protected]>
…in the metadata of a CRD, rather than the whole object (#3362) Finalizer patcher Co-authored-by: Derek Menteer <[email protected]>
Changes proposed in this PR
Issue: ArgoCD will flap when configured with replace mode, which causes zero values to get defaulted and the applied config to differ from the state in K8s.
This is how the ArgoCD flapping problem happens:
This PR:
Added @hashi-derek as a coauthor for his work on a finalizer patcher POC that I used for this.
How I've tested this PR
From this repo https://github.com/ndhanushkodi/argocd-example-apps/tree/nd/debug-consul-config/consul-counting
Lightweight test steps with kubectl replace:
kubectl apply -f counting.yaml -f dashboard.yaml -f splitter.yaml
Test steps with Argo CD:
How I expect reviewers to test this PR
👀
Checklist