-
Notifications
You must be signed in to change notification settings - Fork 19
/
postgres-db.yaml
138 lines (138 loc) · 4.03 KB
/
postgres-db.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
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
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
apiVersion: v1
items:
- apiVersion: v1
kind: Service
metadata:
labels:
app.kubernetes.io/name: model-registry-db
app.kubernetes.io/instance: model-registry-db
app.kubernetes.io/part-of: model-registry-db
app.kubernetes.io/managed-by: kustomize
annotations:
template.openshift.io/expose-uri: postgres://{.spec.clusterIP}:{.spec.ports[?(.name==\postgresql\)].port}
name: model-registry-db
spec:
ports:
- name: postgresql
nodePort: 0
port: 5432
protocol: TCP
appProtocol: tcp
targetPort: 5432
selector:
name: model-registry-db
sessionAffinity: None
type: ClusterIP
- apiVersion: v1
kind: PersistentVolumeClaim
metadata:
labels:
app.kubernetes.io/name: model-registry-db
app.kubernetes.io/instance: model-registry-db
app.kubernetes.io/part-of: model-registry-db
app.kubernetes.io/managed-by: kustomize
name: model-registry-db
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 5Gi
- apiVersion: apps/v1
kind: Deployment
metadata:
labels:
app.kubernetes.io/name: model-registry-db
app.kubernetes.io/instance: model-registry-db
app.kubernetes.io/part-of: model-registry-db
app.kubernetes.io/managed-by: kustomize
annotations:
template.alpha.openshift.io/wait-for-ready: "true"
name: model-registry-db
spec:
replicas: 1
revisionHistoryLimit: 0
selector:
matchLabels:
name: model-registry-db
strategy:
type: Recreate
template:
metadata:
labels:
name: model-registry-db
sidecar.istio.io/inject: "false"
spec:
containers:
- env:
- name: POSTGRES_USER
valueFrom:
secretKeyRef:
key: database-user
name: model-registry-db
- name: POSTGRES_PASSWORD
valueFrom:
secretKeyRef:
key: database-password
name: model-registry-db
- name: POSTGRES_DB
valueFrom:
secretKeyRef:
key: database-name
name: model-registry-db
- name: PGDATA
value: /var/lib/postgresql/data/pgdata
image: postgres:16
imagePullPolicy: IfNotPresent
livenessProbe:
exec:
command:
- bash
- "-c"
- "/usr/bin/pg_isready -U $POSTGRES_USER -d $POSTGRES_DB"
initialDelaySeconds: 30
timeoutSeconds: 2
name: postgresql
ports:
- containerPort: 5432
protocol: TCP
readinessProbe:
exec:
command:
- bash
- "-c"
- "psql -w -U $POSTGRES_USER -d $POSTGRES_DB -c 'SELECT 1'"
initialDelaySeconds: 10
timeoutSeconds: 5
securityContext:
capabilities: {}
privileged: false
terminationMessagePath: /dev/termination-log
volumeMounts:
- mountPath: /var/lib/postgresql/data
name: model-registry-db-data
dnsPolicy: ClusterFirst
restartPolicy: Always
volumes:
- name: model-registry-db-data
persistentVolumeClaim:
claimName: model-registry-db
- apiVersion: v1
kind: Secret
metadata:
labels:
app.kubernetes.io/name: model-registry-db
app.kubernetes.io/instance: model-registry-db
app.kubernetes.io/part-of: model-registry-db
app.kubernetes.io/managed-by: kustomize
annotations:
template.openshift.io/expose-database_name: '{.data[''database-name'']}'
template.openshift.io/expose-password: '{.data[''database-password'']}'
template.openshift.io/expose-username: '{.data[''database-user'']}'
name: model-registry-db
stringData:
database-name: "model-registry"
database-password: "TheBlurstOfTimes" # notsecret
database-user: "mlmduser" # notsecret
kind: List
metadata: {}