Skip to content

Commit 9e6a085

Browse files
committed
chore(postgresql-cluster): bind info
1 parent 2e6b61a commit 9e6a085

10 files changed

Lines changed: 121 additions & 65 deletions

File tree

Lines changed: 87 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,46 @@
1-
## CREATE PG INSTANCE
21

2+
# Postgresql cluster addons
3+
## Plans
4+
5+
View and choose the service resource specifications you need.
6+
```
7+
# drycc resources:plans postgresql-cluster
8+
```
9+
### Resource specification list
10+
| Resource Specification | Cores | MEMORY | Storage SIZE |
11+
| :---: | :---: | :---: | :---: |
12+
| standard-10 | 1C | 2G | 10G |
13+
| standard-20 | 2C | 4G | 20G |
14+
| standard-50 | 2C | 8G | 50G |
15+
| standard-100 | 4C | 16G | 100G |
16+
| standard-200 | 8C | 32G | 200G |
17+
| standard-400 | 16C | 64G | 400G |
18+
| standard-800 | 32C | 128G | 800G |
19+
20+
In order to obtain a better experience, it is recommended not to exceed 80% usage of resource utilization for a long period of time. If there is a need for larger resource scale, please apply for private customization.
21+
22+
## Create Postgresql Cluster Service instance
23+
24+
- Create Postgresql service
25+
```
26+
# drycc resources:create postgresql-cluster:standard-10 `my_pg_001`
27+
```
28+
- View service status
29+
```
30+
# drycc resources:descript `my_pg_001`
31+
```
32+
- Bind service
33+
```
34+
# drycc resources:bind `my_pg_001`
35+
```
36+
- View resource status
37+
```
38+
# drycc resources:descript `my_pg_001`
39+
```
40+
41+
## Create Service with parameters
42+
43+
`vim value.yaml`
344
```
445
# create or update pg instance template yaml
546
networkPolicy.allowNamespaces:
@@ -14,14 +55,21 @@ backup:
1455
Amount of base backups to retain
1556
retainBackups: 2
1657
s3:
17-
awsAccessKeyID: DO9l771LqiwZkhhz
18-
awsSecretAccessKey: R3Dv0NEmJBo8JFdn1q8jz49ArWwpDjFn
19-
walGS3Prefix: mx-test
58+
awsAccessKeyID: ""
59+
awsSecretAccessKey: ""
60+
walGS3Prefix: "s3://xx"
61+
awsEndpoint: "http://xxxx:9000"
62+
awsS3ForcePathStyle: "true"
63+
awsRegion: dx-1
64+
```
65+
```
66+
drycc resources:create postgresql-cluster:standard-10 `my_pg_001` -f ./value.yaml
2067
```
2168

22-
## Create app user and database
69+
## Update Service
70+
### Create app user and database
2371

24-
- Login PG with admin user & password
72+
- Login database web with admin user & password
2573

2674
- CREATE APP USER
2775
```
@@ -36,28 +84,44 @@ CREATE DATABASE `my_db` OWNER `my_user`;
3684
CREATE EXTENSION pg_buffercache;
3785
```
3886

39-
## Network Access
87+
### Network Access
4088

4189
Default access allow policy: only namespace scope.
4290

4391
- allow `mx-test1` namespace access
92+
93+
`vim value.yaml `
4494
```
4595
networkPolicy.allowNamespaces:
4696
- mx-test1
4797
```
98+
```
99+
drycc resources:update postgresql-cluster:standard-10 `my_pg_001` -f ./value.yaml
100+
```
101+
102+
- Assign external network IP address
48103

49-
- Assign external network IP address
104+
`vim value.yaml`
105+
```
106+
service.type: LoadBlancer
50107
```
51-
service.type: LoadBlance
52108
```
109+
drycc resources:update postgresql-cluster:standard-10 `my_pg_001` -f ./value.yaml
110+
```
111+
- View resource status
112+
```
113+
# drycc resources:describe `my_pg_001`
114+
```
53115

54-
## Manger backup your data `Very important`
116+
### Manger backup your data `Very important`
55117

56118
`Strongly recommend enabling this feature.`
57119
`Strongly recommend enabling this feature.`
58120
`Strongly recommend enabling this feature.`
59121

60122
PG data backup use S3 as backenp store. Choose an independent storage space `outside of the current environment` as your backup space.
123+
124+
`vim value.yaml`
61125
```
62126
backup:
63127
# whether BackUP should be enabled
@@ -71,20 +135,20 @@ backup:
71135
awsSecretAccessKey: R3Dv0NEmJBo8JFdn1q8jz49ArWwpDjFn
72136
walGS3Prefix: mx-test
73137
```
138+
```
139+
drycc resources:update postgresql-cluster:standard-10 `my_pg_001` -f ./value.yaml
140+
```
74141

75-
You can modify multiple content at once, there is no need to modify part of it each time.
142+
You can modify multiple content at once, there is no need to modify part of it each time.
76143

77-
## Plans
78144

79-
| Resource Specification | Cores | MEMORY | Storage SIZE |
80-
| :---: | :---: | :---: | :---: |
81-
| standard-10 | 1C | 2G | 10G |
82-
| standard-20 | 2C | 4G | 20G |
83-
| standard-50 | 2C | 8G | 50G |
84-
| standard-100 | 4C | 16G | 100G |
85-
| standard-200 | 8C | 32G | 200G |
86-
| standard-400 | 16C | 64G | 400G |
87-
| standard-800 | 32C | 128G | 800G |
88-
89-
In order to obtain a better experience, it is recommended not to exceed 80% usage of resource utilization for a long period of time. If there is a need for larger resource scale, please apply for private customization.
145+
## Destroy Service
90146

147+
- Unbind service first
148+
```
149+
# drycc resources:unbind `my_pg_001`
150+
```
151+
- Destroy service
152+
```
153+
# drycc resources:destroy `my_pg_001`
154+
```

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ spec:
108108
name: postgresql-config
109109
# readOnly: true
110110
- mountPath: "/opt/drycc/postgresql/backup/"
111-
name: postgresql-backup
111+
name: backup-config
112112
# readOnly: true
113113
resources:
114114
{{ toYaml .Values.resources | indent 10 }}
@@ -127,7 +127,7 @@ spec:
127127
{{- end }}
128128
env:
129129
- name: DATA_SOURCE_NAME
130-
value: {{ printf "postgresql://tea_mon:password@127.0.0.1:5432/%s?sslmode=disable" $.Values.database.dbname }}
130+
value: {{ printf "postgresql://tea_mon:password@127.0.0.1:5432/postgres?sslmode=disable" }}
131131
ports:
132132
- name: http-metrics
133133
containerPort: {{ .Values.metrics.containerPort }}
@@ -221,7 +221,7 @@ spec:
221221
- name: postgresql-config
222222
configMap:
223223
name: {{ template "common.names.fullname" . }}-postgresql
224-
- name: archive-config
224+
- name: backup-config
225225
configMap:
226226
name: {{ template "common.names.fullname" . }}-backup
227227
{{- if not .Values.persistentVolume.enabled }}

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

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@ diagnosticMode:
33
enable: false
44

55
service:
6-
type: ClusterIP
6+
# ClusterIP LoadBalancer
7+
type: LoadBalancer
78

89
image:
910
# Image was built from registry.drycc.cc/drycc-addons/patroni:3.2
@@ -81,7 +82,7 @@ preInitScript: |
8182
track_commit_timestamp: "off"
8283
archive_mode: "on"
8384
archive_timeout: 300s
84-
archive_command: sh /opt/drycc/postgresql/walbackup.sh %p %p
85+
archive_command: sh /opt/drycc/postgresql/walbackup.sh %p
8586
# timescaledb.license: 'timescale'
8687
shared_preload_libraries: 'auto_explain,pg_stat_statements'
8788
log_destination: 'csvlog'
@@ -201,7 +202,7 @@ patroni:
201202
## Postgresql Prometheus exporter parameters
202203
##
203204
metrics:
204-
enabled: false
205+
enabled: true
205206
image:
206207
repository: registry.drycc.cc/drycc-addons/postgres-exporter
207208
tag: "0"
@@ -248,15 +249,15 @@ metrics:
248249
limits:
249250
cpu: 100m
250251
memory: 512Mi
251-
hugepages-2Mi: 20Mi
252+
# hugepages-2Mi: 20Mi
252253
requests:
253254
cpu: 100m
254255
memory: 512Mi
255256
backup:
256257
# Specifies whether Wal-G should be enabled
257-
enabled: false
258+
enabled: true
258259
# Cron schedule for doing base backups
259-
scheduleCronJob: "20 0 * * 0"
260+
scheduleCronJob: "22 0 * * 0"
260261
# Amount of base backups to retain
261262
retainBackups: 2
262263
# Name of the secret that holds the credentials to the bucket
@@ -351,5 +352,4 @@ networkPolicy:
351352
## (with the correct destination port).
352353
##
353354
allowCurrentNamespace: true
354-
allowNamespaces:
355-
- mx-test1
355+
allowNamespaces:

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

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
credential:
22
{{- if (eq .Values.service.type "LoadBalancer") }}
3-
- name: MASTER_HOST
3+
- name: EXTRANET_MASTER_HOST
44
valueFrom:
55
serviceRef:
66
name: {{ include "common.names.fullname" . }}-master
77
jsonpath: '{ .status.loadBalancer.ingress[*].ip }'
8-
- name: REPL_HOST
8+
- name: EXTRANET_REPL_HOST
99
valueFrom:
1010
serviceRef:
1111
name: {{ template "common.names.fullname" . }}-repl
1212
jsonpath: '{ .status.loadBalancer.ingress[*].ip }'
13-
{{- else if (eq .Values.service.type "ClusterIP") }}
13+
{{- end }}
1414
- name: MASTER_HOST
1515
valueFrom:
1616
serviceRef:
@@ -21,7 +21,6 @@ credential:
2121
serviceRef:
2222
name: {{ include "common.names.fullname" . }}-repl
2323
jsonpath: '{ .spec.clusterIP }'
24-
{{- end }}
2524
- name: DADABASE
2625
valueFrom:
2726
secretKeyRef:
@@ -38,5 +37,4 @@ credential:
3837
name: {{ template "common.names.fullname" . }}
3938
jsonpath: '{ .data.data-user }'
4039
- name: PORT
41-
value: 5432
42-
40+
value: 5432

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

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
credential:
22
{{- if (eq .Values.service.type "LoadBalancer") }}
3-
- name: MASTER_HOST
3+
- name: EXTRANET_MASTER_HOST
44
valueFrom:
55
serviceRef:
66
name: {{ include "common.names.fullname" . }}-master
77
jsonpath: '{ .status.loadBalancer.ingress[*].ip }'
8-
- name: REPL_HOST
8+
- name: EXTRANET_REPL_HOST
99
valueFrom:
1010
serviceRef:
1111
name: {{ template "common.names.fullname" . }}-repl
1212
jsonpath: '{ .status.loadBalancer.ingress[*].ip }'
13-
{{- else if (eq .Values.service.type "ClusterIP") }}
13+
{{- end }}
1414
- name: MASTER_HOST
1515
valueFrom:
1616
serviceRef:
@@ -21,7 +21,6 @@ credential:
2121
serviceRef:
2222
name: {{ include "common.names.fullname" . }}-repl
2323
jsonpath: '{ .spec.clusterIP }'
24-
{{- end }}
2524
- name: DADABASE
2625
valueFrom:
2726
secretKeyRef:

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

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
credential:
22
{{- if (eq .Values.service.type "LoadBalancer") }}
3-
- name: MASTER_HOST
3+
- name: EXTRANET_MASTER_HOST
44
valueFrom:
55
serviceRef:
66
name: {{ include "common.names.fullname" . }}-master
77
jsonpath: '{ .status.loadBalancer.ingress[*].ip }'
8-
- name: REPL_HOST
8+
- name: EXTRANET_REPL_HOST
99
valueFrom:
1010
serviceRef:
1111
name: {{ template "common.names.fullname" . }}-repl
1212
jsonpath: '{ .status.loadBalancer.ingress[*].ip }'
13-
{{- else if (eq .Values.service.type "ClusterIP") }}
13+
{{- end }}
1414
- name: MASTER_HOST
1515
valueFrom:
1616
serviceRef:
@@ -21,7 +21,6 @@ credential:
2121
serviceRef:
2222
name: {{ include "common.names.fullname" . }}-repl
2323
jsonpath: '{ .spec.clusterIP }'
24-
{{- end }}
2524
- name: DADABASE
2625
valueFrom:
2726
secretKeyRef:

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

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
credential:
22
{{- if (eq .Values.service.type "LoadBalancer") }}
3-
- name: MASTER_HOST
3+
- name: EXTRANET_MASTER_HOST
44
valueFrom:
55
serviceRef:
66
name: {{ include "common.names.fullname" . }}-master
77
jsonpath: '{ .status.loadBalancer.ingress[*].ip }'
8-
- name: REPL_HOST
8+
- name: EXTRANET_REPL_HOST
99
valueFrom:
1010
serviceRef:
1111
name: {{ template "common.names.fullname" . }}-repl
1212
jsonpath: '{ .status.loadBalancer.ingress[*].ip }'
13-
{{- else if (eq .Values.service.type "ClusterIP") }}
13+
{{- end }}
1414
- name: MASTER_HOST
1515
valueFrom:
1616
serviceRef:
@@ -21,7 +21,6 @@ credential:
2121
serviceRef:
2222
name: {{ include "common.names.fullname" . }}-repl
2323
jsonpath: '{ .spec.clusterIP }'
24-
{{- end }}
2524
- name: DADABASE
2625
valueFrom:
2726
secretKeyRef:

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

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
credential:
22
{{- if (eq .Values.service.type "LoadBalancer") }}
3-
- name: MASTER_HOST
3+
- name: EXTRANET_MASTER_HOST
44
valueFrom:
55
serviceRef:
66
name: {{ include "common.names.fullname" . }}-master
77
jsonpath: '{ .status.loadBalancer.ingress[*].ip }'
8-
- name: REPL_HOST
8+
- name: EXTRANET_REPL_HOST
99
valueFrom:
1010
serviceRef:
1111
name: {{ template "common.names.fullname" . }}-repl
1212
jsonpath: '{ .status.loadBalancer.ingress[*].ip }'
13-
{{- else if (eq .Values.service.type "ClusterIP") }}
13+
{{- end }}
1414
- name: MASTER_HOST
1515
valueFrom:
1616
serviceRef:
@@ -21,8 +21,7 @@ credential:
2121
serviceRef:
2222
name: {{ include "common.names.fullname" . }}-repl
2323
jsonpath: '{ .spec.clusterIP }'
24-
{{- end }}
25-
- name: DATABASE
24+
- name: DADABASE
2625
valueFrom:
2726
secretKeyRef:
2827
name: {{ template "common.names.fullname" . }}

0 commit comments

Comments
 (0)