Skip to content
This repository has been archived by the owner on Aug 25, 2021. It is now read-only.

Commit

Permalink
Error mirroringK8S=true but Consul NS's disabled
Browse files Browse the repository at this point in the history
  • Loading branch information
lkysow committed Nov 19, 2020
1 parent a793e70 commit b03a55f
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
1 change: 1 addition & 0 deletions templates/connect-inject-deployment.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{{- if (or (and (ne (.Values.connectInject.enabled | toString) "-") .Values.connectInject.enabled) (and (eq (.Values.connectInject.enabled | toString) "-") .Values.global.enabled)) }}
{{- if not (or (and (ne (.Values.client.enabled | toString) "-") .Values.client.enabled) (and (eq (.Values.client.enabled | toString) "-") .Values.global.enabled)) }}{{ fail "clients must be enabled for connect injection" }}{{ end }}
{{- if not .Values.client.grpc }}{{ fail "client.grpc must be true for connect injection" }}{{ end }}
{{- if and .Values.connectInject.consulNamespaces.mirroringK8S (not .Values.global.enableConsulNamespaces) }}{{ fail "global.enableConsulNamespaces must be true if mirroringK8S=true" }}{{ end }}
{{- if .Values.connectInject.imageEnvoy }}{{ fail "connectInject.imageEnvoy must be specified in global.imageEnvoy" }}{{ end }}
# The deployment for running the Connect sidecar injector
apiVersion: apps/v1
Expand Down
11 changes: 11 additions & 0 deletions test/unit/connect-inject-deployment.bats
Original file line number Diff line number Diff line change
Expand Up @@ -683,6 +683,17 @@ load _helpers
#--------------------------------------------------------------------
# namespaces

@test "connectInject/Deployment: fails if namespaces are disabled and mirroringK8S is true" {
cd `chart_dir`
run helm template \
-s templates/connect-inject-deployment.yaml \
--set 'global.enableConsulNamespaces=false' \
--set 'connectInject.consulNamespaces.mirroringK8S=true' \
--set 'connectInject.enabled=true' .
[ "$status" -eq 1 ]
[[ "$output" =~ "global.enableConsulNamespaces must be true if mirroringK8S=true" ]]
}

@test "connectInject/Deployment: namespace options disabled by default" {
cd `chart_dir`
local object=$(helm template \
Expand Down

0 comments on commit b03a55f

Please sign in to comment.