fix(helm): retain chart PVCs on uninstall#650
Conversation
Keep Helm-created PVCs by default, add existingClaim support for externally managed PVCs, and document the retention behavior. Supersedes the implementation from PR #166. Co-authored-by: Yen-Ying Lee <yenying.lee.1033@gmail.com>
|
All PRs must reference a prior Discord discussion to ensure community alignment before implementation. Please edit the PR description to include a link like: This PR will be automatically closed in 3 days if the link is not added. |
masami-agent
left a comment
There was a problem hiding this comment.
PR Review: #650
Based on commit: d2cfa9e
Summary
- Problem:
helm uninstalldeletes chart-created PVCs, causing data loss (auth tokens, session data). No way to reuse an existing PVC. - Approach: Add
helm.sh/resource-policy: keepannotation to PVCs +existingClaimsupport. Supersedes #166 (closed without merge). - Risk level: Low — additive change, backward compatible, follows established Helm patterns.
Core Assessment
- Problem clearly stated: ✅ (well-documented in #166 and #120)
- Approach appropriate: ✅ — follows Bitnami/Grafana de facto standard;
resource-policy: keepalready used insecret.yaml - Alternatives considered: ✅ (thoroughly documented in #166)
- Best approach for now: ✅ — minimal, non-breaking, industry-standard pattern
Findings
deployment.yaml — claimName expression
claimName: {{ (and $cfg.persistence $cfg.persistence.existingClaim) | default (include "openab.agentFullname" $d) }}
Logic verified:
persistencenil → falls back to generated name ✅existingClaim: ""→ falls back to generated name ✅existingClaim: "my-pvc"→ uses the provided name ✅
This matches the existing pattern used for storageClass and size in pvc.yaml.
pvc.yaml — skip creation + keep annotation
{{- if and (not (eq (include "openab.persistenceEnabled" $cfg) "false")) (not (and $cfg.persistence $cfg.persistence.existingClaim)) }}
Correctly gates PVC creation: only renders when persistence is enabled AND no existingClaim is set. The helm.sh/resource-policy: keep annotation is consistent with secret.yaml.
NOTES.txt — install notes
Clear messaging: tells users chart-created PVCs are retained and must be deleted manually. Distinguishes between chart-managed and existingClaim PVCs. ✅
persistence_test.yaml — Helm unit tests
4 test cases covering:
resource-policy: keepannotation present ✅- Default PVC mount uses generated name ✅
- PVC creation skipped when
existingClaimset ✅ - Deployment mounts
existingClaimwhen set ✅
Good coverage for the feature scope.
values.yaml — existingClaim added to all agent blocks
Added consistently to all 4 agent blocks (3 commented examples + 1 active kiro block). The active kiro block defaults to "" which preserves backward compatibility. ✅
docs/ai-install-upgrade.md — rollback guidance updated
Correctly updates the rollback diagram from "delete leftover PVC/secrets" to "chart PVCs are retained", and adds a clear note about PVC retention behavior. ✅
Review Summary
🔧 Suggested Changes
- The PR description does not include
Closes #120. Since this supersedes #166 and implements the feature requested in #120, consider addingCloses #120to the PR body so the issue auto-closes on merge.
ℹ️ Info
- PR #166 (original implementation by Yen-Ying Lee) was closed today without merge. This PR supersedes it with proper
Co-authored-bycredit. The approach is essentially the same — clean implementation. - The
closing-soonlabel is present because the PR is missing a Discord Discussion URL. This may need to be addressed per repo policy. helm.sh/resource-policy: keepmeans retained PVCs will accumulate if users repeatedly install/uninstall without manual cleanup. The NOTES.txt messaging handles this well by telling users to delete manually when intended.
⚪ Nits
- None.
Verdict
APPROVE — Clean, minimal, backward-compatible implementation of a well-established Helm pattern. Tests are solid, docs are updated, and the approach is consistent with existing chart conventions (secret.yaml already uses resource-policy: keep). No blockers.
Follow-up Review NotesA few additional items I missed in my initial review: 🟠 Important
🟡 Suggestions
- it: skips PVC when persistence is disabled
template: templates/pvc.yaml
set:
agents.kiro.persistence.enabled: false
asserts:
- hasDocuments:
count: 0
- it: skips data volume mount when persistence is disabled
template: templates/deployment.yaml
set:
agents.kiro.persistence.enabled: false
asserts:
- notExists:
path: spec.template.spec.volumes[1].persistentVolumeClaim
💬 Questions
|
Summary
helm uninstallwithhelm.sh/resource-policy: keepagents.<name>.persistence.existingClaimfor externally managed PVCsexistingClaimCredit
Supersedes #166. Original implementation and proposal by Yen-Ying Lee; the commit also includes
Co-authored-by: Yen-Ying Lee <yenying.lee.1033@gmail.com>.Validation
helm unittest charts/openab— 32/32 passedhelm lint charts/openab— passed