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

Commit

Permalink
feat: support setting connect inject deployment replicas (#1029)
Browse files Browse the repository at this point in the history
  • Loading branch information
jhandguy authored Jul 13, 2021
1 parent 83b32de commit 9b4dba0
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 1 deletion.
2 changes: 1 addition & 1 deletion templates/connect-inject-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ metadata:
heritage: {{ .Release.Service }}
release: {{ .Release.Name }}
spec:
replicas: 2
replicas: {{ .Values.connectInject.replicas }}
selector:
matchLabels:
app: {{ template "consul.name" . }}
Expand Down
27 changes: 27 additions & 0 deletions test/unit/connect-inject-deployment.bats
Original file line number Diff line number Diff line change
Expand Up @@ -1446,4 +1446,31 @@ EOF
yq '.spec.template.spec.containers[0].command | any(contains("-enable-openshift"))' | tee /dev/stderr)

[ "${actual}" = "true" ]
}


#--------------------------------------------------------------------
# replicas

@test "connectInject/Deployment: replicas defaults to 2" {
cd `chart_dir`
local actual=$(helm template \
-s templates/connect-inject-deployment.yaml \
--set 'connectInject.enabled=true' \
. | tee /dev/stderr |
yq '.spec.replicas' | tee /dev/stderr)

[ "${actual}" = "2" ]
}

@test "connectInject/Deployment: replicas can be set" {
cd `chart_dir`
local actual=$(helm template \
-s templates/connect-inject-deployment.yaml \
--set 'connectInject.enabled=true' \
--set 'connectInject.replicas=3' \
. | tee /dev/stderr |
yq '.spec.replicas' | tee /dev/stderr)

[ "${actual}" = "3" ]
}
3 changes: 3 additions & 0 deletions values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1376,6 +1376,9 @@ connectInject:
# global.enabled.
enabled: false

# The number of deployment replicas.
replicas: 2

# Image for consul-k8s that contains the injector
# @type: string
image: null
Expand Down

0 comments on commit 9b4dba0

Please sign in to comment.