Skip to content

Commit

Permalink
feat: add annotations to injector service (#425)
Browse files Browse the repository at this point in the history
  • Loading branch information
rasta-rocket authored Dec 7, 2020
1 parent 0101816 commit 73e90a1
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 0 deletions.
15 changes: 15 additions & 0 deletions templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -293,6 +293,21 @@ Sets extra injector pod annotations
{{- end }}
{{- end -}}
{{/*
Sets extra injector service annotations
*/}}
{{- define "injector.service.annotations" -}}
{{- if .Values.injector.service.annotations }}
annotations:
{{- $tp := typeOf .Values.injector.service.annotations }}
{{- if eq $tp "string" }}
{{- tpl .Values.injector.service.annotations . | nindent 4 }}
{{- else }}
{{- toYaml .Values.injector.service.annotations | nindent 4 }}
{{- end }}
{{- end }}
{{- end -}}
{{/*
Sets extra ui service annotations
*/}}
Expand Down
1 change: 1 addition & 0 deletions templates/injector-service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ metadata:
app.kubernetes.io/name: {{ include "vault.name" . }}-agent-injector
app.kubernetes.io/instance: {{ .Release.Name }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
{{ template "injector.service.annotations" . }}
spec:
ports:
- port: 443
Expand Down
10 changes: 10 additions & 0 deletions test/unit/injector-service.bats
Original file line number Diff line number Diff line change
Expand Up @@ -35,3 +35,13 @@ load _helpers
yq 'length > 0' | tee /dev/stderr)
[ "${actual}" = "false" ]
}

@test "injector/Service: generic annotations" {
cd `chart_dir`
local actual=$(helm template \
--show-only templates/injector-service.yaml \
--set 'injector.service.annotations=vaultIsAwesome: true' \
. | tee /dev/stderr |
yq -r '.metadata.annotations["vaultIsAwesome"]' | tee /dev/stderr)
[ "${actual}" = "true" ]
}
5 changes: 5 additions & 0 deletions values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,11 @@ injector:
# of the annotations to apply to the injector pods
annotations: {}

# Injector service specific config
service:
# Extra annotations to attach to the injector service
annotations: {}

server:
# Resource requests, limits, etc. for the server cluster placement. This
# should map directly to the value of the resources field for a PodSpec.
Expand Down

0 comments on commit 73e90a1

Please sign in to comment.