Skip to content

Commit

Permalink
Add federation flag to server-acl-init-job (hashicorp#983)
Browse files Browse the repository at this point in the history
* Update test/unit/server-acl-init-job.bats
Co-authored-by: Luke Kysow <1034429+lkysow@users.noreply.github.com>
  • Loading branch information
kschoche authored Jun 17, 2021
1 parent 4153375 commit 1c9a9e2
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
4 changes: 4 additions & 0 deletions templates/server-acl-init-job.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,10 @@ spec:
-create-acl-replication-token=true \
{{- end }}
{{- if .Values.global.federation.enabled }}
-federation=true \
{{- end }}
{{- if (and .Values.global.acls.bootstrapToken.secretName .Values.global.acls.bootstrapToken.secretKey) }}
-bootstrap-token-file=/consul/acl/tokens/bootstrap-token \
{{- else if (and .Values.global.acls.replicationToken.secretName .Values.global.acls.replicationToken.secretKey) }}
Expand Down
17 changes: 17 additions & 0 deletions test/unit/server-acl-init-job.bats
Original file line number Diff line number Diff line change
Expand Up @@ -1431,3 +1431,20 @@ load _helpers
yq '.spec.template.spec.containers[0].command | any(contains("create-controller-token"))' | tee /dev/stderr)
[ "${actual}" = "true" ]
}

#--------------------------------------------------------------------
# global.federation.enabled

@test "serverACLInit/Job: ensure federation is passed when federation is enabled" {
cd `chart_dir`
local actual=$(helm template \
-s templates/server-acl-init-job.yaml \
--set 'global.acls.manageSystemACLs=true' \
--set 'global.federation.enabled=true' \
--set 'global.tls.enabled=true' \
--set 'meshGateway.enabled=true' \
--set 'connectInject.enabled=true' \
. | tee /dev/stderr |
yq '.spec.template.spec.containers[0].command | any(contains("-federation"))' | tee /dev/stderr)
[ "${actual}" = "true" ]
}

0 comments on commit 1c9a9e2

Please sign in to comment.