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. DetailsInstructions 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 <tkaovila@redhat.com> 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 <tkaovila@redhat.com>
5970407 to
e910a91
Compare
|
Nice one! thank you! /approve |
|
[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 DetailsNeeds 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
EnsureServiceAccountfunction inpkg/controller/operators/catalog/step_ensurer.goto 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.gocovering:Closes #3607