From 6dde783bf6c58ebd565caed43ef3564ae8b2880a Mon Sep 17 00:00:00 2001 From: Krystian Dabrowski Date: Thu, 2 Jul 2026 13:08:14 +0200 Subject: [PATCH] feat: add extraContainers, extraVolumes, extraVolumeMounts on alpha and zero Adds three optional values on both alpha and zero, all defaulting to []. Backward-compatible: helm template output is identical when the new keys are not set. Rendering convention matches the existing alpha.extraInitContainers: `tpl (toYaml .) $ | nindent `, so Helm template expressions inside sidecar specs resolve at render time. --- .../dgraph/templates/alpha/statefulset.yaml | 9 +++++ charts/dgraph/templates/zero/statefulset.yaml | 9 +++++ charts/dgraph/values.yaml | 33 +++++++++++++++++++ 3 files changed, 51 insertions(+) diff --git a/charts/dgraph/templates/alpha/statefulset.yaml b/charts/dgraph/templates/alpha/statefulset.yaml index 0bd3c702c..47fe37517 100644 --- a/charts/dgraph/templates/alpha/statefulset.yaml +++ b/charts/dgraph/templates/alpha/statefulset.yaml @@ -280,6 +280,12 @@ spec: - name: backups-vol-volume mountPath: {{ .Values.backups.volume.mountPath }} {{- end }} + {{- with .Values.alpha.extraVolumeMounts }} + {{- tpl (toYaml .) $ | nindent 8 }} + {{- end }} + {{- with .Values.alpha.extraContainers }} + {{- tpl (toYaml .) $ | nindent 6 }} + {{- end }} terminationGracePeriodSeconds: {{ .Values.alpha.terminationGracePeriodSeconds }} volumes: - name: datadir @@ -324,6 +330,9 @@ spec: secret: secretName: {{ template "dgraph.alpha.fullname" . }}-acl-secret {{- end }} + {{- with .Values.alpha.extraVolumes }} + {{- tpl (toYaml .) $ | nindent 6 }} + {{- end }} {{- if .Values.alpha.persistence.enabled }} volumeClaimTemplates: - metadata: diff --git a/charts/dgraph/templates/zero/statefulset.yaml b/charts/dgraph/templates/zero/statefulset.yaml index 27c5b9e61..8646b4178 100644 --- a/charts/dgraph/templates/zero/statefulset.yaml +++ b/charts/dgraph/templates/zero/statefulset.yaml @@ -202,6 +202,12 @@ spec: - name: tls-volume mountPath: /dgraph/tls {{- end }} + {{- with .Values.zero.extraVolumeMounts }} + {{- tpl (toYaml .) $ | nindent 8 }} + {{- end }} + {{- with .Values.zero.extraContainers }} + {{- tpl (toYaml .) $ | nindent 6 }} + {{- end }} terminationGracePeriodSeconds: {{ .Values.zero.terminationGracePeriodSeconds }} volumes: - name: datadir @@ -221,6 +227,9 @@ spec: secret: secretName: {{ template "dgraph.zero.fullname" . }}-tls-secret {{- end }} + {{- with .Values.zero.extraVolumes }} + {{- tpl (toYaml .) $ | nindent 6 }} + {{- end }} {{- if .Values.zero.persistence.enabled }} volumeClaimTemplates: - metadata: diff --git a/charts/dgraph/values.yaml b/charts/dgraph/values.yaml index 1743d5419..4f57d3bc5 100644 --- a/charts/dgraph/values.yaml +++ b/charts/dgraph/values.yaml @@ -247,6 +247,22 @@ zero: customLivenessProbe: {} customReadinessProbe: {} + ## Extra containers to run alongside the zero container in each pod. + ## Rendered into the StatefulSet pod spec `containers` list after the + ## zero container. Values are processed through `tpl`, so Helm template + ## expressions inside container specs are resolved at render time. + extraContainers: [] + + ## Extra pod-level volumes. Available to the zero container via + ## extraVolumeMounts below, and to any extraContainers via their own + ## volumeMounts. + extraVolumes: [] + + ## Extra volumeMounts attached to the zero container itself. To attach + ## mounts to a sidecar, declare them inside that sidecar's container + ## spec under extraContainers. + extraVolumeMounts: [] + alpha: name: alpha metrics: @@ -478,6 +494,23 @@ alpha: # Enables extra init containers to be added to the alpha statefulset extraInitContainers: [] + ## Extra containers to run alongside the alpha container in each pod. + ## Rendered into the StatefulSet pod spec `containers` list after the + ## alpha container. Values are processed through `tpl`, so Helm template + ## expressions inside container specs are resolved at render time (same + ## semantics as extraInitContainers above). + extraContainers: [] + + ## Extra pod-level volumes. Available to the alpha container via + ## extraVolumeMounts below, and to any extraContainers via their own + ## volumeMounts. + extraVolumes: [] + + ## Extra volumeMounts attached to the alpha container itself. To attach + ## mounts to a sidecar, declare them inside that sidecar's container + ## spec under extraContainers. + extraVolumeMounts: [] + ## You may want to initialize the Alphas with data before starting Alpha containers. ## Examples can include: ## * offline data restore from binary backups with `dgraph restore`