Last active
May 24, 2017 14:58
-
-
Save caruccio/0b42c110e4f4e29b866b39e3d4264a1a to your computer and use it in GitHub Desktop.
MariaDB Galera Cluster Openshift Template
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Source: https://github.com/getupcloud/openshift-mariadb-galera/blob/master/mariadb-galera-persistent-template.yml | |
--- | |
kind: Template | |
apiVersion: v1 | |
metadata: | |
name: mariadb-galera-persistent | |
annotations: | |
description: MariaDB Galera cluster persistent (NFS) | |
iconClass: icon-mariadb | |
tags: database,mysql,replication,mariadb,galera,nfs | |
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: VOLUME_PV_NAME | |
description: Volume PV basename. If the name is "datadir", it you need to create datadir-GALERA_PETSET_NAME-number | |
value: datadir | |
required: true | |
- name: VOLUME_CAPACITY | |
description: Volume space available for data, e.g. 512Mi, 2Gi. | |
required: true | |
value: 5Gi | |
- name: MYSQL_USER | |
description: The username that clients will use to connect to the server | |
generate: expression | |
from: "[a-zA-Z]{8}" | |
- 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: defaultdb | |
- 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/v1alpha1 | |
kind: PetSet | |
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:v002 | |
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 | |
volumeMounts: | |
- name: "${VOLUME_PV_NAME}" | |
mountPath: /var/lib/mysql | |
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}" | |
volumeClaimTemplates: | |
- metadata: | |
name: "${VOLUME_PV_NAME}" | |
spec: | |
accessModes: [ "ReadWriteOnce" ] | |
resources: | |
requests: | |
storage: "${VOLUME_CAPACITY}" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment