Skip to content

Commit

Permalink
Adds image pull secrets to the gateway cleanup and gateway resources …
Browse files Browse the repository at this point in the history
…job service account
  • Loading branch information
missylbytes committed Jul 25, 2024
1 parent 1b04a36 commit 18f135e
Show file tree
Hide file tree
Showing 4 changed files with 54 additions and 0 deletions.
6 changes: 6 additions & 0 deletions charts/consul/templates/gateway-cleanup-serviceaccount.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,10 @@ metadata:
heritage: {{ .Release.Service }}
release: {{ .Release.Name }}
component: gateway-cleanup
{{- with .Values.global.imagePullSecrets }}
imagePullSecrets:
{{- range . }}
- name: {{ .name }}
{{- end }}
{{- end }}
{{- end }}
6 changes: 6 additions & 0 deletions charts/consul/templates/gateway-resources-serviceaccount.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,10 @@ metadata:
heritage: {{ .Release.Service }}
release: {{ .Release.Name }}
component: gateway-resources
{{- with .Values.global.imagePullSecrets }}
imagePullSecrets:
{{- range . }}
- name: {{ .name }}
{{- end }}
{{- end }}
{{- end }}
22 changes: 22 additions & 0 deletions charts/consul/test/unit/gateway-cleanup-serviceaccount.bats
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,25 @@ target=templates/gateway-cleanup-serviceaccount.yaml
.
}

#--------------------------------------------------------------------
# global.imagePullSecrets

@test "gatewaycleanup/ServiceAccount: can set image pull secrets" {
cd `chart_dir`
local object=$(helm template \
-s templates/gateway-cleanup-serviceaccount.yaml \
--set 'connectInject.enabled=true' \
--set 'global.imagePullSecrets[0].name=my-secret' \
--set 'global.imagePullSecrets[1].name=my-secret2' \
. | tee /dev/stderr)

local actual=$(echo "$object" |
yq -r '.imagePullSecrets[0].name' | tee /dev/stderr)
[ "${actual}" = "my-secret" ]

local actual=$(echo "$object" |
yq -r '.imagePullSecrets[1].name' | tee /dev/stderr)
[ "${actual}" = "my-secret2" ]
}


20 changes: 20 additions & 0 deletions charts/consul/test/unit/gateway-resources-serviceaccount.bats
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,23 @@ target=templates/gateway-resources-serviceaccount.yaml
.
}

#--------------------------------------------------------------------
# global.imagePullSecrets

@test "gatewayresources/ServiceAccount: can set image pull secrets" {
cd `chart_dir`
local object=$(helm template \
-s templates/gateway-resources-serviceaccount.yaml \
--set 'connectInject.enabled=true' \
--set 'global.imagePullSecrets[0].name=my-secret' \
--set 'global.imagePullSecrets[1].name=my-secret2' \
. | tee /dev/stderr)

local actual=$(echo "$object" |
yq -r '.imagePullSecrets[0].name' | tee /dev/stderr)
[ "${actual}" = "my-secret" ]

local actual=$(echo "$object" |
yq -r '.imagePullSecrets[1].name' | tee /dev/stderr)
[ "${actual}" = "my-secret2" ]
}

0 comments on commit 18f135e

Please sign in to comment.