Add an option to set annotations on the StatefulSet (#199)
* Add tests for adding StatefulSet annotations Signed-off-by: Sam Weston <weston.sam@gmail.com> Co-authored-by: Theron Voran <tvoran@users.noreply.github.com>
This commit is contained in:
parent
7a8180862e
commit
ed0b918bf6
4 changed files with 53 additions and 0 deletions
|
@ -369,6 +369,21 @@ Sets PodSecurityPolicy annotations
|
||||||
{{- end }}
|
{{- end }}
|
||||||
{{- end -}}
|
{{- end -}}
|
||||||
|
|
||||||
|
{{/*
|
||||||
|
Sets extra statefulset annotations
|
||||||
|
*/}}
|
||||||
|
{{- define "vault.statefulSet.annotations" -}}
|
||||||
|
{{- if .Values.server.statefulSet.annotations }}
|
||||||
|
annotations:
|
||||||
|
{{- $tp := typeOf .Values.server.statefulSet.annotations }}
|
||||||
|
{{- if eq $tp "string" }}
|
||||||
|
{{- tpl .Values.server.statefulSet.annotations . | nindent 4 }}
|
||||||
|
{{- else }}
|
||||||
|
{{- toYaml .Values.server.statefulSet.annotations | nindent 4 }}
|
||||||
|
{{- end }}
|
||||||
|
{{- end }}
|
||||||
|
{{- end -}}
|
||||||
|
|
||||||
{{/*
|
{{/*
|
||||||
Set's the container resources if the user has set any.
|
Set's the container resources if the user has set any.
|
||||||
*/}}
|
*/}}
|
||||||
|
|
|
@ -11,6 +11,7 @@ metadata:
|
||||||
app.kubernetes.io/name: {{ include "vault.name" . }}
|
app.kubernetes.io/name: {{ include "vault.name" . }}
|
||||||
app.kubernetes.io/instance: {{ .Release.Name }}
|
app.kubernetes.io/instance: {{ .Release.Name }}
|
||||||
app.kubernetes.io/managed-by: {{ .Release.Service }}
|
app.kubernetes.io/managed-by: {{ .Release.Service }}
|
||||||
|
{{- template "vault.statefulSet.annotations" . }}
|
||||||
spec:
|
spec:
|
||||||
serviceName: {{ template "vault.fullname" . }}-internal
|
serviceName: {{ template "vault.fullname" . }}-internal
|
||||||
podManagementPolicy: Parallel
|
podManagementPolicy: Parallel
|
||||||
|
|
|
@ -850,6 +850,36 @@ load _helpers
|
||||||
[ "${actual}" = "bar" ]
|
[ "${actual}" = "bar" ]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# extra annotations
|
||||||
|
|
||||||
|
@test "server/standalone-StatefulSet: default statefulSet.annotations" {
|
||||||
|
cd `chart_dir`
|
||||||
|
local actual=$(helm template \
|
||||||
|
--show-only templates/server-statefulset.yaml \
|
||||||
|
. | tee /dev/stderr |
|
||||||
|
yq -r '.metadata.annotations' | tee /dev/stderr)
|
||||||
|
[ "${actual}" = "null" ]
|
||||||
|
}
|
||||||
|
|
||||||
|
@test "server/standalone-StatefulSet: specify statefulSet.annotations yaml" {
|
||||||
|
cd `chart_dir`
|
||||||
|
local actual=$(helm template \
|
||||||
|
--show-only templates/server-statefulset.yaml \
|
||||||
|
--set 'server.statefulSet.annotations.foo=bar' \
|
||||||
|
. | tee /dev/stderr |
|
||||||
|
yq -r '.metadata.annotations.foo' | tee /dev/stderr)
|
||||||
|
[ "${actual}" = "bar" ]
|
||||||
|
}
|
||||||
|
|
||||||
|
@test "server/standalone-StatefulSet: specify statefulSet.annotations yaml string" {
|
||||||
|
cd `chart_dir`
|
||||||
|
local actual=$(helm template \
|
||||||
|
--show-only templates/server-statefulset.yaml \
|
||||||
|
--set 'server.statefulSet.annotations=foo: bar' \
|
||||||
|
. | tee /dev/stderr |
|
||||||
|
yq -r '.metadata.annotations.foo' | tee /dev/stderr)
|
||||||
|
[ "${actual}" = "bar" ]
|
||||||
|
}
|
||||||
|
|
||||||
#--------------------------------------------------------------------
|
#--------------------------------------------------------------------
|
||||||
# Security Contexts
|
# Security Contexts
|
||||||
|
|
|
@ -501,6 +501,13 @@ server:
|
||||||
# annotations to apply to the serviceAccount.
|
# annotations to apply to the serviceAccount.
|
||||||
annotations: {}
|
annotations: {}
|
||||||
|
|
||||||
|
# Settings for the statefulSet used to run Vault.
|
||||||
|
statefulSet:
|
||||||
|
# Extra annotations for the statefulSet. This can either be YAML or a
|
||||||
|
# YAML-formatted multi-line templated string map of the annotations to apply
|
||||||
|
# to the statefulSet.
|
||||||
|
annotations: {}
|
||||||
|
|
||||||
# Vault UI
|
# Vault UI
|
||||||
ui:
|
ui:
|
||||||
# True if you want to create a Service entry for the Vault UI.
|
# True if you want to create a Service entry for the Vault UI.
|
||||||
|
|
Loading…
Reference in a new issue