Support global.image value

This commit is contained in:
Mitchell Hashimoto 2018-09-05 07:45:54 -07:00
parent a1528eda46
commit 9d37c9f2f1
No known key found for this signature in database
GPG key ID: 744E147AA52F5B0A
5 changed files with 50 additions and 4 deletions

View file

@ -37,7 +37,7 @@ spec:
containers: containers:
- name: consul - name: consul
image: "{{ .Values.client.image }}" image: "{{ default .Values.global.image .Values.client.image }}"
env: env:
- name: POD_IP - name: POD_IP
valueFrom: valueFrom:

View file

@ -53,7 +53,7 @@ spec:
name: {{ template "consul.fullname" . }}-server-config name: {{ template "consul.fullname" . }}-server-config
containers: containers:
- name: consul - name: consul
image: "{{ .Values.server.image }}" image: "{{ default .Values.global.image .Values.server.image }}"
env: env:
- name: POD_IP - name: POD_IP
valueFrom: valueFrom:

View file

@ -42,6 +42,27 @@ load _helpers
[ "${actual}" = "false" ] [ "${actual}" = "false" ]
} }
@test "client/DaemonSet: image defaults to global.image" {
cd `chart_dir`
local actual=$(helm template \
-x templates/client-daemonset.yaml \
--set 'global.image=foo' \
. | tee /dev/stderr |
yq -r '.spec.template.spec.containers[0].image' | tee /dev/stderr)
[ "${actual}" = "foo" ]
}
@test "client/DaemonSet: image can be overridden with client.image" {
cd `chart_dir`
local actual=$(helm template \
-x templates/client-daemonset.yaml \
--set 'global.image=foo' \
--set 'client.image=bar' \
. | tee /dev/stderr |
yq -r '.spec.template.spec.containers[0].image' | tee /dev/stderr)
[ "${actual}" = "bar" ]
}
@test "client/DaemonSet: no updateStrategy when not updating" { @test "client/DaemonSet: no updateStrategy when not updating" {
cd `chart_dir` cd `chart_dir`
local actual=$(helm template \ local actual=$(helm template \

View file

@ -42,6 +42,27 @@ load _helpers
[ "${actual}" = "false" ] [ "${actual}" = "false" ]
} }
@test "server/StatefulSet: image defaults to global.image" {
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].image' | tee /dev/stderr)
[ "${actual}" = "foo" ]
}
@test "server/StatefulSet: image can be overridden with server.image" {
cd `chart_dir`
local actual=$(helm template \
-x templates/server-statefulset.yaml \
--set 'global.image=foo' \
--set 'server.image=bar' \
. | tee /dev/stderr |
yq -r '.spec.template.spec.containers[0].image' | tee /dev/stderr)
[ "${actual}" = "bar" ]
}
@test "server/StatefulSet: no updateStrategy when not updating" { @test "server/StatefulSet: no updateStrategy when not updating" {
cd `chart_dir` cd `chart_dir`
local actual=$(helm template \ local actual=$(helm template \

View file

@ -14,9 +14,13 @@ global:
# Domain to register the Consul DNS server to listen for. # Domain to register the Consul DNS server to listen for.
domain: consul domain: consul
# Image is the name (and tag) of the Consul Docker image for clients and
# servers below. This can be overridden per component.
image: "consul:1.2.2"
server: server:
enabled: "-" enabled: "-"
image: "consul:1.2.2" image: null
replicas: 3 replicas: 3
bootstrapExpect: 3 # Should <= replicas count bootstrapExpect: 3 # Should <= replicas count
storage: 10Gi storage: 10Gi
@ -61,7 +65,7 @@ server:
# DC where a single agent is deployed per node. # DC where a single agent is deployed per node.
client: client:
enabled: "-" enabled: "-"
image: "consul:1.2.2" image: null
join: null join: null
# ConnectInject will enable the automatic Connect sidecar injector. # ConnectInject will enable the automatic Connect sidecar injector.