Skip to content

feat: make StorageClass reclaimPolicy configurable via values.yaml - #10040

Merged
leon-ape merged 1 commit into
apecloud:mainfrom
srikxcipher:storage-class-policy-fix
Feb 6, 2026
Merged

feat: make StorageClass reclaimPolicy configurable via values.yaml#10040
leon-ape merged 1 commit into
apecloud:mainfrom
srikxcipher:storage-class-policy-fix

Conversation

@srikxcipher

Copy link
Copy Markdown
Contributor

Problem

reclaimPolicy: Delete is hardcoded as a literal in deploy/helm/templates/storageclass.yaml for all six cloud providers (AWS, GCP, Alibaba, Tencent, Azure, Huawei). Other
fields in the same template — volumeType, fsType — are already templated through values.yaml, but reclaimPolicy is not.

This means there is no way to set reclaimPolicy: Retain on the KubeBlocks-provisioned StorageClass without either skipping StorageClass creation entirely or patching every
PV individually after provisioning. For datastore workloads (MongoDB, PostgreSQL, MySQL, Redis), this removes the standard Kubernetes safety net against accidental PVC
deletion — particularly dangerous when combined with terminationPolicy: Delete, which explicitly deletes PVCs during cluster teardown.

Changes

  • deploy/helm/templates/storageclass.yaml — replaced hardcoded reclaimPolicy: Delete in all six provider blocks with {{ .Values.storageClass.reclaimPolicy | default "Delete" }}
  • deploy/helm/values.yaml — added storageClass.reclaimPolicy with default Delete

Behaviour

  • Default is Delete — zero change for any existing install unless the value is explicitly set
  • To opt in: helm upgrade kubeblocks kubeblocks/kubeblocks --set storageClass.reclaimPolicy=Retain

Migration note for existing clusters

reclaimPolicy is inherited by each PV at creation time only. Changing the StorageClass does not retroactively update already-provisioned PVs. Existing PVs must be
patched individually:

kubectl patch pv <pv-name> -p '{"spec":{"persistentVolumeReclaimPolicy":"Retain"}}'                                                                                          
                                                                                                                                                                             
References                                                                                                                                                                   
                                                                                                                                                                             
- Kubernetes docs on reclaim policy: https://kubernetes.io/docs/concepts/storage/persistent-volumes/#reclaiming                                                              
- Related: terminationPolicy gap for datastore workloads (Halt removal in v1.0)                                                                                              
                                                                                                                                                                             
---

@srikxcipher
srikxcipher requested a review from a team as a code owner February 5, 2026 07:40
@CLAassistant

CLAassistant commented Feb 5, 2026

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

@apecloud-bot

Copy link
Copy Markdown
Collaborator

Auto Cherry-pick Instructions

Usage:
  - /nopick: Not auto cherry-pick when PR merged.
  - /pick: release-x.x [release-x.x]: Auto cherry-pick to the specified branch when PR merged.

Example:
  - /nopick
  - /pick release-1.1

@github-actions github-actions Bot added the size/S Denotes a PR that changes 10-29 lines. label Feb 5, 2026
@apecloud-bot apecloud-bot added the pre-approve Fork PR Pre Approve Test label Feb 5, 2026
@shanshanying shanshanying added pick-1.0 Auto cherry-pick to release-1.0 when PR merged pick-1.1 Auto cherry-pick to release-1.1 when PR merged labels Feb 6, 2026
@shanshanying

Copy link
Copy Markdown
Collaborator

hi @srikxcipher don't forget to sign the CLA.

@srikxcipher

Copy link
Copy Markdown
Contributor Author

hi @srikxcipher don't forget to sign the CLA.

Done ...

@leon-ape
leon-ape merged commit 79c4d57 into apecloud:main Feb 6, 2026
37 of 38 checks passed
@github-actions github-actions Bot added this to the Release 1.2.0 milestone Feb 6, 2026
@apecloud-bot

Copy link
Copy Markdown
Collaborator

/cherry-pick release-1.1

@apecloud-bot

Copy link
Copy Markdown
Collaborator

/cherry-pick release-1.0

@apecloud-bot

Copy link
Copy Markdown
Collaborator

🤖 says: cherry pick action finished successfully 🎉!
See: https://github.com/apecloud/kubeblocks/actions/runs/21742027639

@apecloud-bot

Copy link
Copy Markdown
Collaborator

🤖 says: cherry pick action finished successfully 🎉!
See: https://github.com/apecloud/kubeblocks/actions/runs/21742028254

apecloud-bot pushed a commit that referenced this pull request Feb 6, 2026
apecloud-bot pushed a commit that referenced this pull request Feb 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pick-1.0 Auto cherry-pick to release-1.0 when PR merged pick-1.1 Auto cherry-pick to release-1.1 when PR merged pre-approve Fork PR Pre Approve Test size/S Denotes a PR that changes 10-29 lines.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants