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

feat: support setting connect inject deployment replicas #1029

Merged
merged 1 commit into from
Jul 13, 2021
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
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