Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Backport of NET-10548 Adds image pull secrets to the gateway cleanup and gateway resources job service account into release/1.5.x #4218

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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" ]
}
Loading