-
Notifications
You must be signed in to change notification settings - Fork 563
Preserve ServiceAccount annotations during CSV update #3610
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
Preserve ServiceAccount annotations during CSV update #3610
Conversation
Hi @kaovilai. Thanks for your PR. I'm waiting for a operator-framework member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
0fda9a2
to
5970407
Compare
/ok-to-test |
Fixes operator-framework#3607 When a ClusterServiceVersion (CSV) is updated, the EnsureServiceAccount function now preserves existing annotations on the ServiceAccount. This prevents the loss of important annotations that may have been added by users or other controllers. The fix merges existing annotations from the old ServiceAccount with annotations from the new ServiceAccount object, giving precedence to the new annotations in case of conflicts. Signed-off-by: Tiger Kaovilai <[email protected]> Add unit tests for ServiceAccount annotation preservation Added comprehensive unit tests for the EnsureServiceAccount function to verify that annotations are properly preserved during updates. The tests cover: - Creating new service accounts - Preserving existing annotations during updates - Handling annotation conflicts (new annotations take precedence) - Preserving secrets during updates - Error handling scenarios Signed-off-by: Tiger Kaovilai <[email protected]>
5970407
to
e910a91
Compare
Nice one! thank you! /approve |
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.
/lgtm
Great 🎉
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: camilamacedo86, perdasilva The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
ea9e2c9
into
operator-framework:master
Description of the change:
Modified the
EnsureServiceAccount
function inpkg/controller/operators/catalog/step_ensurer.go
to preserve existing annotations on ServiceAccounts during CSV updates. The implementation merges existing annotations with new ones, giving precedence to new annotations in case of conflicts.Motivation for the change:
Currently, when a ClusterServiceVersion (CSV) is updated, the EnsureServiceAccount function reconciles the associated ServiceAccount but does not preserve existing annotations. This leads to the loss of important annotations that may have been added by users or other controllers.
Architectural changes:
No architectural changes. This is a small enhancement to the existing EnsureServiceAccount function to preserve annotations similar to how it already preserves Secrets and OwnerReferences.
Testing remarks:
step_ensurer_test.go
covering:Closes #3607