Skip to content

feat: allow setting PersistentVolumeClaimRetentionPolicy#252

Open
ed-marks wants to merge 3 commits into
akyriako:mainfrom
ed-marks:ed/pvc-retention
Open

feat: allow setting PersistentVolumeClaimRetentionPolicy#252
ed-marks wants to merge 3 commits into
akyriako:mainfrom
ed-marks:ed/pvc-retention

Conversation

@ed-marks

@ed-marks ed-marks commented Mar 20, 2026

Copy link
Copy Markdown

Adds support for configuring StatefulSet PVC retention via spec.storage.persistentVolumeClaimRetentionPolicy on TypesenseCluster.

This lets you control what happens to PVCs on scale-down or cluster deletion (Retain/Delete) by wiring the CRD field through to the generated StatefulSet. I've added to the base sample what that looks like.

The main use case for me is short-lived test clusters, where PVCs should be cleaned up automatically when clusters are torn down, while still leaving production-like defaults.

I also noticed the local kind cluster was named incorrectly and there was a suspect OR condition flagged by go vet which always evaluated to true. I believe it was mean to be "when condition.Reason is neither ConditionReasonQuorumDowngraded or ConditionReasonQuorumQueuedWrites" which is what i've amended it to.

Also mostly FYI but running make helm overwrote a ton of stuff, almost all of which were out of scope of this PR. I've cherry-picked the bits of that this PR cares about.

@akyriako

Copy link
Copy Markdown
Owner

Hi @ed-marks thanks for the PR. Dont worry about the make helm changes, they are pre-release steps that shouldn't worry you. Please change PersistentVolumeClaimRetentionPolicy to RetentionPolicy because it is a mouthful and I would be glad closing the PR. Cheers!

@ed-marks

Copy link
Copy Markdown
Author

Hi @ed-marks thanks for the PR. Dont worry about the make helm changes, they are pre-release steps that shouldn't worry you. Please change PersistentVolumeClaimRetentionPolicy to RetentionPolicy because it is a mouthful and I would be glad closing the PR. Cheers!

Nice one thank you - I've made the rename, I'll see about manually testing it this week to make sure i've not missed anything

…ional, reverting policy from delete to retain fails akyriako#252

@akyriako akyriako left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

BUG 1: reverting from delete/delete to retain/retain seems to jam the Statefulset update. the PersistentVolumeClaims keep on getting deleted. (this derives from my changes)
BUG 2: (that's a crazy one, that I cannot recreate in main or in any other branch for that matter) create a cluster with 3 nodes, increase to 5 and then to 7. decrease to 3. nothing happens! the Statefulset remains with 7 replicas!!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants