Helm Chart: Add existingClaim to persistence - #10230
Conversation
WalkthroughThe Helm chart adds ChangesHelm persistence configuration
Estimated code review effort: 2 (Simple) | ~10 minutes 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@pkg/helm/templates/pvc.yaml`:
- Line 1: Update the PVC template condition around persistence.existingClaim so
an existing-claim migration does not remove the previously generated PVC from
Helm-managed resources; add the chart’s retention or deletion-protection
mechanism for this transition, and cover the upgrade path with a test.
🪄 Autofix
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro Plus
Run ID: 7fa265c8-7169-454d-bd53-bd4fafca299e
📒 Files selected for processing (4)
pkg/helm/README.mdpkg/helm/templates/deployment.yamlpkg/helm/templates/pvc.yamlpkg/helm/values.yaml
| @@ -1,4 +1,4 @@ | |||
| {{- if .Values.persistence.enabled }} | |||
| {{- if and .Values.persistence.enabled (not .Values.persistence.existingClaim) }} | |||
There was a problem hiding this comment.
🗄️ Data Integrity & Integration | 🟠 Major | 🏗️ Heavy lift
🧩 Analysis chain
🏁 Script executed:
#!/usr/bin/env bash
set -euo pipefail
old_manifest="$(mktemp)"
new_manifest="$(mktemp)"
trap 'rm -f "$old_manifest" "$new_manifest"' EXIT
helm template review pkg/helm \
--set persistence.enabled=true \
--set persistence.existingClaim="" >"$old_manifest"
helm template review pkg/helm \
--set persistence.enabled=true \
--set persistence.existingClaim=precreated-pgadmin >"$new_manifest"
grep -q '^kind: PersistentVolumeClaim$' "$old_manifest"
if grep -q '^kind: PersistentVolumeClaim$' "$new_manifest"; then
echo "The existing-claim render still creates a PVC" >&2
exit 1
fi
echo "The existing-claim configuration removes the generated PVC from the target manifest."Repository: pgadmin-org/pgadmin4
Length of output: 200
🏁 Script executed:
#!/bin/bash
set -euo pipefail
echo "Locate pvc.yaml and related values:"
fd -a 'pvc\.yaml$|values\.yaml$|README' . | sed 's#^\./##' | head -50
echo
echo "pvc.yaml excerpt:"
if [ -f pkg/helm/templates/pvc.yaml ]; then
cat -n pkg/helm/templates/pvc.yaml
fi
echo
echo "values snippets:"
for f in $(fd 'values\.ya?ml$' .); do
echo "--- $f"
rg -n "persistence|existingClaim|persistence" "$f" -C 3 || true
done
echo
echo "Search for persistence.existingClaim usages:"
rg -n "existingClaim|existingClaimName|retentionPolicy|deleteOn" .Repository: pgadmin-org/pgadmin4
Length of output: 2336
🏁 Script executed:
#!/bin/bash
set -euo pipefail
echo "Deployment claimName logic:"
cat -n pkg/helm/templates/deployment.yaml | sed -n '55,80p'
echo
echo "helm-specific docs for existingClaim/persistence:"
cat -n pkg/helm/README.md | sed -n '30,45p'
echo
echo "Behavioral probe with the template condition as data:"
python3 - <<'PY'
values = {
"persistence": {"enabled": True, "existingClaim": ""},
}
old = bool(values["persistence"]["enabled"]) and not values["persistence"]["existingClaim"]
values = {
"persistence": {"enabled": True, "existingClaim": "precreated-pgadmin"},
}
new = bool(values["persistence"]["enabled"]) and not values["persistence"]["existingClaim"]
print("enabled, existingClaim='':", old)
print("enabled, existingClaim='precreated-pgadmin':", new)
PYRepository: pgadmin-org/pgadmin4
Length of output: 3203
Preserve the generated PVC when migrating to an existing claim.
Setting persistence.existingClaim changes the deployment to claimName: precreated-pgadmin, but the generated PVC block is removed from the manifest by the condition at pkg/helm/templates/pvc.yaml:1. Helm can then delete that chart-managed PVC during the upgrade. Add a retention/migration path or an explicit deletion-protection flag, and cover this upgrade path.
🧰 Tools
🪛 YAMLlint (1.37.1)
[error] 1-1: syntax error: expected the node content, but found '-'
(syntax)
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@pkg/helm/templates/pvc.yaml` at line 1, Update the PVC template condition
around persistence.existingClaim so an existing-claim migration does not remove
the previously generated PVC from Helm-managed resources; add the chart’s
retention or deletion-protection mechanism for this transition, and cover the
upgrade path with a test.
Hello!
This change aims to make it possible for users to provide their own PVC instead of the Chart to create one or not use persistence at all.
Important
I also noticed that the current version of the Helm chart (
9.17.0) fails by default, because there is no9.17.0pgadmin4 Docker image, only9.17. I fixed this by hand in my setup, but should be fixed by actually uploading the correct tag the Helm chart is requestingThank you
Summary by CodeRabbit
persistence.existingClaimHelm setting.