Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions pkg/helm/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ The chart should dump its version and appVersion in the Chart.yaml file every re
| `preferences.data` | Preferences to load | `{}` |
| `resources.*` | Allocated requests and limits resources | `{"requests": {...}, "limits": {...}}` |
| `persistence.enabled` | PVC resource creation | `true` |
| `persistence.existingClaim` | Provide existing PVC instead of creating one | `""` |
| `service.type` | Service type | `"ClusterIP"` |
| `service.loadBalancerIP` | Load balancer IP (Only if service.type is LoadBalancer) | `""` |
| `ingress.enabled` | Ingress resource creation | `false` |
Expand Down
2 changes: 1 addition & 1 deletion pkg/helm/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ spec:
{{- if .Values.persistence.enabled }}
- name: data
persistentVolumeClaim:
claimName: {{ template "pgadmin4.fullname" . }}
claimName: {{ .Values.persistence.existingClaim | default (include "pgadmin4.fullname" .) }}
{{- end }}
{{- if .Values.config_local.enabled }}
- name: config-local
Expand Down
4 changes: 2 additions & 2 deletions pkg/helm/templates/pvc.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{{- if .Values.persistence.enabled }}
{{- if and .Values.persistence.enabled (not .Values.persistence.existingClaim) }}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🗄️ 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)
PY

Repository: 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.

apiVersion: v1
kind: PersistentVolumeClaim
metadata:
Expand All @@ -17,4 +17,4 @@ spec:
requests:
storage: {{ .Values.persistence.size }}
accessModes: {{ .Values.persistence.accessModes }}
{{- end }}
{{- end }}
2 changes: 1 addition & 1 deletion pkg/helm/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ persistence:
size: 1Gi
storageClass: ""
accessModes: ["ReadWriteOnce"]
existingClaim: ""

service:
type: ClusterIP
Expand Down Expand Up @@ -179,4 +180,3 @@ containerSecurityContext:
type: RuntimeDefault
windowsOptions:
hostProcess: false