File tree Expand file tree Collapse file tree
addons/postgresql-cluster/15 Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -71,13 +71,22 @@ backup:
7171
7272- Login database web with admin user & password
7373
74+ - Change administrator initial password
75+ ```
76+ ALTER USER administrator WITH ENCRYPTED PASSWORD 'newpassword';
77+ ```
78+ - View total connections number in postgresql cluster;
79+ ```
80+ show max_connections ;
81+ ```
7482- CREATE APP USER
7583```
76- CREATE USER `my_user` WITH CONNECTION LIMIT `conn_limit` LOGIN ENCRYPTED PASSWORD 'password';
84+ CREATE USER `myuser` WITH CONNECTION LIMIT `conn limit` LOGIN ENCRYPTED PASSWORD 'password';
85+ GRANT `myuser` to administrator ;
7786```
7887- CREATE APP DATABASE
7988```
80- CREATE DATABASE `my_db ` OWNER `my_user `;
89+ CREATE DATABASE `mydb ` OWNER `myuser `;
8190```
8291- CREATE EXTENSIONS
8392```
Original file line number Diff line number Diff line change 1- {{- if (include "backup.createConfigmap" .) }}
21apiVersion : v1
32kind : ConfigMap
43metadata :
@@ -14,9 +13,4 @@ metadata:
1413 {{- end }}
1514data :
1615 backup.env : |-
17- {{- include "common.tplvalues.render" ( dict "value" .Values.backupEnv "context" $ ) | nindent 4 }}
18- # archive_command.sh: | -
19- # #/bin/bash
20- # source backup.env
21- # [ $USE_WALG ] ? sh /opt/drycc/postgresql/walbackup.sh %p : /bin/true
22- {{- end -}}
16+ {{- include "common.tplvalues.render" ( dict "value" .Values.backupEnv "context" $ ) | nindent 4 }}
Original file line number Diff line number Diff line change 1414 password-superuser : {{ include "credentials.superuserValue" . | b64enc | quote }}
1515 password-rewind : {{ include "credentials.rewindValue" . | b64enc | quote }}
1616 password-replication : {{ include "credentials.replicationValue" . | b64enc | quote }}
17- admin-user : {{ .Values.adminRole.username | b64enc }}
18- admin-password : {{ .Values. adminRole.password | b64enc }}
17+ admin-user : {{ .Values.adminRole.username | b64enc | quote }}
18+ admin-password : {{ include " adminRole.passwordValue" . | b64enc | quote }}
Original file line number Diff line number Diff line change @@ -161,7 +161,7 @@ spec:
161161 resources : {{- toYaml .Values.metrics.resources | nindent 12 }}
162162 {{- end }}
163163 {{- end }}
164- {{- if .Values.backup.enabled }}
164+
165165 - name : {{ .Chart.Name }}-backup
166166 image : " {{ .Values.image.repository }}:{{ .Values.image.tag }}"
167167 imagePullPolicy : {{ .Values.image.pullPolicy }}
@@ -195,7 +195,7 @@ spec:
195195 volumeMounts :
196196 - name : storage-volume
197197 mountPath : " {{ .Values.persistentVolume.mountPath }}"
198- {{- end }}
198+
199199 {{- with .Values.nodeSelector }}
200200 nodeSelector :
201201{{ toYaml . | indent 8 }}
Original file line number Diff line number Diff line change @@ -124,8 +124,8 @@ postInitScript: |
124124 psql -w -c "CREATE USER tea_mon WITH ROLE pg_monitor;create extension pg_stat_statements;create extension pg_buffercache ;"
125125 # Create admin user
126126 if [[( -n "$ADMIN_USER") && ( -n "$ADMIN_PASSWORD")]]; then
127- echo "Creating user ${ADMIN_USER}"
128- # psql -w -c "CREATE USER ${ADMIN_USER} WITH NOSUPERUSER CREATEDB CREATEROLE REPLICATION CONNECTION LIMIT 10 LOGIN ENCRYPTED PASSWORD '${ADMIN_PASSWORD}'"
127+ echo "Creating user ${ADMIN_USER}"
128+ psql -w -c "CREATE USER ${ADMIN_USER} WITH SUPERUSER CREATEDB CREATEROLE CONNECTION LIMIT 10 LOGIN ENCRYPTED PASSWORD '${ADMIN_PASSWORD}'"
129129 else
130130 echo "Skipping create admin user"
131131 fi
Original file line number Diff line number Diff line change @@ -13,14 +13,12 @@ tags: postgresql-cluster
1313bindable : true
1414instances_retrievable : true
1515bindings_retrievable : true
16- plan_updateable : false
16+ plan_updateable : true
1717allow_parameters :
1818- name : " networkPolicy.allowNamespaces"
1919 description : " networkPolicy allowNamespaces config for values.yaml"
2020- name : " service.type"
2121 description : " service type config for values.yaml"
22- - name : " metrics.enabled"
23- description : " Whether to enable metrics. default true"
2422- name : " backup"
2523 description : " Whether to use S3 for backup your data. default false . ps: Make sure there is a available S3 "
2624archive : false
Original file line number Diff line number Diff line change @@ -21,20 +21,17 @@ credential:
2121 serviceRef :
2222 name : {{ include "common.names.fullname" . }}-repl
2323 jsonpath : ' { .spec.clusterIP }'
24- - name : DADABASE
25- valueFrom :
26- secretKeyRef :
27- name : {{ template "common.names.fullname" . }}
28- jsonpath : ' { .data.data-name }'
2924 - name : PASSWORD
3025 valueFrom :
3126 secretKeyRef :
3227 name : {{ template "common.names.fullname" . }}
33- jsonpath : ' { .data.data -password }'
28+ jsonpath : ' { .data.admin -password }'
3429 - name : USERNAME
3530 valueFrom :
3631 secretKeyRef :
3732 name : {{ template "common.names.fullname" . }}
38- jsonpath : ' { .data.data -user }'
33+ jsonpath : ' { .data.admin -user }'
3934 - name : PORT
40- value : 5432
35+ value : 5432
36+ - name : DADABASE
37+ value : postgres
Original file line number Diff line number Diff line change @@ -21,20 +21,17 @@ credential:
2121 serviceRef :
2222 name : {{ include "common.names.fullname" . }}-repl
2323 jsonpath : ' { .spec.clusterIP }'
24- - name : DADABASE
25- valueFrom :
26- secretKeyRef :
27- name : {{ template "common.names.fullname" . }}
28- jsonpath : ' { .data.data-name }'
2924 - name : PASSWORD
3025 valueFrom :
3126 secretKeyRef :
3227 name : {{ template "common.names.fullname" . }}
33- jsonpath : ' { .data.data -password }'
28+ jsonpath : ' { .data.admin -password }'
3429 - name : USERNAME
3530 valueFrom :
3631 secretKeyRef :
3732 name : {{ template "common.names.fullname" . }}
38- jsonpath : ' { .data.data -user }'
33+ jsonpath : ' { .data.admin -user }'
3934 - name : PORT
40- value : 5432
35+ value : 5432
36+ - name : DADABASE
37+ value : postgres
Original file line number Diff line number Diff line change @@ -21,20 +21,17 @@ credential:
2121 serviceRef :
2222 name : {{ include "common.names.fullname" . }}-repl
2323 jsonpath : ' { .spec.clusterIP }'
24- - name : DADABASE
25- valueFrom :
26- secretKeyRef :
27- name : {{ template "common.names.fullname" . }}
28- jsonpath : ' { .data.data-name }'
2924 - name : PASSWORD
3025 valueFrom :
3126 secretKeyRef :
3227 name : {{ template "common.names.fullname" . }}
33- jsonpath : ' { .data.data -password }'
28+ jsonpath : ' { .data.admin -password }'
3429 - name : USERNAME
3530 valueFrom :
3631 secretKeyRef :
3732 name : {{ template "common.names.fullname" . }}
38- jsonpath : ' { .data.data -user }'
33+ jsonpath : ' { .data.admin -user }'
3934 - name : PORT
40- value : 5432
35+ value : 5432
36+ - name : DADABASE
37+ value : postgres
Original file line number Diff line number Diff line change @@ -21,20 +21,17 @@ credential:
2121 serviceRef :
2222 name : {{ include "common.names.fullname" . }}-repl
2323 jsonpath : ' { .spec.clusterIP }'
24- - name : DADABASE
25- valueFrom :
26- secretKeyRef :
27- name : {{ template "common.names.fullname" . }}
28- jsonpath : ' { .data.data-name }'
2924 - name : PASSWORD
3025 valueFrom :
3126 secretKeyRef :
3227 name : {{ template "common.names.fullname" . }}
33- jsonpath : ' { .data.data -password }'
28+ jsonpath : ' { .data.admin -password }'
3429 - name : USERNAME
3530 valueFrom :
3631 secretKeyRef :
3732 name : {{ template "common.names.fullname" . }}
38- jsonpath : ' { .data.data -user }'
33+ jsonpath : ' { .data.admin -user }'
3934 - name : PORT
40- value : 5432
35+ value : 5432
36+ - name : DADABASE
37+ value : postgres
You can’t perform that action at this time.
0 commit comments