Add extraLabels for CSI DaemonSet (#690)

This commit is contained in:
Michael Schuett 2022-02-25 05:18:45 -07:00 committed by GitHub
parent b0528fce49
commit a2d9a0144f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 73 additions and 1 deletions

View file

@ -8,6 +8,9 @@ metadata:
app.kubernetes.io/name: {{ include "vault.name" . }}-csi-provider
app.kubernetes.io/instance: {{ .Release.Name }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
{{- if .Values.csi.daemonSet.extraLabels -}}
{{- toYaml .Values.csi.daemonSet.extraLabels | nindent 4 -}}
{{- end -}}
{{ template "csi.daemonSet.annotations" . }}
spec:
updateStrategy:
@ -25,6 +28,9 @@ spec:
labels:
app.kubernetes.io/name: {{ template "vault.name" . }}-csi-provider
app.kubernetes.io/instance: {{ .Release.Name }}
{{- if .Values.csi.pod.extraLabels -}}
{{- toYaml .Values.csi.pod.extraLabels | nindent 8 -}}
{{- end -}}
{{ template "csi.pod.annotations" . }}
spec:
{{- if .Values.csi.priorityClassName }}

View file

@ -8,5 +8,8 @@ metadata:
app.kubernetes.io/name: {{ include "vault.name" . }}-csi-provider
app.kubernetes.io/instance: {{ .Release.Name }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
{{- if .Values.csi.serviceAccount.extraLabels -}}
{{- toYaml .Values.csi.serviceAccount.extraLabels | nindent 4 -}}
{{- end -}}
{{ template "csi.serviceAccount.annotations" . }}
{{- end }}

View file

@ -318,6 +318,32 @@ load _helpers
[ "${actual}" = "true" ]
}
#--------------------------------------------------------------------
# Extra Labels
@test "csi/daemonset: specify csi.daemonSet.extraLabels" {
cd `chart_dir`
local actual=$(helm template \
--show-only templates/csi-daemonset.yaml \
--set 'csi.enabled=true' \
--set 'csi.daemonSet.extraLabels.foo=bar' \
. | tee /dev/stderr |
yq -r '.metadata.labels.foo' | tee /dev/stderr)
[ "${actual}" = "bar" ]
}
@test "csi/daemonset: specify csi.pod.extraLabels" {
cd `chart_dir`
local actual=$(helm template \
--show-only templates/csi-daemonset.yaml \
--set 'csi.enabled=true' \
--set 'csi.pod.extraLabels.foo=bar' \
. | tee /dev/stderr |
yq -r '.spec.template.metadata.labels.foo' | tee /dev/stderr)
[ "${actual}" = "bar" ]
}
#--------------------------------------------------------------------
# volumes

View file

@ -56,4 +56,19 @@ load _helpers
. | tee /dev/stderr |
yq -r '.metadata.annotations["foo"]' | tee /dev/stderr)
[ "${actual}" = "bar" ]
}
}
# serviceAccount extraLabels
@test "csi/serviceAccount: specify csi.serviceAccount.extraLabels" {
cd `chart_dir`
local actual=$(helm template \
--show-only templates/csi-serviceaccount.yaml \
--set 'csi.enabled=true' \
--set 'csi.serviceAccount.extraLabels.foo=bar' \
. | tee /dev/stderr |
yq -r '.metadata.labels.foo' | tee /dev/stderr)
[ "${actual}" = "bar" ]
}

View file

@ -14,6 +14,9 @@
"string"
]
},
"extraLabels": {
"type": "object"
},
"kubeletRootDir": {
"type": "string"
},
@ -88,6 +91,9 @@
"string"
]
},
"extraLabels": {
"type": "object"
},
"tolerations": {
"type": [
"null",
@ -128,6 +134,9 @@
"object",
"string"
]
},
"extraLabels": {
"type": "object"
}
}
},

View file

@ -805,6 +805,9 @@ csi:
providersDir: "/etc/kubernetes/secrets-store-csi-providers"
# Kubelet host path
kubeletRootDir: "/var/lib/kubelet"
# Extra labels to attach to the vault-csi-provider daemonSet
# This should be a YAML map of the labels to apply to the csi provider daemonSet
extraLabels: {}
pod:
# Extra annotations for the provider pods. This can either be YAML or a
@ -817,6 +820,12 @@ csi:
# in a PodSpec.
tolerations: []
# Extra labels to attach to the vault-csi-provider pod
# This should be a YAML map of the labels to apply to the csi provider pod
extraLabels: {}
# Priority class for csi pods
priorityClassName: ""
@ -826,6 +835,10 @@ csi:
# annotations to apply to the serviceAccount.
annotations: {}
# Extra labels to attach to the vault-csi-provider serviceAccount
# This should be a YAML map of the labels to apply to the csi provider serviceAccount
extraLabels: {}
# Used to configure readinessProbe for the pods.
readinessProbe:
# When a probe fails, Kubernetes will try failureThreshold times before giving up