From 75aa938dcc8b2c05fff172e417124832fd359f11 Mon Sep 17 00:00:00 2001 From: Sebastian Widmer Date: Wed, 19 Jan 2022 09:24:33 +0100 Subject: [PATCH] Fixes image overides * Fixes ArgoCD repo server init override * Fixes Redis image override --- component/redis.jsonnet | 12 +++++- component/repo-server.jsonnet | 37 +++++++++++-------- tests/defaults.yml | 11 ++++++ .../statefulset.yaml | 2 +- .../argocd/30_repo-server/deployment.yaml | 9 +++-- .../argocd/argocd/40_redis/deployment.yaml | 4 +- .../argocd/argocd/50_server/deployment.yaml | 2 +- .../argocd/30_repo-server/deployment.yaml | 3 +- .../argocd/argocd/40_redis/deployment.yaml | 4 +- 9 files changed, 57 insertions(+), 27 deletions(-) diff --git a/component/redis.jsonnet b/component/redis.jsonnet index 86d700ad..b850dbd3 100644 --- a/component/redis.jsonnet +++ b/component/redis.jsonnet @@ -11,6 +11,12 @@ local service = std.parseJson(kap.yaml_load('argocd/manifests/' + params.git_tag local isOnOpenshift = std.startsWith(inv.parameters.facts.distribution, 'openshift'); +local redisContainerSpec(image) = + { + image: image, + imagePullPolicy: 'IfNotPresent', + }; + local securityContext = if isOnOpenshift then { securityContext:: {} } else @@ -20,7 +26,11 @@ local objects = [ deployment { spec+: { template+: { - spec+: securityContext, + spec+: securityContext { + containers: [ + super.containers[0] + redisContainerSpec(image), + ], + }, }, }, }, diff --git a/component/repo-server.jsonnet b/component/repo-server.jsonnet index c00f84fe..9eaf4d4d 100644 --- a/component/repo-server.jsonnet +++ b/component/repo-server.jsonnet @@ -36,21 +36,28 @@ local objects = [ spec+: { template+: { spec+: { - initContainers+: [ { - name: 'install-kapitan', - image: params.images.kapitan.image + ':' + params.images.kapitan.tag, - imagePullPolicy: 'Always', - command: [ - 'cp', - '-v', - '/usr/local/bin/kapitan', - '/custom-tools/', - ], - volumeMounts: [ { - name: 'kapitan-bin', - mountPath: '/custom-tools', - } ], - } ], + assert std.length(super.initContainers) == 1 : 'expected one upstream initContainer', + initContainers: [ + super.initContainers[0] { + image: image, + imagePullPolicy: 'IfNotPresent', + }, + { + name: 'install-kapitan', + image: params.images.kapitan.image + ':' + params.images.kapitan.tag, + imagePullPolicy: 'Always', + command: [ + 'cp', + '-v', + '/usr/local/bin/kapitan', + '/custom-tools/', + ], + volumeMounts: [ { + name: 'kapitan-bin', + mountPath: '/custom-tools', + } ], + }, + ], containers: [ deployment.spec.template.spec.containers[0] { image: image, imagePullPolicy: 'IfNotPresent', diff --git a/tests/defaults.yml b/tests/defaults.yml index 80537315..0f270d36 100644 --- a/tests/defaults.yml +++ b/tests/defaults.yml @@ -2,3 +2,14 @@ parameters: secret_management: vault_role: test vault_addr: test.syn.tools + + argocd: + images: + argocd: + image: mymirror.io/argoproj/argocd + redis: + image: mymirror.io/library/redis + kapitan: + image: mymirror.io/projectsyn/kapitan + vault_agent: + image: mymirror.io/vault diff --git a/tests/golden/defaults/argocd/argocd/20_application-controller/statefulset.yaml b/tests/golden/defaults/argocd/argocd/20_application-controller/statefulset.yaml index 74bf0c53..ebf9b97f 100644 --- a/tests/golden/defaults/argocd/argocd/20_application-controller/statefulset.yaml +++ b/tests/golden/defaults/argocd/argocd/20_application-controller/statefulset.yaml @@ -133,7 +133,7 @@ spec: key: controller.default.cache.expiration name: argocd-cmd-params-cm optional: true - image: quay.io/argoproj/argocd:v2.2.2 + image: mymirror.io/argoproj/argocd:v2.2.2 imagePullPolicy: IfNotPresent livenessProbe: httpGet: diff --git a/tests/golden/defaults/argocd/argocd/30_repo-server/deployment.yaml b/tests/golden/defaults/argocd/argocd/30_repo-server/deployment.yaml index ccadb2b0..72b44160 100644 --- a/tests/golden/defaults/argocd/argocd/30_repo-server/deployment.yaml +++ b/tests/golden/defaults/argocd/argocd/30_repo-server/deployment.yaml @@ -119,7 +119,7 @@ spec: value: /helm-working-dir - name: HOME value: /home/argocd - image: quay.io/argoproj/argocd:v2.2.2 + image: mymirror.io/argoproj/argocd:v2.2.2 imagePullPolicy: IfNotPresent livenessProbe: failureThreshold: 3 @@ -176,7 +176,7 @@ spec: value: 'true' - name: VAULT_ADDR value: test.syn.tools - image: docker.io/vault:1.5.8@sha256:3b2209bedb1bbc70315fcd9e2187a49a1359f8f6f46cca7a51efcadb461fe98a + image: mymirror.io/vault:1.5.8@sha256:3b2209bedb1bbc70315fcd9e2187a49a1359f8f6f46cca7a51efcadb461fe98a imagePullPolicy: IfNotPresent name: vault-agent ports: [] @@ -197,7 +197,8 @@ spec: - -n - /usr/local/bin/argocd - /var/run/argocd/argocd-cmp-server - image: quay.io/argoproj/argocd:latest + image: mymirror.io/argoproj/argocd:v2.2.2 + imagePullPolicy: IfNotPresent name: copyutil volumeMounts: - mountPath: /var/run/argocd @@ -207,7 +208,7 @@ spec: - -v - /usr/local/bin/kapitan - /custom-tools/ - image: docker.io/projectsyn/kapitan:v0.29.5@sha256:f0ddfc1052a2dc11c4c4ce97d0a784995b7b0fd8e1f8e032edb7606431b2733a + image: mymirror.io/projectsyn/kapitan:v0.29.5@sha256:f0ddfc1052a2dc11c4c4ce97d0a784995b7b0fd8e1f8e032edb7606431b2733a imagePullPolicy: Always name: install-kapitan volumeMounts: diff --git a/tests/golden/defaults/argocd/argocd/40_redis/deployment.yaml b/tests/golden/defaults/argocd/argocd/40_redis/deployment.yaml index 120ea208..15603f05 100644 --- a/tests/golden/defaults/argocd/argocd/40_redis/deployment.yaml +++ b/tests/golden/defaults/argocd/argocd/40_redis/deployment.yaml @@ -37,8 +37,8 @@ spec: - '' - --appendonly - 'no' - image: redis:6.2.4-alpine - imagePullPolicy: Always + image: mymirror.io/library/redis:6.2.4 + imagePullPolicy: IfNotPresent name: redis ports: - containerPort: 6379 diff --git a/tests/golden/defaults/argocd/argocd/50_server/deployment.yaml b/tests/golden/defaults/argocd/argocd/50_server/deployment.yaml index 1a879997..902fde81 100644 --- a/tests/golden/defaults/argocd/argocd/50_server/deployment.yaml +++ b/tests/golden/defaults/argocd/argocd/50_server/deployment.yaml @@ -188,7 +188,7 @@ spec: key: server.http.cookie.maxnumber name: argocd-cmd-params-cm optional: true - image: quay.io/argoproj/argocd:v2.2.2 + image: mymirror.io/argoproj/argocd:v2.2.2 imagePullPolicy: IfNotPresent livenessProbe: httpGet: diff --git a/tests/golden/openshift/argocd/argocd/30_repo-server/deployment.yaml b/tests/golden/openshift/argocd/argocd/30_repo-server/deployment.yaml index 50d8007b..fbb44ffc 100644 --- a/tests/golden/openshift/argocd/argocd/30_repo-server/deployment.yaml +++ b/tests/golden/openshift/argocd/argocd/30_repo-server/deployment.yaml @@ -195,7 +195,8 @@ spec: - -n - /usr/local/bin/argocd - /var/run/argocd/argocd-cmp-server - image: quay.io/argoproj/argocd:latest + image: quay.io/argoproj/argocd:v2.2.2 + imagePullPolicy: IfNotPresent name: copyutil volumeMounts: - mountPath: /var/run/argocd diff --git a/tests/golden/openshift/argocd/argocd/40_redis/deployment.yaml b/tests/golden/openshift/argocd/argocd/40_redis/deployment.yaml index d9d6207c..da482c2d 100644 --- a/tests/golden/openshift/argocd/argocd/40_redis/deployment.yaml +++ b/tests/golden/openshift/argocd/argocd/40_redis/deployment.yaml @@ -37,8 +37,8 @@ spec: - '' - --appendonly - 'no' - image: redis:6.2.4-alpine - imagePullPolicy: Always + image: docker.io/library/redis:6.2.4 + imagePullPolicy: IfNotPresent name: redis ports: - containerPort: 6379