-
Notifications
You must be signed in to change notification settings - Fork 21
/
mysql-db.yaml
146 lines (146 loc) · 4.28 KB
/
mysql-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
139
140
141
142
143
144
145
146
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: mysql://{.spec.clusterIP}:{.spec.ports[?(.name==\mysql\)].port}
name: model-registry-db
spec:
ports:
- name: mysql
nodePort: 0
port: 3306
protocol: TCP
appProtocol: tcp
targetPort: 3306
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: MYSQL_USER
valueFrom:
secretKeyRef:
key: database-user
name: model-registry-db
- name: MYSQL_PASSWORD
valueFrom:
secretKeyRef:
key: database-password
name: model-registry-db
- name: MYSQL_ROOT_PASSWORD
valueFrom:
secretKeyRef:
key: database-password
name: model-registry-db
- name: MYSQL_DATABASE
valueFrom:
secretKeyRef:
key: database-name
name: model-registry-db
args:
- --datadir
- /var/lib/mysql/datadir
- --default-authentication-plugin=mysql_native_password
image: mysql:8.3.0
imagePullPolicy: IfNotPresent
livenessProbe:
exec:
command:
- /bin/bash
- -c
- mysqladmin -u${MYSQL_USER} -p${MYSQL_ROOT_PASSWORD} ping
initialDelaySeconds: 15
periodSeconds: 10
timeoutSeconds: 5
name: mysql
ports:
- containerPort: 3306
protocol: TCP
readinessProbe:
exec:
command:
- /bin/bash
- -c
- mysql -D ${MYSQL_DATABASE} -u${MYSQL_USER} -p${MYSQL_ROOT_PASSWORD} -e 'SELECT 1'
initialDelaySeconds: 10
timeoutSeconds: 5
securityContext:
capabilities: {}
privileged: false
terminationMessagePath: /dev/termination-log
volumeMounts:
- mountPath: /var/lib/mysql
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: {}