From 26dc3426bfeab535329acdb3c556124c408578ee Mon Sep 17 00:00:00 2001 From: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> Date: Tue, 2 May 2023 16:15:08 +0000 Subject: [PATCH] fix(manifests): use params CM and env var for redis server (#13214) (#13396) * fix(manifests): use params CM and env var for redis server (#13214) Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> * add release note Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> * rephrase Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> * rephrase Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> --------- Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> --- docs/operator-manual/upgrading/2.6-2.7.md | 9 ++++++++ .../base/redis/argocd-redis-deployment.yaml | 3 --- manifests/base/redis/kustomization.yaml | 12 ---------- .../argocd-repo-server-deployment.yaml | 2 -- manifests/core-install.yaml | 5 ---- manifests/ha/base/kustomization.yaml | 1 + ...cd-application-controller-statefulset.yaml | 8 +++++-- .../base/overlays/argocd-cmd-params-cm.yaml | 6 +++++ .../argocd-repo-server-deployment.yaml | 8 +++++-- .../overlays/argocd-server-deployment.yaml | 7 ++++-- manifests/ha/install.yaml | 23 ++++++++++++++----- manifests/ha/namespace-install.yaml | 23 ++++++++++++++----- manifests/install.yaml | 5 ---- manifests/namespace-install.yaml | 5 ---- 14 files changed, 67 insertions(+), 50 deletions(-) create mode 100644 manifests/ha/base/overlays/argocd-cmd-params-cm.yaml diff --git a/docs/operator-manual/upgrading/2.6-2.7.md b/docs/operator-manual/upgrading/2.6-2.7.md index 8ff1158728314..1eff785703f9c 100644 --- a/docs/operator-manual/upgrading/2.6-2.7.md +++ b/docs/operator-manual/upgrading/2.6-2.7.md @@ -81,3 +81,12 @@ Read the full [documentation](../deep_links.md) to see all possible combinations Argo CD now supports the `helm.sh/resource-policy` annotation to control the deletion of resources. The behavior is the same as the behavior of `argocd.argoproj.io/sync-options: Delete=false` annotation: if the annotation is present and set to `keep`, the resource will not be deleted when the application is deleted. + +## Check your Kustomize patches for `--redis` changes + +Starting in Argo CD 2.7, the install manifests no longer pass the Redis server name via `--redis`. + +If your environment uses Kustomize JSON patches to modify the Redis server name, the patch might break when you upgrade +to the 2.7 manifests. If it does, you can remove the patch and instead set the Redis server name via the `redis.server` +field in the argocd-cmd-params-cm ConfigMap. That value will be passed to the necessary components via `valueFrom` +environment variables. diff --git a/manifests/base/redis/argocd-redis-deployment.yaml b/manifests/base/redis/argocd-redis-deployment.yaml index d92869d8a6ae3..f8d3fb206eb8e 100644 --- a/manifests/base/redis/argocd-redis-deployment.yaml +++ b/manifests/base/redis/argocd-redis-deployment.yaml @@ -30,9 +30,6 @@ spec: - "" - "--appendonly" - "no" - env: - - name: ARGOCD_REDIS_SERVICE - value: "" ports: - containerPort: 6379 securityContext: diff --git a/manifests/base/redis/kustomization.yaml b/manifests/base/redis/kustomization.yaml index 75f763cf2b9df..95553fe464753 100644 --- a/manifests/base/redis/kustomization.yaml +++ b/manifests/base/redis/kustomization.yaml @@ -7,15 +7,3 @@ resources: - argocd-redis-sa.yaml - argocd-redis-service.yaml - argocd-redis-network-policy.yaml - -replacements: - - source: - kind: Service - name: argocd-redis - version: v1 - targets: - - select: - kind: Deployment - name: argocd-redis - fieldPaths: - - spec.template.spec.containers.[name=redis].env.[name=ARGOCD_REDIS_SERVICE].value diff --git a/manifests/base/repo-server/argocd-repo-server-deployment.yaml b/manifests/base/repo-server/argocd-repo-server-deployment.yaml index 1f1b4f2c2ef5e..9ced79662dd25 100644 --- a/manifests/base/repo-server/argocd-repo-server-deployment.yaml +++ b/manifests/base/repo-server/argocd-repo-server-deployment.yaml @@ -23,8 +23,6 @@ spec: imagePullPolicy: Always args: - /usr/local/bin/argocd-repo-server - - "--redis" - - "$(ARGOCD_REDIS_SERVICE):6379" env: - name: ARGOCD_RECONCILIATION_TIMEOUT valueFrom: diff --git a/manifests/core-install.yaml b/manifests/core-install.yaml index 232f51ae71df8..20f87b0cd048a 100644 --- a/manifests/core-install.yaml +++ b/manifests/core-install.yaml @@ -16782,9 +16782,6 @@ spec: - "" - --appendonly - "no" - env: - - name: ARGOCD_REDIS_SERVICE - value: argocd-redis image: redis:7.0.11-alpine imagePullPolicy: Always name: redis @@ -16838,8 +16835,6 @@ spec: containers: - args: - /usr/local/bin/argocd-repo-server - - --redis - - $(ARGOCD_REDIS_SERVICE):6379 env: - name: ARGOCD_RECONCILIATION_TIMEOUT valueFrom: diff --git a/manifests/ha/base/kustomization.yaml b/manifests/ha/base/kustomization.yaml index 97db9d20477c0..0eecf6f0b0aef 100644 --- a/manifests/ha/base/kustomization.yaml +++ b/manifests/ha/base/kustomization.yaml @@ -6,6 +6,7 @@ patches: - path: overlays/argocd-repo-server-deployment.yaml - path: overlays/argocd-server-deployment.yaml - path: overlays/argocd-application-controller-statefulset.yaml +- path: overlays/argocd-cmd-params-cm.yaml images: diff --git a/manifests/ha/base/overlays/argocd-application-controller-statefulset.yaml b/manifests/ha/base/overlays/argocd-application-controller-statefulset.yaml index 52300eb18a121..e077dbd97ef58 100644 --- a/manifests/ha/base/overlays/argocd-application-controller-statefulset.yaml +++ b/manifests/ha/base/overlays/argocd-application-controller-statefulset.yaml @@ -9,5 +9,9 @@ spec: - name: argocd-application-controller args: - /usr/local/bin/argocd-application-controller - - --redis - - "argocd-redis-ha-haproxy:6379" + env: + - name: ARGOCD_REDIS + valueFrom: + configMapKeyRef: + name: argocd-cmd-params-cm + key: redis.server diff --git a/manifests/ha/base/overlays/argocd-cmd-params-cm.yaml b/manifests/ha/base/overlays/argocd-cmd-params-cm.yaml new file mode 100644 index 0000000000000..5752543cc1af3 --- /dev/null +++ b/manifests/ha/base/overlays/argocd-cmd-params-cm.yaml @@ -0,0 +1,6 @@ +apiVersion: v1 +kind: ConfigMap +metadata: + name: argocd-cmd-params-cm +data: + redis.server: argocd-redis-ha-haproxy:6379 diff --git a/manifests/ha/base/overlays/argocd-repo-server-deployment.yaml b/manifests/ha/base/overlays/argocd-repo-server-deployment.yaml index cb6c1cc05556d..e26bae4c8bc09 100644 --- a/manifests/ha/base/overlays/argocd-repo-server-deployment.yaml +++ b/manifests/ha/base/overlays/argocd-repo-server-deployment.yaml @@ -24,5 +24,9 @@ spec: - name: argocd-repo-server args: - /usr/local/bin/argocd-repo-server - - --redis - - "argocd-redis-ha-haproxy:6379" + env: + - name: ARGOCD_REDIS + valueFrom: + configMapKeyRef: + name: argocd-cmd-params-cm + key: redis.server diff --git a/manifests/ha/base/overlays/argocd-server-deployment.yaml b/manifests/ha/base/overlays/argocd-server-deployment.yaml index 19ad165e81f68..351e6cbce76b8 100644 --- a/manifests/ha/base/overlays/argocd-server-deployment.yaml +++ b/manifests/ha/base/overlays/argocd-server-deployment.yaml @@ -25,7 +25,10 @@ spec: env: - name: ARGOCD_API_SERVER_REPLICAS value: '2' + - name: ARGOCD_REDIS + valueFrom: + configMapKeyRef: + name: argocd-cmd-params-cm + key: redis.server args: - /usr/local/bin/argocd-server - - --redis - - "argocd-redis-ha-haproxy:6379" diff --git a/manifests/ha/install.yaml b/manifests/ha/install.yaml index c7eed4543ec9e..c68aa6e24156d 100644 --- a/manifests/ha/install.yaml +++ b/manifests/ha/install.yaml @@ -16777,6 +16777,8 @@ metadata: name: argocd-cm --- apiVersion: v1 +data: + redis.server: argocd-redis-ha-haproxy:6379 kind: ConfigMap metadata: labels: @@ -18259,9 +18261,12 @@ spec: containers: - args: - /usr/local/bin/argocd-repo-server - - --redis - - argocd-redis-ha-haproxy:6379 env: + - name: ARGOCD_REDIS + valueFrom: + configMapKeyRef: + key: redis.server + name: argocd-cmd-params-cm - name: ARGOCD_RECONCILIATION_TIMEOUT valueFrom: configMapKeyRef: @@ -18522,11 +18527,14 @@ spec: containers: - args: - /usr/local/bin/argocd-server - - --redis - - argocd-redis-ha-haproxy:6379 env: - name: ARGOCD_API_SERVER_REPLICAS value: "2" + - name: ARGOCD_REDIS + valueFrom: + configMapKeyRef: + key: redis.server + name: argocd-cmd-params-cm - name: ARGOCD_SERVER_INSECURE valueFrom: configMapKeyRef: @@ -18830,9 +18838,12 @@ spec: containers: - args: - /usr/local/bin/argocd-application-controller - - --redis - - argocd-redis-ha-haproxy:6379 env: + - name: ARGOCD_REDIS + valueFrom: + configMapKeyRef: + key: redis.server + name: argocd-cmd-params-cm - name: ARGOCD_CONTROLLER_REPLICAS value: "1" - name: ARGOCD_RECONCILIATION_TIMEOUT diff --git a/manifests/ha/namespace-install.yaml b/manifests/ha/namespace-install.yaml index ba988b997bc3d..3f4cb12d6088a 100644 --- a/manifests/ha/namespace-install.yaml +++ b/manifests/ha/namespace-install.yaml @@ -437,6 +437,8 @@ metadata: name: argocd-cm --- apiVersion: v1 +data: + redis.server: argocd-redis-ha-haproxy:6379 kind: ConfigMap metadata: labels: @@ -1919,9 +1921,12 @@ spec: containers: - args: - /usr/local/bin/argocd-repo-server - - --redis - - argocd-redis-ha-haproxy:6379 env: + - name: ARGOCD_REDIS + valueFrom: + configMapKeyRef: + key: redis.server + name: argocd-cmd-params-cm - name: ARGOCD_RECONCILIATION_TIMEOUT valueFrom: configMapKeyRef: @@ -2182,11 +2187,14 @@ spec: containers: - args: - /usr/local/bin/argocd-server - - --redis - - argocd-redis-ha-haproxy:6379 env: - name: ARGOCD_API_SERVER_REPLICAS value: "2" + - name: ARGOCD_REDIS + valueFrom: + configMapKeyRef: + key: redis.server + name: argocd-cmd-params-cm - name: ARGOCD_SERVER_INSECURE valueFrom: configMapKeyRef: @@ -2490,9 +2498,12 @@ spec: containers: - args: - /usr/local/bin/argocd-application-controller - - --redis - - argocd-redis-ha-haproxy:6379 env: + - name: ARGOCD_REDIS + valueFrom: + configMapKeyRef: + key: redis.server + name: argocd-cmd-params-cm - name: ARGOCD_CONTROLLER_REPLICAS value: "1" - name: ARGOCD_RECONCILIATION_TIMEOUT diff --git a/manifests/install.yaml b/manifests/install.yaml index e896b3ddd766e..d68635636867d 100644 --- a/manifests/install.yaml +++ b/manifests/install.yaml @@ -17282,9 +17282,6 @@ spec: - "" - --appendonly - "no" - env: - - name: ARGOCD_REDIS_SERVICE - value: argocd-redis image: redis:7.0.11-alpine imagePullPolicy: Always name: redis @@ -17338,8 +17335,6 @@ spec: containers: - args: - /usr/local/bin/argocd-repo-server - - --redis - - $(ARGOCD_REDIS_SERVICE):6379 env: - name: ARGOCD_RECONCILIATION_TIMEOUT valueFrom: diff --git a/manifests/namespace-install.yaml b/manifests/namespace-install.yaml index eb272f55b9f50..1818ed673adec 100644 --- a/manifests/namespace-install.yaml +++ b/manifests/namespace-install.yaml @@ -942,9 +942,6 @@ spec: - "" - --appendonly - "no" - env: - - name: ARGOCD_REDIS_SERVICE - value: argocd-redis image: redis:7.0.11-alpine imagePullPolicy: Always name: redis @@ -998,8 +995,6 @@ spec: containers: - args: - /usr/local/bin/argocd-repo-server - - --redis - - $(ARGOCD_REDIS_SERVICE):6379 env: - name: ARGOCD_RECONCILIATION_TIMEOUT valueFrom: