-
Notifications
You must be signed in to change notification settings - Fork 6.6k
feat: Only sync controller owner references if an annotation is present #24814
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
base: master
Are you sure you want to change the base?
Conversation
❌ Preview Environment undeployed from BunnyshellAvailable commands (reply to this comment):
|
Signed-off-by: Dave Protasowski <[email protected]>
3554808 to
1ca7d99
Compare
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #24814 +/- ##
=========================================
Coverage ? 60.79%
=========================================
Files ? 404
Lines ? 66224
Branches ? 0
=========================================
Hits ? 40262
Misses ? 22719
Partials ? 3243 ☔ View full report in Codecov by Sentry. |
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.
Could we add a unit test for the new sync option with resources with controller references on/off
Also this needs documentation for how to use the new sync option and why
Thanks
| if resource.HasAnnotationOption(un, common.AnnotationSyncOptions, common.SyncOptionControllerReferencesOnly) { | ||
| controllerOwnerRefs := []metav1.OwnerReference{} | ||
| for _, ownerRef := range un.GetOwnerReferences() { | ||
| if ownerRef.Controller != nil && *ownerRef.Controller { | ||
| controllerOwnerRefs = append(controllerOwnerRefs, ownerRef) | ||
| } | ||
| } | ||
| ownerRefs = controllerOwnerRefs | ||
| } | ||
|
|
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.
Is there any UT we can add / modify to cover this extra if block?
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.
This was someone else's PR that I ported over now 2x. Can you reference an existing test I can look at?
|
Does it make sense to eventually have this option on by default and then the annotation lets people turn the feature off if they need it |
|
/hold See: #11972 (comment) |
This moves the rebase of argoproj/gitops-engine#771 into this repository
Part of #4764 #11972