ApplicationSet tokenRef strict mode changes only apply after the controller is restarted
Maintainer thường phản hồi trong vòng 1 ngày
Đánh giá
Issue này chưa được đánh giá.
Mô tả
Describe the bug
While working on #1551 I noticed that changing the ApplicationSet tokenRef strict mode on an existing instance has no effect until the ApplicationSet controller Pod is restarted, and the operator doesn't restart it.
The operator writes applicationsetcontroller.enable.tokenref.strict.mode to argocd-cmd-params-cm, and the controller Deployment reads it through a configMapKeyRef (argocd-operator/controllers/argocd/applicationset.go). The controller only reads that variable when it starts, and the Deployment spec is the same for both values, so a change in the ConfigMap never rolls it out.
Two things follow from that:
- The opt-out described in
docs/usage/appsets-in-any-namespace.md(.spec.cmdParamsset to"false") does nothing until someone restarts the Pod. The docs don't mention a restart. - The other direction is the one that worries me. After the opt-out is removed, the CR and the ConfigMap say strict mode is on, but the controller keeps reading unlabeled Secrets through
tokenRefuntil its next restart.
To Reproduce
I ran this on a kind cluster, with the operator running from master (8f72660b) and the default Argo CD image (v3.5.6).
-
Create a cluster-scoped instance with ApplicationSets in any namespace:
apiVersion: argoproj.io/v1beta1 kind: ArgoCD metadata: name: argocd namespace: openshift-gitops spec: sourceNamespaces: [tr-bar] applicationSet: sourceNamespaces: [tr-bar] scmProviders: ["https://gitlab.invalid"] -
In
tr-bar, create a Secretscm-tokenwithout theargocd.argoproj.io/secret-type: scm-credslabel, and an ApplicationSet with a Pull Request generator that uses it:generators: - pullRequest: gitlab: project: "1" api: https://gitlab.invalid tokenRef: secretName: scm-token key: tokenThe ApplicationSet reports
secret tr-bar/scm-token is not a valid SCM creds secret, as it should. -
Set
applicationsetcontroller.enable.tokenref.strict.mode: "false"in.spec.cmdParamsand wait for the ConfigMap to change. Recreate the ApplicationSet: the Secret is still refused. -
Run
kubectl rollout restart deploy/argocd-applicationset-controller. Now the opt-out is live: the error becomesdial tcp: lookup gitlab.invalid ... no such host, so the token was read and the provider was called with it. -
Remove the key from
.spec.cmdParamsand wait for the ConfigMap to go back totrue. Recreate the ApplicationSet: the unlabeled Secret is still read.
This is what I saw at each step. The Pod was the same one from step 4 until I restarted it again:
| Step | .spec.cmdParams |
ConfigMap | Env in the running Pod | Unlabeled Secret |
|---|---|---|---|---|
| 2 | not set | true |
true |
refused |
| 3, 60s after the ConfigMap changed | false |
false |
true |
refused |
| 4, after the manual restart | false |
false |
false |
read |
| 5, 60s after the ConfigMap changed | not set | true |
false |
read |
| 5, three minutes later | not set | true |
false |
read |
| after another manual restart | not set | true |
true |
refused |
Expected behavior
A change in the effective strict mode value reaches the ApplicationSet controller without a manual restart, in both directions.
Additional context
- Adding
sourceNamespacesto an existing instance works. The Deployment command changes in the same reconcile, so the Pod is replaced, and it came up with strict mode on the three times I tried. - The E2E tests for this feature (
1-037) check the value in the ConfigMap, not what the controller does, so they pass. - I didn't test on OpenShift or with an OLM install, only with the operator running from source against kind.
A possible fix is to set the value on the container from the same logic that fills the ConfigMap, so that a change in the value changes the Deployment. That's what #1551 does for server.disable.swagger.ui. I'm happy to send a PR with unit and E2E tests if that sounds right to you.
- Ngôn ngữ chính
- Go
- Star
- 190
- Fork
- 367
- Merge trung bình
- 4 ngày 2 giờ
- Pull request đã merge (30 ngày)
- 63
Chuẩn bị môi trường
- Có Dockerfile hoặc tệp Docker Compose
- Có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của redhat-developer/gitops-operator
-
Manager does not detect Route CRD that appears after startupCó thể đã có người làm @atishay-kasliwal đã nhận hôm nay. Đang mở
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 48/100
redhat-developer/gitops-operator#1566 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
NamespaceManagement revocation checks labels on the wrong namespaceCó thể đã có người làm @Rizwana777 đã nhận 3 ngày trước. Đang mởkind/bug
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 25/100
redhat-developer/gitops-operator#1559 · 1 bình luận · 1 người được giao ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Deleting an ArgoCD instance removes RBAC belonging to same-named instancesCó thể đã có người làm @Rizwana777 đã nhận 3 ngày trước. Đang mởkind/bug
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 45/100
redhat-developer/gitops-operator#1558 · 1 người được giao ·
Maintainer thường phản hồi trong vòng 1 ngày
-
NamespaceManagement cleanup can delete RBAC in unrelated namespacesCó thể đã có người làm @Rizwana777 đã nhận 3 ngày trước. Đang mởkind/bug
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 22/100
redhat-developer/gitops-operator#1557 · 1 người được giao ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Enqueue the previous Argo CD instance when NamespaceManagement consent is withdrawnCó thể đã có người làm @Gabrielandre02 đã nhận 5 ngày trước. Đang mở
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 25/100
redhat-developer/gitops-operator#1530 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của redhat-developer/gitops-operator
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Inconsistency between golang and cue in specCó thể đã có người làm Có pull request liên kết đang mở hoặc đã được merge. Đang mở
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 88/100
Maintainer thường phản hồi trong vòng 1 ngày
-
security
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 73/100
Tencent/LoopForge#1087 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày