From ad43445c0e945482099561d2bed0a3c8f125e13f Mon Sep 17 00:00:00 2001 From: Henrik Gerdes Date: Mon, 16 Sep 2024 09:27:40 +0200 Subject: [PATCH] feat(helm): allow setting extra pod volumes via chart values (#744) This adds the ability to set `extraVolumes` and `extraVolumeMounts` via helm to the pod. It can be used to mount extra files, to persist files inside the container or to allow usage of the CSI Secret Driver. It does not introduce breaking changes since the default for both is an empty array, so no volumes or volumeMounts are created when not explicitly set. Fixed #743 Signed-off-by: Henrik Gerdes --- chart/templates/daemonset.yaml | 8 ++++++++ chart/templates/deployment.yaml | 8 ++++++++ chart/values.yaml | 16 ++++++++++++++++ 3 files changed, 32 insertions(+) diff --git a/chart/templates/daemonset.yaml b/chart/templates/daemonset.yaml index 7dfc0b33..0669380b 100644 --- a/chart/templates/daemonset.yaml +++ b/chart/templates/daemonset.yaml @@ -92,5 +92,13 @@ spec: {{- end }} resources: {{- toYaml $.Values.resources | nindent 12 }} + {{- with .Values.extraVolumeMounts }} + volumeMounts: + {{- toYaml . | nindent 12 }} + {{- end }} priorityClassName: system-cluster-critical + {{- with .Values.extraVolumes }} + volumes: + {{- toYaml . | nindent 8 }} + {{- end }} {{- end }} diff --git a/chart/templates/deployment.yaml b/chart/templates/deployment.yaml index ea92a1e6..e5d0d06e 100644 --- a/chart/templates/deployment.yaml +++ b/chart/templates/deployment.yaml @@ -100,5 +100,13 @@ spec: {{- end }} resources: {{- toYaml $.Values.resources | nindent 12 }} + {{- with .Values.extraVolumeMounts }} + volumeMounts: + {{- toYaml . | nindent 12 }} + {{- end }} priorityClassName: system-cluster-critical + {{- with .Values.extraVolumes }} + volumes: + {{- toYaml . | nindent 8 }} + {{- end }} {{- end }} diff --git a/chart/values.yaml b/chart/values.yaml index f46ce43c..df8469c2 100644 --- a/chart/values.yaml +++ b/chart/values.yaml @@ -120,3 +120,19 @@ robot: podLabels: {} podAnnotations: {} + +# Mounts the specified volume to the hcloud-cloud-controller-manager container. +extraVolumeMounts: [] +# # Example +# extraVolumeMounts: +# - name: token-volume +# readOnly: true +# mountPath: /var/run/secrets/hcloud + +# Adds extra volumes to the pod. +extraVolumes: [] +# # Example +# extraVolumes: +# - name: token-volume +# secret: +# secretName: hcloud-token