forked from adfinis/openshift-mariadb-galera
-
Notifications
You must be signed in to change notification settings - Fork 0
/
mariadb-galera-ephemeral-template.yml
101 lines (99 loc) · 2.8 KB
/
mariadb-galera-ephemeral-template.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
---
kind: Template
apiVersion: v1
metadata:
name: mariadb-galera-ephemeral
annotations:
description: MariaDB Galera cluster ephemeral
iconClass: icon-mariadb
tags: database,mysql,replication,mariadb,galera
parameters:
- name: MYSQL_SERVICE_NAME
description: Service name for the MariaDB service
value: galera
- name: GALERA_PETSET_NAME
description: PetSet name
value: mysql
- name: NUMBER_OF_GALERA_MEMBERS
description: Number of Galera Nodes
value: "3"
required: true
- name: MYSQL_USER
description: The username that clients will use to connect to the server
value: user
- name: MYSQL_PASSWORD
description: The password for the MYSQL_USER
generate: expression
from: "[a-zA-Z0-9]{12}"
- name: MYSQL_DATABASE
description: The name of the database that will be created and replicated
value: userdb
- name: MYSQL_ROOT_PASSWORD
description: The password for the root user
generate: expression
from: "[a-zA-Z0-9]{12}"
objects:
- apiVersion: v1
kind: Service
metadata:
annotations:
service.alpha.kubernetes.io/tolerate-unready-endpoints: "true"
name: "${MYSQL_SERVICE_NAME}"
labels:
app: "${GALERA_PETSET_NAME}"
spec:
ports:
- port: 3306
name: "${GALERA_PETSET_NAME}"
clusterIP: None
selector:
app: "${GALERA_PETSET_NAME}"
- apiVersion: apps/v1beta1
kind: StatefulSet
metadata:
name: "${GALERA_PETSET_NAME}"
spec:
serviceName: "${MYSQL_SERVICE_NAME}"
replicas: "${NUMBER_OF_GALERA_MEMBERS}"
template:
metadata:
labels:
app: "${GALERA_PETSET_NAME}"
annotations:
pod.alpha.kubernetes.io/initialized: "true"
spec:
containers:
- name: "${GALERA_PETSET_NAME}"
image: adfinissygroup/k8s-mariadb-galera-centos:v004
imagePullPolicy: IfNotPresent
ports:
- containerPort: 3306
name: mysql
- containerPort: 4444
name: sst
- containerPort: 4567
name: replication
- containerPort: 4568
name: ist
readinessProbe:
exec:
command:
- /usr/share/container-scripts/mysql/readiness-probe.sh
initialDelaySeconds: 15
timeoutSeconds: 5
env:
- name: POD_NAMESPACE
valueFrom:
fieldRef:
apiVersion: v1
fieldPath: metadata.namespace
- name: MYSQL_USER
value: "${MYSQL_USER}"
- name: MYSQL_PASSWORD
value: "${MYSQL_PASSWORD}"
- name: MYSQL_DATABASE
value: "${MYSQL_DATABASE}"
- name: MYSQL_ROOT_PASSWORD
value: "${MYSQL_ROOT_PASSWORD}"
- name: GALERA_PETSET_NAME
value: "${GALERA_PETSET_NAME}"