11{{- if and .Values.postgrescluster.enabled .Values.pgstacBootstrap.enabled }}
22---
3- # This job is part of the upgrade process from pre-0.7.0 versions.
4- # Prior to 0.7.0, database schema updates were run with superuser privileges.
5- # 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.
3+ # The eoapi database user runs pgstac migrate and needs some elevated object
4+ # level permissions without being a superuser.
85apiVersion : batch/v1
96kind : Job
107metadata :
118 name : pgstac-eoapiuser-permissions-upgrade
129 labels :
1310 app : pgstac-eoapiuser-permissions-upgrade
1411 annotations :
15- helm.sh/hook : " post-upgrade"
12+ helm.sh/hook : " post-install,post- upgrade"
1613 helm.sh/hook-weight : " -7"
1714 helm.sh/hook-delete-policy : " before-hook-creation"
1815spec :
@@ -33,11 +30,10 @@ spec:
3330 # Exit immediately if a command exits with a non-zero status
3431 set -e
3532
36- # Run permission setup with superuser
37- echo "Applying superuser permissions for upgrade from version {{ .Values.previousVersion }}..."
33+ # Run initial setup with superuser
34+ # - https://stac-utils.github.io/pgstac/pypgstac/#option-2-create-user-with-initial-grants
3835 PGUSER=postgres psql -f /opt/sql/initdb.sql
3936
40- echo "Permissions upgrade complete"
4137 resources :
4238 {{- toYaml .Values.pgstacBootstrap.settings.resources | nindent 12 }}
4339 volumeMounts :
4945 secretKeyRef :
5046 name : {{ $.Values.postgrescluster.name | default $.Release.Name }}-pguser-postgres
5147 key : user
48+ - name : EOAPI_USER
49+ valueFrom :
50+ secretKeyRef :
51+ name : {{ $.Values.postgrescluster.name | default $.Release.Name }}-pguser-eoapi
52+ key : user
5253 - name : PGPORT
5354 valueFrom :
5455 secretKeyRef :
0 commit comments