Skip to content

feat(dgraph): add persistentVolumeClaimRetentionPolicy support - #136

Closed
mlwelles wants to merge 1 commit into
dgraph-io:mainfrom
mlwelles:add-pvc-retention-policy
Closed

feat(dgraph): add persistentVolumeClaimRetentionPolicy support#136
mlwelles wants to merge 1 commit into
dgraph-io:mainfrom
mlwelles:add-pvc-retention-policy

Conversation

@mlwelles

Copy link
Copy Markdown

What

Expose persistentVolumeClaimRetentionPolicy on the Alpha and Zero StatefulSets, configurable per tier under persistence.

Why

The chart hard-codes the StatefulSet spec without this field, so Kubernetes applies its Retain/Retain default implicitly. PVCs (and the cloud volumes behind them) are therefore left orphaned on helm uninstall and on scale-down, with no chart-level way to opt into cleanup. This change lets operators set the policy deliberately and see it in the rendered manifests.

Behavior

Non-breaking and opt-in. The default values leave the policy unset, and the template renders the field only when persistence is enabled and the policy object is set. Existing releases produce identical manifests. Operators opt in by setting whenDeleted and/or whenScaled to Retain or Delete; an unset sub-key falls back to Retain.

alpha:
  persistence:
    persistentVolumeClaimRetentionPolicy:
      whenDeleted: Retain   # or Delete
      whenScaled: Retain    # or Delete
zero:
  persistence:
    persistentVolumeClaimRetentionPolicy:
      whenDeleted: Retain
      whenScaled: Retain

Changes

  • templates/alpha/statefulset.yaml, templates/zero/statefulset.yaml: render a spec-level persistentVolumeClaimRetentionPolicy block, guarded on persistence being enabled and the policy being set.
  • values.yaml: document the value (commented) under both alpha.persistence and zero.persistence.
  • README.md: add the value to the configuration tables.

Validation

  • helm lint passes.
  • Default helm template output is unchanged (field omitted).
  • --set alpha.persistence.persistentVolumeClaimRetentionPolicy.whenDeleted=Delete renders whenDeleted: Delete with whenScaled defaulting to Retain.

Notes

persistentVolumeClaimRetentionPolicy is GA as of Kubernetes 1.27. Chart version unchanged, since the version tracks the Dgraph release; happy to adjust to match maintainer preference.

Expose persistentVolumeClaimRetentionPolicy on the Alpha and Zero
StatefulSets so PVCs (and their backing cloud volumes) are handled
deliberately on `helm uninstall` and scale-down, instead of being left
orphaned with no chart-level way to opt into cleanup.

The field renders only when persistence is enabled and the policy object is
set, so existing releases are unaffected: the default values leave it unset,
preserving Kubernetes' own Retain/Retain behavior and producing identical
manifests. Operators opt in by setting whenDeleted/whenScaled to Retain or
Delete. Requires Kubernetes >= 1.27, where the field is GA.
@mlwelles

Copy link
Copy Markdown
Author

Superseded by #140, which folds this change (persistentVolumeClaimRetentionPolicy for alpha and zero) in verbatim as part of a larger portable-enhancements backport, and also bumps Chart.yaml so it will actually publish via chart-releaser. Closing in favor of #140.

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.

1 participant