File tree Expand file tree Collapse file tree 3 files changed +13
-38
lines changed
templates/pgstacbootstrap Expand file tree Collapse file tree 3 files changed +13
-38
lines changed Original file line number Diff line number Diff line change 4444 {{- end }}
4545{{- end }}
4646{{- end }}
47- ---
48- {{- if .Values.postgrescluster.enabled }}
49- apiVersion : v1
50- kind : ConfigMap
51- metadata :
52- name : initdb
53- data :
54- initdb.sql : |
55- \c {{ .Values.pgstacBootstrap.settings.database }}
56- CREATE EXTENSION IF NOT EXISTS postgis;
57- CREATE EXTENSION IF NOT EXISTS btree_gist;
58- CREATE EXTENSION IF NOT EXISTS unaccent;
59- CREATE ROLE pgstac_admin;
60- CREATE ROLE pgstac_read;
61- CREATE ROLE pgstac_ingest;
62- ALTER DATABASE {{ .Values.pgstacBootstrap.settings.database }} OWNER TO {{ .Values.pgstacBootstrap.settings.user }};
63- ALTER USER {{ .Values.pgstacBootstrap.settings.user }} SET search_path TO pgstac, public;
64- ALTER ROLE {{ .Values.pgstacBootstrap.settings.user }} WITH CREATEROLE;
65- ALTER DATABASE {{ .Values.pgstacBootstrap.settings.database }} set search_path to pgstac, public;
66- GRANT CONNECT ON DATABASE {{ .Values.pgstacBootstrap.settings.database }} TO {{ .Values.pgstacBootstrap.settings.user }};
67- GRANT ALL PRIVILEGES ON TABLES TO {{ .Values.pgstacBootstrap.settings.user }};
68- GRANT ALL PRIVILEGES ON SEQUENCES TO {{ .Values.pgstacBootstrap.settings.user }};
69- GRANT pgstac_read TO {{ .Values.pgstacBootstrap.settings.user }} WITH ADMIN OPTION;
70- GRANT pgstac_ingest TO {{ .Values.pgstacBootstrap.settings.user }} WITH ADMIN OPTION;
71- GRANT pgstac_admin TO {{ .Values.pgstacBootstrap.settings.user }} WITH ADMIN OPTION;
72- {{- end }}
Original file line number Diff line number Diff line change 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 permissions
4+ # 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 :
3431 set -e
3532
3633 # Run permission setup with superuser
37- echo "Applying superuser permissions for upgrade from version {{ .Values.previousVersion }}..."
38- PGUSER=postgres psql -f /opt/sql/initdb.sql
39-
34+ echo "Applying elevated permissions"
35+ PGUSER=postgres psql -c "GRANT ALL PRIVILEGES ON DATABASE \"$PGDATABASE\" TO \"$EOAPI_USER\";"
4036 echo "Permissions upgrade complete"
4137 resources :
4238 {{- toYaml .Values.pgstacBootstrap.settings.resources | nindent 12 }}
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 :
Original file line number Diff line number Diff line change @@ -69,19 +69,19 @@ comment_db: >
6969postgresql :
7070 # Management type: "postgrescluster" (default), "external-plaintext", or "external-secret"
7171 type : " postgrescluster"
72-
72+
7373 # Configuration for external PostgreSQL (used when type is "external-plaintext" or "external-secret")
7474 external :
7575 # Connection information
7676 host : " "
7777 port : " 5432"
7878 database : " eoapi"
79-
79+
8080 # Credentials configuration (used when type is "external-plaintext")
8181 credentials :
8282 username : " "
8383 password : " "
84-
84+
8585 # Secret reference (used when type is "external-secret")
8686 existingSecret :
8787 name : " "
You can’t perform that action at this time.
0 commit comments