-
-
Notifications
You must be signed in to change notification settings - Fork 36
/
Copy path01-postgresql.yaml
73 lines (72 loc) · 1.48 KB
/
01-postgresql.yaml
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
apiVersion: v1
kind: Secret
metadata:
name: postgres-password
namespace: demo
type: Opaque
data:
PASSWORD: dGVzdA==
---
apiVersion: v1
kind: ConfigMap
metadata:
name: postgres-init
namespace: demo
data:
init-visibility-db.sh: |
#!/bin/bash
set -e
psql -v ON_ERROR_STOP=1 --username "$POSTGRES_USER" --dbname "$POSTGRES_DB" <<-EOSQL
CREATE DATABASE temporal_visibility;
GRANT ALL PRIVILEGES ON DATABASE temporal_visibility TO $POSTGRES_USER;
EOSQL
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: postgres
namespace: demo
spec:
replicas: 1
selector:
matchLabels:
service: postgres
template:
metadata:
labels:
service: postgres
spec:
containers:
- name: postgres
image: postgres
ports:
- containerPort: 5432
volumeMounts:
- name: postgres-init
mountPath: /docker-entrypoint-initdb.d
env:
- name: POSTGRES_DB
value: temporal
- name: POSTGRES_USER
value: temporal
- name: POSTGRES_PASSWORD
valueFrom:
secretKeyRef:
name: postgres-password
key: PASSWORD
volumes:
- name: postgres-init
configMap:
name: postgres-init
---
apiVersion: v1
kind: Service
metadata:
name: postgres
namespace: demo
spec:
type: ClusterIP
ports:
- port: 5432
selector:
service: postgres