Use a standard way to define the container image (#103)
* use a standard way to define image repo and tag Signed-off-by: Janusz Bialy <jbialy@gmail.com> * add tests Signed-off-by: Janusz Bialy <jbialy@gmail.com> * bump chart version Signed-off-by: Janusz Bialy <jbialy@gmail.com> * Revert "bump chart version" This reverts commit 74cbc984a7d4cf9098acf78977cdc8598c557550. Signed-off-by: Janusz Bialy <jbialy@gmail.com> * nest image block inside server Signed-off-by: Janusz Bialy <jbialy@gmail.com>
This commit is contained in:
parent
52f3686c12
commit
2ff7d47c07
5 changed files with 71 additions and 28 deletions
|
@ -53,8 +53,8 @@ spec:
|
||||||
securityContext:
|
securityContext:
|
||||||
capabilities:
|
capabilities:
|
||||||
add: ["IPC_LOCK"]
|
add: ["IPC_LOCK"]
|
||||||
image: "{{ .Values.global.image }}"
|
image: {{ .Values.server.image.repository }}:{{ .Values.server.image.tag | default "latest" }}
|
||||||
imagePullPolicy: {{ .Values.global.imagePullPolicy }}
|
imagePullPolicy: {{ .Values.server.image.pullPolicy }}
|
||||||
command: {{ template "vault.command" . }}
|
command: {{ template "vault.command" . }}
|
||||||
args: {{ template "vault.args" . }}
|
args: {{ template "vault.args" . }}
|
||||||
env:
|
env:
|
||||||
|
|
|
@ -23,15 +23,29 @@ load _helpers
|
||||||
[ "${actual}" = "false" ]
|
[ "${actual}" = "false" ]
|
||||||
}
|
}
|
||||||
|
|
||||||
@test "server/dev-StatefulSet: image defaults to global.image" {
|
@test "server/dev-StatefulSet: image defaults to server.image.repository:tag" {
|
||||||
cd `chart_dir`
|
cd `chart_dir`
|
||||||
local actual=$(helm template \
|
local actual=$(helm template \
|
||||||
-x templates/server-statefulset.yaml \
|
-x templates/server-statefulset.yaml \
|
||||||
--set 'global.image=foo' \
|
--set 'server.image.repository=foo' \
|
||||||
|
--set 'server.image.tag=1.2.3' \
|
||||||
--set 'server.dev.enabled=true' \
|
--set 'server.dev.enabled=true' \
|
||||||
. | tee /dev/stderr |
|
. | tee /dev/stderr |
|
||||||
yq -r '.spec.template.spec.containers[0].image' | tee /dev/stderr)
|
yq -r '.spec.template.spec.containers[0].image' | tee /dev/stderr)
|
||||||
[ "${actual}" = "foo" ]
|
[ "${actual}" = "foo:1.2.3" ]
|
||||||
|
}
|
||||||
|
|
||||||
|
@test "server/ha-StatefulSet: image tag defaults to latest" {
|
||||||
|
cd `chart_dir`
|
||||||
|
|
||||||
|
local actual=$(helm template \
|
||||||
|
-x templates/server-statefulset.yaml \
|
||||||
|
--set 'server.image.repository=foo' \
|
||||||
|
--set 'server.image.tag=' \
|
||||||
|
--set 'server.dev.enabled=true' \
|
||||||
|
. | tee /dev/stderr |
|
||||||
|
yq -r '.spec.template.spec.containers[0].image' | tee /dev/stderr)
|
||||||
|
[ "${actual}" = "foo:latest" ]
|
||||||
}
|
}
|
||||||
|
|
||||||
#--------------------------------------------------------------------
|
#--------------------------------------------------------------------
|
||||||
|
|
|
@ -23,22 +23,29 @@ load _helpers
|
||||||
[ "${actual}" = "false" ]
|
[ "${actual}" = "false" ]
|
||||||
}
|
}
|
||||||
|
|
||||||
@test "server/ha-StatefulSet: image defaults to global.image" {
|
@test "server/ha-StatefulSet: image defaults to server.image.repository:tag" {
|
||||||
cd `chart_dir`
|
cd `chart_dir`
|
||||||
local actual=$(helm template \
|
local actual=$(helm template \
|
||||||
-x templates/server-statefulset.yaml \
|
-x templates/server-statefulset.yaml \
|
||||||
--set 'global.image=foo' \
|
--set 'server.image.repository=foo' \
|
||||||
. | tee /dev/stderr |
|
--set 'server.image.tag=1.2.3' \
|
||||||
yq -r '.spec.template.spec.containers[0].image' | tee /dev/stderr)
|
|
||||||
[ "${actual}" = "foo" ]
|
|
||||||
|
|
||||||
local actual=$(helm template \
|
|
||||||
-x templates/server-statefulset.yaml \
|
|
||||||
--set 'global.image=foo' \
|
|
||||||
--set 'server.ha.enabled=true' \
|
--set 'server.ha.enabled=true' \
|
||||||
. | tee /dev/stderr |
|
. | tee /dev/stderr |
|
||||||
yq -r '.spec.template.spec.containers[0].image' | tee /dev/stderr)
|
yq -r '.spec.template.spec.containers[0].image' | tee /dev/stderr)
|
||||||
[ "${actual}" = "foo" ]
|
[ "${actual}" = "foo:1.2.3" ]
|
||||||
|
}
|
||||||
|
|
||||||
|
@test "server/ha-StatefulSet: image tag defaults to latest" {
|
||||||
|
cd `chart_dir`
|
||||||
|
|
||||||
|
local actual=$(helm template \
|
||||||
|
-x templates/server-statefulset.yaml \
|
||||||
|
--set 'server.image.repository=foo' \
|
||||||
|
--set 'server.image.tag=' \
|
||||||
|
--set 'server.ha.enabled=true' \
|
||||||
|
. | tee /dev/stderr |
|
||||||
|
yq -r '.spec.template.spec.containers[0].image' | tee /dev/stderr)
|
||||||
|
[ "${actual}" = "foo:latest" ]
|
||||||
}
|
}
|
||||||
|
|
||||||
#--------------------------------------------------------------------
|
#--------------------------------------------------------------------
|
||||||
|
|
|
@ -32,29 +32,50 @@ load _helpers
|
||||||
[ "${actual}" = "false" ]
|
[ "${actual}" = "false" ]
|
||||||
}
|
}
|
||||||
|
|
||||||
@test "server/standalone-StatefulSet: image defaults to global.image" {
|
@test "server/standalone-StatefulSet: image defaults to server.image.repository:tag" {
|
||||||
cd `chart_dir`
|
cd `chart_dir`
|
||||||
local actual=$(helm template \
|
local actual=$(helm template \
|
||||||
-x templates/server-statefulset.yaml \
|
-x templates/server-statefulset.yaml \
|
||||||
--set 'global.image=foo' \
|
--set 'server.image.repository=foo' \
|
||||||
|
--set 'server.image.tag=1.2.3' \
|
||||||
. | tee /dev/stderr |
|
. | tee /dev/stderr |
|
||||||
yq -r '.spec.template.spec.containers[0].image' | tee /dev/stderr)
|
yq -r '.spec.template.spec.containers[0].image' | tee /dev/stderr)
|
||||||
[ "${actual}" = "foo" ]
|
[ "${actual}" = "foo:1.2.3" ]
|
||||||
|
|
||||||
local actual=$(helm template \
|
local actual=$(helm template \
|
||||||
-x templates/server-statefulset.yaml \
|
-x templates/server-statefulset.yaml \
|
||||||
--set 'global.image=foo' \
|
--set 'server.image.repository=foo' \
|
||||||
|
--set 'server.image.tag=1.2.3' \
|
||||||
--set 'server.standalone.enabled=true' \
|
--set 'server.standalone.enabled=true' \
|
||||||
. | tee /dev/stderr |
|
. | tee /dev/stderr |
|
||||||
yq -r '.spec.template.spec.containers[0].image' | tee /dev/stderr)
|
yq -r '.spec.template.spec.containers[0].image' | tee /dev/stderr)
|
||||||
[ "${actual}" = "foo" ]
|
[ "${actual}" = "foo:1.2.3" ]
|
||||||
|
}
|
||||||
|
|
||||||
|
@test "server/standalone-StatefulSet: image tag defaults to latest" {
|
||||||
|
cd `chart_dir`
|
||||||
|
local actual=$(helm template \
|
||||||
|
-x templates/server-statefulset.yaml \
|
||||||
|
--set 'server.image.repository=foo' \
|
||||||
|
--set 'server.image.tag=' \
|
||||||
|
. | tee /dev/stderr |
|
||||||
|
yq -r '.spec.template.spec.containers[0].image' | tee /dev/stderr)
|
||||||
|
[ "${actual}" = "foo:latest" ]
|
||||||
|
|
||||||
|
local actual=$(helm template \
|
||||||
|
-x templates/server-statefulset.yaml \
|
||||||
|
--set 'server.image.repository=foo' \
|
||||||
|
--set 'server.image.tag=' \
|
||||||
|
--set 'server.standalone.enabled=true' \
|
||||||
|
. | tee /dev/stderr |
|
||||||
|
yq -r '.spec.template.spec.containers[0].image' | tee /dev/stderr)
|
||||||
|
[ "${actual}" = "foo:latest" ]
|
||||||
}
|
}
|
||||||
|
|
||||||
@test "server/standalone-StatefulSet: default imagePullPolicy" {
|
@test "server/standalone-StatefulSet: default imagePullPolicy" {
|
||||||
cd `chart_dir`
|
cd `chart_dir`
|
||||||
local actual=$(helm template \
|
local actual=$(helm template \
|
||||||
-x templates/server-statefulset.yaml \
|
-x templates/server-statefulset.yaml \
|
||||||
--set 'global.image=foo' \
|
|
||||||
. | tee /dev/stderr |
|
. | tee /dev/stderr |
|
||||||
yq -r '.spec.template.spec.containers[0].imagePullPolicy' | tee /dev/stderr)
|
yq -r '.spec.template.spec.containers[0].imagePullPolicy' | tee /dev/stderr)
|
||||||
[ "${actual}" = "IfNotPresent" ]
|
[ "${actual}" = "IfNotPresent" ]
|
||||||
|
@ -64,10 +85,10 @@ load _helpers
|
||||||
cd `chart_dir`
|
cd `chart_dir`
|
||||||
local actual=$(helm template \
|
local actual=$(helm template \
|
||||||
-x templates/server-statefulset.yaml \
|
-x templates/server-statefulset.yaml \
|
||||||
--set 'global.imagePullPolicy=foo' \
|
--set 'server.image.pullPolicy=Always' \
|
||||||
. | tee /dev/stderr |
|
. | tee /dev/stderr |
|
||||||
yq -r '.spec.template.spec.containers[0].imagePullPolicy' | tee /dev/stderr)
|
yq -r '.spec.template.spec.containers[0].imagePullPolicy' | tee /dev/stderr)
|
||||||
[ "${actual}" = "foo" ]
|
[ "${actual}" = "Always" ]
|
||||||
}
|
}
|
||||||
|
|
||||||
@test "server/standalone-StatefulSet: Custom imagePullSecrets" {
|
@test "server/standalone-StatefulSet: Custom imagePullSecrets" {
|
||||||
|
|
11
values.yaml
11
values.yaml
|
@ -4,11 +4,6 @@ global:
|
||||||
# enabled is the master enabled switch. Setting this to true or false
|
# enabled is the master enabled switch. Setting this to true or false
|
||||||
# will enable or disable all the components within this chart by default.
|
# will enable or disable all the components within this chart by default.
|
||||||
enabled: true
|
enabled: true
|
||||||
|
|
||||||
# Image is the name (and tag) of the Vault Docker image.
|
|
||||||
image: "vault:1.2.4"
|
|
||||||
# Overrides the default Image Pull Policy
|
|
||||||
imagePullPolicy: IfNotPresent
|
|
||||||
# Image pull secret to use for registry authentication.
|
# Image pull secret to use for registry authentication.
|
||||||
imagePullSecrets: []
|
imagePullSecrets: []
|
||||||
# imagePullSecrets:
|
# imagePullSecrets:
|
||||||
|
@ -21,6 +16,12 @@ server:
|
||||||
# should map directly to the value of the resources field for a PodSpec.
|
# should map directly to the value of the resources field for a PodSpec.
|
||||||
# By default no direct resource request is made.
|
# By default no direct resource request is made.
|
||||||
|
|
||||||
|
image:
|
||||||
|
repository: "vault"
|
||||||
|
tag: 1.2.4
|
||||||
|
# Overrides the default Image Pull Policy
|
||||||
|
pullPolicy: IfNotPresent
|
||||||
|
|
||||||
resources:
|
resources:
|
||||||
# resources:
|
# resources:
|
||||||
# requests:
|
# requests:
|
||||||
|
|
Loading…
Reference in a new issue