feat: add annotations to injector service (#425)

This commit is contained in:
Bruno FERNANDO 2020-12-07 16:31:54 +01:00 committed by GitHub
parent 0101816d8d
commit 73e90a1308
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 31 additions and 0 deletions

View file

@ -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
*/}}

View file

@ -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

View file

@ -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" ]
}

View file

@ -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.