Skip to content
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 charts/consul/templates/connect-inject-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@ spec:
chart: {{ template "consul.chart" . }}
release: {{ .Release.Name }}
component: connect-injector
{{- if .Values.connectInject.extraLabels }}
{{- toYaml .Values.connectInject.extraLabels | nindent 8 }}
{{- end }}
annotations:
"consul.hashicorp.com/connect-inject": "false"
{{- if .Values.connectInject.annotations }}
Expand Down
25 changes: 25 additions & 0 deletions charts/consul/test/unit/connect-inject-deployment.bats
Original file line number Diff line number Diff line change
Expand Up @@ -1217,6 +1217,31 @@ load _helpers
[ "${actual}" = "name" ]
}

#--------------------------------------------------------------------
# extraLabels

@test "connectInject/Deployment: no extra labels defined by default" {
cd `chart_dir`
local actual=$(helm template \
-s templates/connect-inject-deployment.yaml \
--set 'connectInject.enabled=true' \
. | tee /dev/stderr |
yq -r '.spec.template.metadata.labels | del(."app") | del(."chart") | del(."release") | del(."component")' | tee /dev/stderr)
[ "${actual}" = "{}" ]
}

@test "connectInject/Deployment: can set extra labels" {
cd `chart_dir`
local actual=$(helm template \
-s templates/connect-inject-deployment.yaml \
--set 'connectInject.enabled=true' \
--set 'connectInject.extraLabels.foo=bar' \
. | tee /dev/stderr |
yq -r '.spec.template.metadata.labels.foo' | tee /dev/stderr)

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

#--------------------------------------------------------------------
# annotations

Expand Down
13 changes: 13 additions & 0 deletions charts/consul/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2062,6 +2062,19 @@ connectInject:
# Optional priorityClassName.
priorityClassName: ""

# Extra labels to attach to the connect inject pods. This should be a YAML map.
#
# Example:
#
# ```yaml
# extraLabels:
# labelKey: label-value
# anotherLabelKey: another-label-value
# ```
#
# @type: map
extraLabels: null

# This value defines additional annotations for
# connect inject pods. This should be formatted as a multi-line string.
#
Expand Down