-
Notifications
You must be signed in to change notification settings - Fork 141
Preserve external controller state during reconciliation #4182
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
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #4182 +/- ##
==========================================
+ Coverage 86.04% 86.07% +0.03%
==========================================
Files 131 131
Lines 14142 14167 +25
Branches 35 35
==========================================
+ Hits 12168 12194 +26
+ Misses 1772 1771 -1
Partials 202 202 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
@ciarams87 Do we really need a new API field for preserving annotations? Going off of this comment, could we essentially ignore or automatically preserve any existing fields set in the metadata.annotations/labels? And only add what we need, instead of overwriting? Maybe this requires a |
@sjberman You're right, I was over complicating it. I'll update the implementation |
50a8233 to
ca25b10
Compare
bjee19
left a comment
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.
Does there still exist a way to remove annotations if we start with all existing annotations then overwrite with NGF-managed annotations?
@bjee19 Great question - you're right - there's a limitation: if a user sets an annotation via Gateway.Spec.Infrastructure.Annotations or NginxProxy patches and later removes it from the Gateway spec, it won't be automatically removed from the Service. It can still be removed by manually deleting it, but it won't be cleaned up automatically. The proper fix is to migrate to Server-Side Apply, which tracks field ownership automatically. I think migrating to SSA is too large a change for a patch release since it affects how we reconcile all resources, so I think we should go with the approach and accept the limitation for now, but I'm going to create a follow up ticket to move to SSA instead. What do you think? |
a159918 to
1e19f96
Compare
|
@ciarams87 How large of a change do you think it really is? We'd technically be introducing a new bug, where a user removes some configuration, but then we don't actually delete it. |
@sjberman This proved to be far too complex and requires tracking owners for managed fields - instead I'll keep the current approach but create a new "internal" annotation to track user configured annotations that should be removed from the service when they are no longer specified by the user |
1e19f96 to
b12b092
Compare
b12b092 to
b6dd739
Compare
4cb4213 to
2a9da20
Compare
2a9da20 to
0e6da21
Compare
Proposed changes
Problem: NGINX Gateway Fabric's provisioner removes all annotations during service reconciliation that aren't explicitly managed by NGF. This causes conflicts with external controllers that need to add operational annotations.
Solution: Implemented a preservation pattern for both service annotations by merging Service annotations instead of overwriting.
Note: This necessitates the use of a new internal annotation
gateway.nginx.org/internal-managed-annotation-keysto track the user managed annotation keysTesting: Unit testing, manual testing covering the following scenarios:
Closes #4012
Closes #4175
Checklist
Before creating a PR, run through this checklist and mark each as complete.
Release notes
If this PR introduces a change that affects users and needs to be mentioned in the release notes,
please add a brief note that summarizes the change.