Skip to content
This repository has been archived by the owner on Aug 25, 2021. It is now read-only.

Commit

Permalink
pass health checks controller flag only when enabled (#673)
Browse files Browse the repository at this point in the history
* pass health checks flag only when enabled
Co-authored-by: Luke Kysow <[email protected]>
Co-authored-by: Iryna Shustava <[email protected]>
  • Loading branch information
kschoche authored Nov 5, 2020
1 parent cb81b04 commit 68b1028
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 7 deletions.
4 changes: 3 additions & 1 deletion templates/connect-inject-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,10 @@ spec:
-envoy-image="{{ .Values.global.imageEnvoy }}" \
-consul-k8s-image="{{ default .Values.global.imageK8S .Values.connectInject.image }}" \
-listen=:8080 \
-enable-health-checks-controller={{ .Values.connectInject.healthChecks.enabled }} \
{{- if .Values.connectInject.healthChecks.enabled }}
-enable-health-checks-controller=true \
-health-checks-reconcile-period={{ .Values.connectInject.healthChecks.reconcilePeriod }} \
{{- end }}
{{- if .Values.connectInject.overrideAuthMethodName }}
-acl-auth-method="{{ .Values.connectInject.overrideAuthMethodName }}" \
{{- else if .Values.global.acls.manageSystemACLs }}
Expand Down
16 changes: 10 additions & 6 deletions test/unit/connect-inject-deployment.bats
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,11 @@ load _helpers
yq '.spec.template.spec.containers[0].command' | tee /dev/stderr)

local actual=$(echo "$cmd" |
yq 'any(contains("-enable-health-checks-controller=false"))' | tee /dev/stderr)
[ "${actual}" = "true" ]
yq 'any(contains("-enable-health-checks-controller"))' | tee /dev/stderr)
[ "${actual}" = "false" ]
local actual=$(echo "$cmd" |
yq 'any(contains("-health-checks-reconcile-period"))' | tee /dev/stderr)
[ "${actual}" = "false" ]
}

@test "connectInject/Deployment: health checks can be enabled" {
Expand All @@ -116,15 +119,16 @@ load _helpers
yq '.spec.template.spec.containers[0].command' | tee /dev/stderr)

local actual=$(echo "$cmd" |
yq 'any(contains("-enable-health-checks-controller=false"))' | tee /dev/stderr)
[ "${actual}" = "true" ]
yq 'any(contains("-enable-health-checks-controller"))' | tee /dev/stderr)
[ "${actual}" = "false" ]
}

@test "connectInject/Deployment: health checks reconcile period set by default" {
@test "connectInject/Deployment: health checks reconcile period set by default when health checks are enabled" {
cd `chart_dir`
local cmd=$(helm template \
-s templates/connect-inject-deployment.yaml \
--set 'connectInject.enabled=true' \
--set 'connectInject.healthChecks.enabled=true' \
. | tee /dev/stderr |
yq '.spec.template.spec.containers[0].command' | tee /dev/stderr)

Expand Down Expand Up @@ -1423,4 +1427,4 @@ load _helpers
yq -r '.spec.template.spec.priorityClassName' | tee /dev/stderr)

[ "${actual}" = "name" ]
}
}

0 comments on commit 68b1028

Please sign in to comment.