forked from paunin/PostDock
-
Notifications
You must be signed in to change notification settings - Fork 0
/
node.yml
101 lines (96 loc) · 3.1 KB
/
node.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
apiVersion: apps/v1beta1
kind: StatefulSet
metadata:
namespace: mysystem
name: mysystem-db-node
labels:
name: database
system: mysystem
app: mysystem
spec:
replicas: 3
serviceName: "mysystem-db"
template:
metadata:
labels:
name: database
system: mysystem
spec:
containers:
- name: db-node
image: postdock/postgres:latest-postgres11-repmgr40
livenessProbe:
exec:
command: ['bash', '-c', '/usr/local/bin/cluster/healthcheck/is_major_master.sh']
initialDelaySeconds: 600
timeoutSeconds: 10
periodSeconds: 30
successThreshold: 1
failureThreshold: 3
imagePullPolicy: Always
resources:
requests:
memory: "10Mi"
cpu: "10m"
env:
- name: MY_POD_NAME
valueFrom:
fieldRef:
fieldPath: metadata.name
- name: "REPMGR_WAIT_POSTGRES_START_TIMEOUT"
value: "600"
- name: "REPLICATION_PRIMARY_HOST"
value: "mysystem-db-node-0.mysystem-db"
- name: "PARTNER_NODES"
value: "mysystem-db-node-0.mysystem-db,mysystem-db-node-1.mysystem-db,mysystem-db-node-2.mysystem-db"
- name: "NODE_NAME"
value: "$(MY_POD_NAME)"
- name: "CLUSTER_NODE_NETWORK_NAME"
value: "$(MY_POD_NAME).mysystem-db"
- name: "CONFIGS"
value: "wal_keep_segments:250,shared_buffers:300MB,archive_command:'/bin/true'"
# Work DB
- name: "POSTGRES_DB"
valueFrom:
configMapKeyRef:
name: mysystem-config
key: app.db.database
- name: "POSTGRES_USER"
valueFrom:
secretKeyRef:
name: mysystem-secret
key: app.db.user
- name: "POSTGRES_PASSWORD"
valueFrom:
secretKeyRef:
name: mysystem-secret
key: app.db.password
# Cluster configs
- name: "CLUSTER_NAME"
valueFrom:
configMapKeyRef:
name: mysystem-config
key: app.db.cluster.name
- name: "REPLICATION_DB"
valueFrom:
configMapKeyRef:
name: mysystem-config
key: app.db.cluster.replication.db
- name: "REPLICATION_USER"
valueFrom:
secretKeyRef:
name: mysystem-secret
key: app.db.cluster.replication.user
- name: "REPLICATION_PASSWORD"
valueFrom:
secretKeyRef:
name: mysystem-secret
key: app.db.cluster.replication.password
ports:
- containerPort: 5432
volumeMounts:
- name: db-data
mountPath: /var/lib/postgresql/data
volumeClaimTemplates:
- metadata:
name: db-data