add global.imageK8S for consul-k8s

This commit is contained in:
Mitchell Hashimoto 2018-09-25 09:19:19 -05:00
parent 560c461c9b
commit 71b899159c
No known key found for this signature in database
GPG key ID: 744E147AA52F5B0A
3 changed files with 32 additions and 1 deletions

View file

@ -27,7 +27,7 @@ spec:
spec: spec:
containers: containers:
- name: consul-sync-catalog - name: consul-sync-catalog
image: "{{ .Values.syncCatalog.image }}" image: "{{ default .Values.global.imageK8S .Values.syncCatalog.image }}"
env: env:
- name: HOST_IP - name: HOST_IP
valueFrom: valueFrom:

View file

@ -42,6 +42,32 @@ load _helpers
[ "${actual}" = "false" ] [ "${actual}" = "false" ]
} }
#--------------------------------------------------------------------
# image
@test "syncCatalog/Deployment: image defaults to global.imageK8S" {
cd `chart_dir`
local actual=$(helm template \
-x templates/sync-catalog-deployment.yaml \
--set 'global.imageK8S=bar' \
--set 'syncCatalog.enabled=true' \
. | tee /dev/stderr |
yq -r '.spec.template.spec.containers[0].image' | tee /dev/stderr)
[ "${actual}" = "bar" ]
}
@test "syncCatalog/Deployment: image can be overridden with server.image" {
cd `chart_dir`
local actual=$(helm template \
-x templates/sync-catalog-deployment.yaml \
--set 'global.imageK8S=foo' \
--set 'syncCatalog.enabled=true' \
--set 'syncCatalog.image=bar' \
. | tee /dev/stderr |
yq -r '.spec.template.spec.containers[0].image' | tee /dev/stderr)
[ "${actual}" = "bar" ]
}
#-------------------------------------------------------------------- #--------------------------------------------------------------------
# toConsul and toK8S # toConsul and toK8S

View file

@ -18,6 +18,11 @@ global:
# servers below. This can be overridden per component. # servers below. This can be overridden per component.
image: "consul:1.2.3" image: "consul:1.2.3"
# imageK8S is the name (and tag) of the consul-k8s Docker image that
# is used for functionality such as the catalog sync. This can be overridden
# per component below.
imageK8S: "hashicorp/consul-k8s:0.1.0"
# Datacenter is the name of the datacenter that the agents should register # Datacenter is the name of the datacenter that the agents should register
# as. This shouldn't be changed once the Consul cluster is up and running # as. This shouldn't be changed once the Consul cluster is up and running
# since Consul doesn't support an automatic way to change this value # since Consul doesn't support an automatic way to change this value