From 3a55af62fe01ad944bff7b90d42f17f83d31be37 Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Tue, 21 Aug 2018 10:25:37 -0700 Subject: [PATCH] Allow overridable inject image, test images --- templates/connect-inject-deployment.yaml | 2 +- test/_helpers.bash | 15 +++++++++++++-- values.yaml | 1 + 3 files changed, 15 insertions(+), 3 deletions(-) diff --git a/templates/connect-inject-deployment.yaml b/templates/connect-inject-deployment.yaml index c15a5b0..aced776 100644 --- a/templates/connect-inject-deployment.yaml +++ b/templates/connect-inject-deployment.yaml @@ -27,7 +27,7 @@ spec: spec: containers: - name: sidecar-injector - image: us.gcr.io/mitchellh-k8s/consul-k8s:latest + image: "{{ .Values.connectInject.image }}" env: - name: NAMESPACE valueFrom: diff --git a/test/_helpers.bash b/test/_helpers.bash index 521a10a..b79f491 100644 --- a/test/_helpers.bash +++ b/test/_helpers.bash @@ -3,9 +3,20 @@ name_prefix() { printf "consul" } -# helm_install installs the Consul chart. +# helm_install installs the Consul chart. This will source overridable +# values from the "values.yaml" file in this directory. This can be set +# by CI or other environments to do test-specific overrides. Note that its +# easily possible to break tests this way so be careful. helm_install() { - helm install --name consul --wait ${BATS_TEST_DIRNAME}/.. + local values="${BATS_TEST_DIRNAME}/values.yaml" + if [ ! -f "${values}" ]; then + touch $values + fi + + helm install -f ${values} \ + --name consul \ + --wait \ + ${BATS_TEST_DIRNAME}/.. } # helm_delete deletes the Consul chart and all resources. diff --git a/values.yaml b/values.yaml index e8f316b..cf22426 100644 --- a/values.yaml +++ b/values.yaml @@ -61,6 +61,7 @@ client: # ConnectInject will enable the automatic Connect sidecar injector. connectInject: enabled: true + image: "us.gcr.io/mitchellh-k8s/consul-k8s:latest" default: false # true will inject by default, otherwise requires annotation caBundle: "" # empty will auto generate the bundle