|
1 | 1 | # Upgrading |
2 | 2 |
|
3 | 3 | This page contains upgrade instructions and migration guides for the Argo CD Operator. |
| 4 | +## Upgrading from Operator ≤0.18 to Operator 0.19+ |
| 5 | + |
| 6 | +### ApplicationSet tokenRef strict mode |
| 7 | +If you're upgrading to an operator version that defaults ApplicationSet tokenRef strict mode when ApplicationSets in any namespace are configured, note the following changes: |
| 8 | + |
| 9 | +1. When `.spec.applicationSet.sourceNamespaces` expands to at least one cluster namespace, the operator sets `applicationsetcontroller.enable.tokenref.strict.mode` to `"true"` in `argocd-cmd-params-cm` |
| 10 | +2. The ApplicationSet controller requires Secrets referenced by SCM Provider and Pull Request generators via `tokenRef` to be labeled `argocd.argoproj.io/secret-type: scm-creds` |
| 11 | +3. Manual edits to this key in `argocd-cmd-params-cm` are corrected on reconcile; use the ArgoCD CR (`.spec.cmdParams`) to change behavior |
| 12 | +4. You may opt out via `.spec.cmdParams`, but this is not recommended; see [ApplicationSets in Any Namespace](./usage/appsets-in-any-namespace.md#tokenref-strict-mode) |
| 13 | + |
| 14 | +### Detection |
| 15 | + |
| 16 | +The following users are **unaffected** by this change: |
| 17 | +- Users who do not configure `.spec.applicationSet.sourceNamespaces` on their ArgoCD CR |
| 18 | +- Users whose `.spec.applicationSet.sourceNamespaces` patterns match no cluster namespace |
| 19 | +- Users who do not have ApplicationSets that use an SCM Provider or Pull Request generator with a `tokenRef` pointing at a Secret for API authentication |
| 20 | +- Users whose SCM `tokenRef` Secrets already have `argocd.argoproj.io/secret-type: scm-creds` |
| 21 | + |
| 22 | +The following users are **affected** and should perform remediation: |
| 23 | +- Users with a non-empty expanded `.spec.applicationSet.sourceNamespaces` list whose ApplicationSets use an **SCM Provider** or **Pull Request** generator with a **`tokenRef`** pointing at a Secret for API authentication |
| 24 | +- Users whose referenced Secrets are missing the `argocd.argoproj.io/secret-type: scm-creds` label |
| 25 | + |
| 26 | +### Remediation Steps |
| 27 | + |
| 28 | +1. **Find ApplicationSets using `tokenRef`:** |
| 29 | + |
| 30 | +```bash |
| 31 | +kubectl get applicationsets -A -o yaml | grep -B5 -A3 'tokenRef:' |
| 32 | +``` |
| 33 | + |
| 34 | +Review SCM Provider and Pull Request generator blocks in each ApplicationSet. |
| 35 | + |
| 36 | +2. **Identify referenced Secrets:** |
| 37 | + |
| 38 | +For each `tokenRef`, note `secretName` and namespace (often the Argo CD namespace or the ApplicationSet namespace). |
| 39 | + |
| 40 | +```bash |
| 41 | +kubectl get secret -n <namespace> <secretName> -o yaml |
| 42 | +``` |
| 43 | + |
| 44 | +3. **Label SCM credential Secrets:** |
| 45 | + |
| 46 | +```bash |
| 47 | +kubectl label secret -n <namespace> <secretName> \ |
| 48 | + argocd.argoproj.io/secret-type=scm-creds |
| 49 | +``` |
| 50 | + |
| 51 | +Or in Git or your secret management workflow: |
| 52 | + |
| 53 | +```yaml |
| 54 | +metadata: |
| 55 | + labels: |
| 56 | + argocd.argoproj.io/secret-type: scm-creds |
| 57 | +``` |
| 58 | +
|
| 59 | +4. **Verify after upgrade or reconcile:** |
| 60 | +
|
| 61 | +```bash |
| 62 | +kubectl get cm -n <argocd-namespace> argocd-cmd-params-cm -o yaml |
| 63 | +kubectl logs -n <argocd-namespace> deploy/<instance>-applicationset-controller --tail=50 |
| 64 | +``` |
| 65 | + |
| 66 | +Confirm `applicationsetcontroller.enable.tokenref.strict.mode` is `"true"` when source namespaces are configured, and that ApplicationSets reconcile without tokenRef or secret errors. |
| 67 | + |
| 68 | +5. **Temporary opt-out (migration only):** |
| 69 | + |
| 70 | +If you need time to label Secrets, set `.spec.cmdParams` on the ArgoCD CR: |
| 71 | + |
| 72 | +```yaml |
| 73 | +spec: |
| 74 | + cmdParams: |
| 75 | + applicationsetcontroller.enable.tokenref.strict.mode: "false" |
| 76 | +``` |
| 77 | +
|
| 78 | +This removes the `scm-creds` label requirement and is **not recommended** for production. Prefer labeling Secrets and keeping strict mode enabled. See [ApplicationSets in Any Namespace](./usage/appsets-in-any-namespace.md#tokenref-strict-mode) for details. |
4 | 79 |
|
5 | 80 | ## Upgrading from Operator ≤0.14 (Argo CD ≤2.14) to Operator 0.15+ (Argo CD 3.0+) |
6 | 81 |
|
|
0 commit comments