Skip to content

Commit

Permalink
NET-10548 Adds image pull secrets to the gateway cleanup and gateway …
Browse files Browse the repository at this point in the history
…resources job service account (#4210)
  • Loading branch information
missylbytes committed Jul 29, 2024
1 parent 0639c7e commit 9123980
Show file tree
Hide file tree
Showing 5 changed files with 57 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .changelog/4210.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:bug
helm: adds imagePullSecret to the gateway-resources job and the gateway-cleanup job, would fail before if the image was in a private registry
```
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 9123980

Please sign in to comment.