Skip to content

feat: add extraContainers, extraVolumes, extraVolumeMounts on alpha and zero#138

Open
krdabrowski wants to merge 1 commit into
dgraph-io:mainfrom
krdabrowski:feat/extra-containers-volumes
Open

feat: add extraContainers, extraVolumes, extraVolumeMounts on alpha and zero#138
krdabrowski wants to merge 1 commit into
dgraph-io:mainfrom
krdabrowski:feat/extra-containers-volumes

Conversation

@krdabrowski

Copy link
Copy Markdown

Closes #137.

What

Adds three optional values on both alpha and zero, all defaulting to []:

  • extraContainers — sidecar containers, rendered into the pod spec after the primary Dgraph container.
  • extraVolumes — pod-level volumes usable by the primary container and any sidecars.
  • extraVolumeMounts — additional mounts on the primary Dgraph container (for e.g. shared cert/config material that sidecars also need).

Rendering convention matches the existing alpha.extraInitContainers (v25.0.0-preview6): tpl (toYaml .) $ | nindent <n>, which lets Helm template expressions inside sidecar specs resolve at render time.

Why

Every non-trivial Dgraph deployment eventually needs a sidecar: log forwarder, mTLS metrics proxy (particularly under client_auth_type: REQUIREANDVERIFY, where scrapers can't present client certs), local auth translator, mesh helper. Without native extension points users fork the chart or run postrender scripts, both of which drift on upgrades. Established charts (Bitnami, Grafana, kube-prometheus-stack, cert-manager) all expose extraContainers; this PR aligns Dgraph with that convention.

Diff overview

  • charts/dgraph/values.yaml — three new keys documented under each of alpha and zero. Zero currently has no extraInitContainers; this PR does not add one to keep scope narrow, but the same convention would apply if wanted in a follow-up.
  • charts/dgraph/templates/alpha/statefulset.yaml — three {{- with }} blocks. extraContainers renders after the primary container's volumeMounts list, before terminationGracePeriodSeconds. extraVolumeMounts extends the primary container's volumeMounts. extraVolumes extends the pod's volumes list, before volumeClaimTemplates.
  • charts/dgraph/templates/zero/statefulset.yaml — same three blocks in the equivalent positions.

Total: +51 lines across three files, 0 lines removed.

Backward compatibility

All three values default to []. helm template output is byte-identical to today when the new keys are not set (verified locally with diff against main).

Verification

  • helm lint charts/dgraph — passes.
  • helm template charts/dgraph with all three keys empty — produces the same rendered StatefulSets as before the change (verified via diff: 0 differences).
  • helm template charts/dgraph --set-json 'alpha.extraContainers=[{"name":"probe","image":"busybox:1.36","command":["sleep","3600"]}]' — renders the sidecar correctly in alpha's pod spec, before terminationGracePeriodSeconds.
  • Same test on alpha.extraVolumes and alpha.extraVolumeMounts, rendering at the correct positions.
  • All three tests repeated on zero.* with equivalent results.

Not in this PR

  • zero.extraInitContainers — deferred; separate concern, easy follow-up if wanted.
  • podSpec-level extensions (hostAliases, dnsConfig, etc.) — separate concern.

…nd 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 <n>`, so Helm template expressions inside
sidecar specs resolve at render time.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

feat: allow extra containers and volumes on alpha and zero StatefulSets

1 participant