ApplicationSet tokenRef strict mode changes only apply after the controller is restarted

未關閉
#1,554 1 則留言 0 個 reaction 已指派 1 人 在 GitHub 檢視

維護者通常 1 天內回覆

@Gabrielandre02 已經在處理了。

開始於 2026年11月13日。

  • #1561 來自 @Gabrielandre02 —— 未關閉

評估

這個 Issue 還沒有評估資料。

描述

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:

  1. The opt-out described in docs/usage/appsets-in-any-namespace.md (.spec.cmdParams set to "false") does nothing until someone restarts the Pod. The docs don't mention a restart.
  2. 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 tokenRef until 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).

  1. 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"]
    
  2. In tr-bar, create a Secret scm-token without the argocd.argoproj.io/secret-type: scm-creds label, 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: token
    

    The ApplicationSet reports secret tr-bar/scm-token is not a valid SCM creds secret, as it should.

  3. Set applicationsetcontroller.enable.tokenref.strict.mode: "false" in .spec.cmdParams and wait for the ConfigMap to change. Recreate the ApplicationSet: the Secret is still refused.

  4. Run kubectl rollout restart deploy/argocd-applicationset-controller. Now the opt-out is live: the error becomes dial tcp: lookup gitlab.invalid ... no such host, so the token was read and the provider was called with it.

  5. Remove the key from .spec.cmdParams and wait for the ConfigMap to go back to true. 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 sourceNamespaces to 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.

主要語言
Go
星號
190
分支
367
平均合併
4 天 2 小時
30 天內合併 PR
63

環境準備

從這裡開始

  1. 先讀完整個 Issue,再讀專案的貢獻指南。
  2. 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
  3. Fork 儲存庫,在一個分支上完成修改。
  4. 送出 Pull Request,並在描述裡引用這個 Issue 編號。

redhat-developer/gitops-operator 的其他 Issue

查看 redhat-developer/gitops-operator 的全部 Issue

相似的 Issue

更多 Go Issue

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。