Repository navigation
fix(applicationset): roll out the controller when tokenRef strict mode changes - #1561
Gabrielandre02 wants to merge 1 commit into
Conversation
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
|
No actionable comments were generated in the recent review. Summary
Merge Risk:
|
|
Hi @Gabrielandre02. Thanks for your PR. I'm waiting for a redhat-developer member to verify that this patch is reasonable to test. If it is, they should reply with Regular contributors should join the org to skip this step. 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. |
ec374ee to
75c6f2c
Compare
…e changes The ApplicationSet controller read tokenRef strict mode through a configMapKeyRef to argocd-cmd-params-cm. It only reads that variable when it starts, and the Deployment did not change with the ConfigMap, so a new value was ignored until something else restarted the Pod. Set the value on the container, from the same function that fills the ConfigMap. Signed-off-by: gabriel.carmo <admin@gabrielandre.com.br>
75c6f2c to
1ea80e8
Compare
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #1561 +/- ##
==========================================
- Coverage 70.82% 68.76% -2.07%
==========================================
Files 25 118 +93
Lines 3873 25318 +21445
==========================================
+ Hits 2743 17409 +14666
- Misses 1130 7909 +6779
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
What does this PR do?
Fixes #1554.
The ApplicationSet controller read tokenRef strict mode through a
configMapKeyReftoargocd-cmd-params-cm. It only reads that variable when it starts, and the Deployment didn't change when the ConfigMap did, so a new value was ignored until something else restarted the Pod. The case I care most about is the one in the issue: after a temporary opt-out is removed, the CR and the ConfigMap say strict mode is on while the controller keeps reading unlabeled Secrets.With this PR the value is set on the container, from the same function that fills the ConfigMap (
getTokenRefStrictModeValue). When the value changes, the Deployment changes and the controller is rolled out.PR acceptance criteria:
make serve-docsWhat type of PR is this?
/kind bug
Special notes to the reviewer:
I kept the key in
argocd-cmd-params-cm, so the ConfigMap still shows the effective value, but nothing in the operator reads it from there anymore.I went with a literal value instead of a checksum annotation of the ConfigMap on the Pod template because it's the smaller change, and it only restarts the controller when this value changes. If you'd rather have a generic mechanism for
argocd-cmd-params-cm, I can rework it.Two things I noticed and left out of this PR:
.spec.applicationSet.sourceNamespacesonly flips the default on the next reconcile of the instance. The namespace mapper looks at.spec.sourceNamespacesonly. That was already the case for the ConfigMap.valueFromtovalue.How I tested it:
I repeated the steps from the issue on kind, with an ApplicationSet whose Pull Request generator reads an unlabeled Secret:
mastersourceNamespacesThe new spec in
1-037passes with the operator image built from this branch and fails with one built frommaster. I ran it on kind withNON_OLM=true, not on OpenShift.make test,make lintandmake gosecpass.