Add support for image pull policy and secrets (#92)
* add image pull policy and pull secrets Signed-off-by: Janusz Bialy <jbialy@gmail.com> * add unit tests Signed-off-by: Janusz Bialy <jbialy@gmail.com>
This commit is contained in:
parent
e1b89d6396
commit
a2b2d32e92
3 changed files with 58 additions and 0 deletions
|
@ -57,6 +57,7 @@ spec:
|
|||
capabilities:
|
||||
add: ["IPC_LOCK"]
|
||||
image: "{{ .Values.global.image }}"
|
||||
imagePullPolicy: {{ .Values.global.imagePullPolicy }}
|
||||
command: {{ template "vault.command" . }}
|
||||
args: {{ template "vault.args" . }}
|
||||
env:
|
||||
|
@ -101,5 +102,9 @@ spec:
|
|||
periodSeconds: 3
|
||||
successThreshold: 1
|
||||
timeoutSeconds: 5
|
||||
{{- if .Values.global.imagePullSecrets }}
|
||||
imagePullSecrets:
|
||||
{{- toYaml .Values.global.imagePullSecrets | nindent 8 }}
|
||||
{{- end }}
|
||||
{{ template "vault.volumeclaims" . }}
|
||||
{{ end }}
|
||||
|
|
|
@ -50,6 +50,53 @@ load _helpers
|
|||
[ "${actual}" = "foo" ]
|
||||
}
|
||||
|
||||
@test "server/standalone-StatefulSet: default imagePullPolicy" {
|
||||
cd `chart_dir`
|
||||
local actual=$(helm template \
|
||||
-x templates/server-statefulset.yaml \
|
||||
--set 'global.image=foo' \
|
||||
. | tee /dev/stderr |
|
||||
yq -r '.spec.template.spec.containers[0].imagePullPolicy' | tee /dev/stderr)
|
||||
[ "${actual}" = "IfNotPresent" ]
|
||||
}
|
||||
|
||||
@test "server/standalone-StatefulSet: Custom imagePullPolicy" {
|
||||
cd `chart_dir`
|
||||
local actual=$(helm template \
|
||||
-x templates/server-statefulset.yaml \
|
||||
--set 'global.imagePullPolicy=foo' \
|
||||
. | tee /dev/stderr |
|
||||
yq -r '.spec.template.spec.containers[0].imagePullPolicy' | tee /dev/stderr)
|
||||
[ "${actual}" = "foo" ]
|
||||
}
|
||||
|
||||
@test "server/standalone-StatefulSet: Custom imagePullSecrets" {
|
||||
cd `chart_dir`
|
||||
local object=$(helm template \
|
||||
-x templates/server-statefulset.yaml \
|
||||
--set 'global.imagePullSecrets[0].name=foo' \
|
||||
--set 'global.imagePullSecrets[1].name=bar' \
|
||||
. | tee /dev/stderr |
|
||||
yq -r '.spec.template.spec.imagePullSecrets' | tee /dev/stderr)
|
||||
|
||||
local actual=$(echo $object |
|
||||
yq -r '.[0].name' | tee /dev/stderr)
|
||||
[ "${actual}" = "foo" ]
|
||||
|
||||
local actual=$(echo $object |
|
||||
yq -r '.[1].name' | tee /dev/stderr)
|
||||
[ "${actual}" = "bar" ]
|
||||
}
|
||||
|
||||
@test "server/standalone-StatefulSet: default imagePullSecrets" {
|
||||
cd `chart_dir`
|
||||
local actual=$(helm template \
|
||||
-x templates/server-statefulset.yaml \
|
||||
. | tee /dev/stderr |
|
||||
yq -r '.spec.template.spec.imagePullSecrets' | tee /dev/stderr)
|
||||
[ "${actual}" = "null" ]
|
||||
}
|
||||
|
||||
#--------------------------------------------------------------------
|
||||
# updateStrategy
|
||||
|
||||
|
|
|
@ -7,6 +7,12 @@ global:
|
|||
|
||||
# Image is the name (and tag) of the Vault Docker image.
|
||||
image: "vault:1.2.2"
|
||||
# Overrides the default Image Pull Policy
|
||||
imagePullPolicy: IfNotPresent
|
||||
# Image pull secret to use for registry authentication.
|
||||
imagePullSecrets: []
|
||||
# imagePullSecrets:
|
||||
# - name: image-pull-secret
|
||||
# TLS for end-to-end encrypted transport
|
||||
tlsDisable: true
|
||||
|
||||
|
|
Loading…
Reference in a new issue