Skip to content

Commit b7494c2

Browse files
committed
chore(postgresql-cluster): adjust
1 parent 78e1350 commit b7494c2

14 files changed

Lines changed: 55 additions & 75 deletions

File tree

addons/postgresql-cluster/15/chart/postgresql-cluster/README.md

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff 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
```

addons/postgresql-cluster/15/chart/postgresql-cluster/templates/cm-backup.yaml

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
{{- if (include "backup.createConfigmap" .) }}
21
apiVersion: v1
32
kind: ConfigMap
43
metadata:
@@ -14,9 +13,4 @@ metadata:
1413
{{- end }}
1514
data:
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 }}

addons/postgresql-cluster/15/chart/postgresql-cluster/templates/sec.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,5 +14,5 @@ data:
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 }}

addons/postgresql-cluster/15/chart/postgresql-cluster/templates/statefulset.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff 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 }}

addons/postgresql-cluster/15/chart/postgresql-cluster/values.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff 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

addons/postgresql-cluster/15/meta.yaml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,12 @@ tags: postgresql-cluster
1313
bindable: true
1414
instances_retrievable: true
1515
bindings_retrievable: true
16-
plan_updateable: false
16+
plan_updateable: true
1717
allow_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 "
2624
archive: false

addons/postgresql-cluster/15/plans/standard-10/bind.yaml

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff 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

addons/postgresql-cluster/15/plans/standard-100/bind.yaml

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff 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

addons/postgresql-cluster/15/plans/standard-20/bind.yaml

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff 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

addons/postgresql-cluster/15/plans/standard-200/bind.yaml

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff 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

0 commit comments

Comments
 (0)