Skip to content

Commit

Permalink
Don't mount consul-ca-cert when using system roots and external serve…
Browse files Browse the repository at this point in the history
…rs on main container
  • Loading branch information
Thomas Eckert committed Nov 30, 2022
1 parent 17492bc commit 005e147
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ IMPROVEMENTS:
BUG FIXES:
* Helm:
* Use the correct autogenerated cert for the API Gateway Controller when connecting to servers versus clients. [[GH-1753](https://github.com/hashicorp/consul-k8s/pull/1753)]
* Don't mount the CA cert when `externalServers.useSystemRoots` is `true`. [[GH-1753](https://github.com/hashicorp/consul-k8s/pull/1753)]

## 1.0.1 (November 21, 2022)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,8 @@ spec:
name: sds
protocol: TCP
env:
{{- if .Values.global.tls.enabled }}
{{- if or (not (and .Values.externalServers.enabled .Values.externalServers.useSystemRoots)) .Values.client.enabled }}
{{- if .Values.global.tls.enabled }}
- name: CONSUL_CACERT
value: /consul/tls/ca/tls.crt
{{- end }}
Expand Down Expand Up @@ -149,6 +149,7 @@ spec:
- name: consul-bin
mountPath: /consul-bin
{{- end }}
{{- if not (and .Values.externalServers.enabled .Values.externalServers.useSystemRoots) }}
{{- if .Values.global.tls.enabled }}
{{- if and .Values.client.enabled .Values.global.tls.enableAutoEncrypt }}
- name: consul-auto-encrypt-ca-cert
Expand All @@ -158,6 +159,7 @@ spec:
mountPath: /consul/tls/ca
readOnly: true
{{- end }}
{{- end }}
- mountPath: /consul/login
name: consul-data
readOnly: true
Expand Down
17 changes: 17 additions & 0 deletions charts/consul/test/unit/api-gateway-controller-deployment.bats
Original file line number Diff line number Diff line change
Expand Up @@ -1492,6 +1492,23 @@ load _helpers
[ "${actual}" = "false" ]
}

@test "apiGateway/Deployment: consul-ca-cert volume mount is not set when using externalServers and useSystemRoots" {
cd `chart_dir`
local actual=$(helm template \
-s templates/api-gateway-controller-deployment.yaml \
--set 'apiGateway.enabled=true' \
--set 'apiGateway.image=bar' \
--set 'global.acls.manageSystemACLs=true' \
--set 'global.tls.enabled=true' \
--set 'server.enabled=false' \
--set 'externalServers.hosts[0]=external-consul.host' \
--set 'externalServers.enabled=true' \
--set 'externalServers.useSystemRoots=true' \
. | tee /dev/stderr |
yq '.spec.template.spec.containers[0].env[] | select(.name == "consul-ca-cert")' | tee /dev/stderr)
[ "${actual}" = "" ]
}

@test "apiGateway/Deployment: consul-ca-cert volume mount is not set on acl-init when using externalServers and useSystemRoots" {
cd `chart_dir`
local actual=$(helm template \
Expand Down

0 comments on commit 005e147

Please sign in to comment.