Skip to content

Commit 5b15787

Browse files
Make 0.7.0 db upgrade run in ArgoCD. (#232)
* Make 0.7.0 db upgrade run in ArgoCD. * Add debugging steps for pgstac-eoapiuser-permissions-upgrade job failures * Removed previousVersion attribute. --------- Co-authored-by: Emmanuel Mathot <[email protected]>
1 parent b7b0cf9 commit 5b15787

File tree

2 files changed

+44
-3
lines changed

2 files changed

+44
-3
lines changed

.github/workflows/helm-tests.yml

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,45 @@ jobs:
9191
9292
exit $?
9393
94+
- name: debug pgstac-eoapiuser-permissions-upgrade job failure
95+
if: steps.helm-render-install-eoapi-templates.outcome == 'failure'
96+
continue-on-error: true
97+
run: |
98+
echo "Extracting pgstac-eoapiuser-permissions-upgrade job info and logs for debugging..."
99+
100+
# Get job details
101+
echo "===== pgstac-eoapiuser-permissions-upgrade Job Details ====="
102+
kubectl get job pgstac-eoapiuser-permissions-upgrade -o yaml || echo "Could not get job details"
103+
104+
# Get pod details
105+
echo "===== Pod Details ====="
106+
kubectl get pods --selector=app=pgstac-eoapiuser-permissions-upgrade -o wide || echo "Could not find pods"
107+
108+
# Extract logs from pods
109+
echo "===== Pod Logs ====="
110+
PODS=$(kubectl get pods --selector=app=pgstac-eoapiuser-permissions-upgrade -o jsonpath='{.items[*].metadata.name}' 2>/dev/null)
111+
if [ -n "$PODS" ]; then
112+
for POD in $PODS; do
113+
echo "--- Logs from pod $POD ---"
114+
kubectl logs $POD --previous || true # Get logs from previous container if it exists
115+
kubectl logs $POD || echo "Could not get logs from pod $POD"
116+
done
117+
else
118+
echo "No pods found for pgstac-eoapiuser-permissions-upgrade job"
119+
fi
120+
121+
# Get pod descriptions for more details
122+
echo "===== Pod Descriptions ====="
123+
kubectl describe pods --selector=app=pgstac-eoapiuser-permissions-upgrade || echo "Could not describe pods"
124+
125+
# Check the configmap contents
126+
echo "===== initdb ConfigMap Contents ====="
127+
kubectl get configmap initdb -o yaml || echo "Could not get initdb configmap"
128+
129+
# Check for any related events
130+
echo "===== Related Kubernetes Events ====="
131+
kubectl get events | grep -E "pgstac-eoapiuser-permissions-upgrade|initdb" || echo "No relevant events found"
132+
94133
- name: debug pgstac-migrate job failure
95134
if: steps.helm-render-install-eoapi-templates.outcome == 'failure'
96135
continue-on-error: true

helm-chart/eoapi/templates/pgstacbootstrap/eoapiuser-permissions-upgrade.yaml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
1-
{{- if and .Values.postgrescluster.enabled .Values.pgstacBootstrap.enabled .Release.IsUpgrade (semverCompare "< 0.7.0" .Values.previousVersion) }}
1+
{{- if and .Values.postgrescluster.enabled .Values.pgstacBootstrap.enabled }}
22
---
33
# This job is part of the upgrade process from pre-0.7.0 versions.
44
# Prior to 0.7.0, database schema updates were run with superuser privileges.
55
# This job ensures proper permissions are granted to the eoapi user during upgrade.
6+
# TODO: Remove with the next mayor verson and add to documentation that one needs to
7+
# through 0.7.x when upgrading.
68
apiVersion: batch/v1
79
kind: Job
810
metadata:
@@ -30,11 +32,11 @@ spec:
3032
- |
3133
# Exit immediately if a command exits with a non-zero status
3234
set -e
33-
35+
3436
# Run permission setup with superuser
3537
echo "Applying superuser permissions for upgrade from version {{ .Values.previousVersion }}..."
3638
PGUSER=postgres psql -f /opt/sql/initdb.sql
37-
39+
3840
echo "Permissions upgrade complete"
3941
resources:
4042
{{- toYaml .Values.pgstacBootstrap.settings.resources | nindent 12 }}

0 commit comments

Comments
 (0)