Skip to content

Commit

Permalink
Merge pull request #2013 from hashicorp/NET-2966/sni-fix-gateway-cont…
Browse files Browse the repository at this point in the history
…roller

Add SNI skip for client node configuration
  • Loading branch information
Andrew Stucki authored Mar 14, 2023
2 parents 6fbb20f + 730ab26 commit a029eae
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 1 deletion.
3 changes: 3 additions & 0 deletions .changelog/2013.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:bug
api-gateway: fix issue where specifying an external server SNI name while using client nodes resulted in a TLS verification error.
```
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
18 changes: 18 additions & 0 deletions charts/consul/test/unit/api-gateway-controller-deployment.bats
Original file line number Diff line number Diff line change
Expand Up @@ -1418,6 +1418,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 a029eae

Please sign in to comment.