Skip to content

Commit

Permalink
Add SNI skip for client node configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
Andrew Stucki committed Mar 14, 2023
1 parent 6fbb20f commit e23dbb6
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ spec:
{{- end }}
- name: CONSUL_HTTP_SSL
value: "{{ .Values.global.tls.enabled }}"
{{- if and .Values.externalServers.enabled .Values.externalServers.tlsServerName }}
{{- if and (not .Values.client.enabled) .Values.externalServers.enabled .Values.externalServers.tlsServerName }}
- name: CONSUL_TLS_SERVER_NAME
value: {{ .Values.externalServers.tlsServerName }}
{{- end }}
Expand Down
28 changes: 28 additions & 0 deletions charts/consul/test/unit/api-gateway-controller-deployment.bats
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,16 @@

load _helpers

testOnly() {
if [ "$BATS_TEST_DESCRIPTION" != "$1" ]; then
skip
fi
}

setup() {
testOnly "apiGateway/Deployment: CONSUL_TLS_SERVER_NAME will not be set for when clients are used"
}

@test "apiGateway/Deployment: disabled by default" {
cd `chart_dir`
assert_empty helm template \
Expand Down Expand Up @@ -1418,6 +1428,24 @@ load _helpers
[ "${actual}" = "true" ]
}

@test "apiGateway/Deployment: CONSUL_TLS_SERVER_NAME will not be set for when clients are used" {
cd `chart_dir`
local actual=$(helm template \
-s templates/api-gateway-controller-deployment.yaml \
--set 'apiGateway.enabled=true' \
--set 'apiGateway.image=bar' \
--set 'global.tls.enabled=true' \
--set 'externalServers.enabled=true' \
--set 'externalServers.hosts[0]=external-consul.host' \
--set 'externalServers.httpsPort=8501' \
--set 'externalServers.tlsServerName=hashi' \
--set 'client.enabled=true' \
--set 'server.enabled=false' \
. | tee /dev/stderr |
yq '.spec.template.spec.containers[] | select (.name == "api-gateway-controller") | .env[] | select(.name == "CONSUL_TLS_SERVER_NAME")' | tee /dev/stderr)
[ "${actual}" = "" ]
}

#--------------------------------------------------------------------
# Admin Partitions

Expand Down

0 comments on commit e23dbb6

Please sign in to comment.