system-config/kubernetes/percona-xtradb-cluster/statefulset.yaml
Monty Taylor b867289ad2 Add resources for deploying rook and xtradb to kuberenets
The gitea service needs an HA shared filesystem, which is provided by
cephfs and managed by rook.io.

It also needs a database service, which is provided by
percona-xtradb-cluster.

Change-Id: Ie019c2e24c3780cec2468a00987dba4ac34ed570
2019-02-05 18:52:21 +00:00

132 lines
3.3 KiB
YAML

apiVersion: apps/v1beta2
kind: StatefulSet
metadata:
name: gitea-pxc
labels:
app: gitea-pxc
namespace: gitea-db
spec:
replicas: 3
selector:
matchLabels:
app: gitea-pxc
serviceName: gitea-pxc
template:
metadata:
labels:
app: gitea-pxc
spec:
initContainers:
- name: "remove-lost-found"
image: "busybox:1.25.0"
imagePullPolicy: IfNotPresent
command:
- "rm"
- "-fr"
- "/var/lib/mysql/lost+found"
volumeMounts:
- name: mysql-data
mountPath: /var/lib/mysql
containers:
- name: database
image: "percona/percona-xtradb-cluster:5.7.19"
imagePullPolicy: "IfNotPresent"
command:
- "/bin/bash"
- "/startup-scripts/entrypoint.sh"
resources:
null
env:
- name: MYSQL_ROOT_PASSWORD
valueFrom:
secretKeyRef:
name: gitea-pxc
key: mysql-root-password
- name: MYSQL_PASSWORD
valueFrom:
secretKeyRef:
name: gitea-pxc
key: mysql-password
- name: XTRABACKUP_PASSWORD
valueFrom:
secretKeyRef:
name: gitea-pxc
key: xtrabackup-password
- name: MYSQL_USER
value: "gitea"
- name: MYSQL_DATABASE
value: "gitea"
- name: ALLOW_ROOT_FROM
value: "127.0.0.1"
- name: CLUSTER_NAME
value: gitea-pxc
- name: SHORT_CLUSTER_NAME
value: gitea-pxc
- name: K8S_SERVICE_NAME
value: gitea-pxc-repl
- name: DEBUG
value: "true"
ports:
- name: mysql
containerPort: 3306
- name: galera-repl
containerPort: 4567
- name: state-transfer
containerPort: 4568
- name: state-snapshot
containerPort: 4444
livenessProbe:
exec:
command: ["mysqladmin","ping"]
initialDelaySeconds: 30
timeoutSeconds: 2
readinessProbe:
exec:
command: ["mysql", "-h", "127.0.0.1", "-e", "SELECT 1"]
initialDelaySeconds: 30
timeoutSeconds: 2
volumeMounts:
- name: mysql-data
mountPath: /var/lib/mysql
- name: mysql-startup-scripts
mountPath: /startup-scripts
- name: mysql-config-files
mountPath: /etc/mysql/conf.d
- name: slash-root
mountPath: /root
- name: var-log
mountPath: /var/log
- name: "logs"
image: "busybox:1.25.0"
imagePullPolicy: IfNotPresent
command:
- "tail"
- "-f"
- "/var/log/mysqld.log"
volumeMounts:
- name: var-log
mountPath: /var/log
volumes:
- name: slash-root
emptyDir: {}
- name: var-log
emptyDir: {}
- name: mysql-config-files
configMap:
name: gitea-pxc-config-files
- name: mysql-startup-scripts
configMap:
name: gitea-pxc-startup-scripts
volumeClaimTemplates:
- metadata:
name: mysql-data
namespace: gitea-db
spec:
accessModes: ["ReadWriteOnce"]
storageClassName: "cinder"
resources:
requests:
storage: "24Gi"