Skip to content

Commit

Permalink
Merge pull request #52 from projectsyn/fix-image-overrides
Browse files Browse the repository at this point in the history
Fix image overrides
  • Loading branch information
bastjan authored Jan 19, 2022
2 parents 2b45c87 + 75aa938 commit 067936d
Show file tree
Hide file tree
Showing 9 changed files with 57 additions and 27 deletions.
12 changes: 11 additions & 1 deletion component/redis.jsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -20,7 +26,11 @@ local objects = [
deployment {
spec+: {
template+: {
spec+: securityContext,
spec+: securityContext {
containers: [
super.containers[0] + redisContainerSpec(image),
],
},
},
},
},
Expand Down
37 changes: 22 additions & 15 deletions component/repo-server.jsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down
11 changes: 11 additions & 0 deletions tests/defaults.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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: []
Expand All @@ -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
Expand All @@ -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:
Expand Down
4 changes: 2 additions & 2 deletions tests/golden/defaults/argocd/argocd/40_redis/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions tests/golden/openshift/argocd/argocd/40_redis/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 067936d

Please sign in to comment.