Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Backport of Consul client always logs into the local datacenter into release/1.0.x #2653

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .changelog/2652.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:bug
helm: fix CONSUL_LOGIN_DATACENTER for consul client-daemonset.
```
4 changes: 0 additions & 4 deletions charts/consul/templates/client-daemonset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -510,11 +510,7 @@ spec:
value: "component=client,pod=$(NAMESPACE)/$(POD_NAME)"
{{- end }}
- name: CONSUL_LOGIN_DATACENTER
{{- if and .Values.global.federation.enabled .Values.global.federation.primaryDatacenter }}
value: {{ .Values.global.federation.primaryDatacenter }}
{{- else }}
value: {{ .Values.global.datacenter }}
{{- end}}
command:
- "/bin/sh"
- "-ec"
Expand Down
23 changes: 0 additions & 23 deletions charts/consul/test/unit/client-daemonset.bats
Original file line number Diff line number Diff line change
Expand Up @@ -2127,29 +2127,6 @@ rollingUpdate:
[[ "$output" =~ "If global.federation.enabled is true, global.adminPartitions.enabled must be false because they are mutually exclusive" ]]
}

@test "client/DaemonSet: consul login datacenter is set to primary when when federation enabled in non-primary datacenter" {
cd `chart_dir`
local object=$(helm template \
-s templates/client-daemonset.yaml \
--set 'client.enabled=true' \
--set 'meshGateway.enabled=true' \
--set 'global.acls.manageSystemACLs=true' \
--set 'global.datacenter=dc1' \
--set 'global.federation.enabled=true' \
--set 'global.federation.primaryDatacenter=dc2' \
--set 'global.tls.enabled=true' \
. | tee /dev/stderr |
yq '.spec.template.spec.initContainers[] | select(.name == "client-acl-init")' | tee /dev/stderr)

local actual=$(echo $object |
yq '[.env[11].name] | any(contains("CONSUL_LOGIN_DATACENTER"))' | tee /dev/stderr)
[ "${actual}" = "true" ]

local actual=$(echo $object |
yq '[.env[11].value] | any(contains("dc2"))' | tee /dev/stderr)
[ "${actual}" = "true" ]
}

#--------------------------------------------------------------------
# extraContainers

Expand Down