apiVersion: apps/v1
kind: Deployment
metadata:
  name: node
  namespace: galera
  labels:
    app: node
spec:
  replicas: 3
  strategy:
    type: Recreate
  selector:
    matchLabels:
      app: node
  template:
    metadata:
      labels:
        app: node
        galeraRunning: ohyeah
    spec:
      affinity:
        podAntiAffinity:
          requiredDuringSchedulingIgnoredDuringExecution:
          - labelSelector:
              matchExpressions:
              - key: galeraRunning
                operator: In
                values:
                - ohyeah
            topologyKey: "kubernetes.io/hostname"
      containers:
      - args:
        - node
        - seed,node
        env:
        - name: HEALTHY_WHILE_BOOTING
          value: "1"
        - name: NODE_ADDRESS
          value: ^10.*.*.*
        - name: XTRABACKUP_PASSWORD_FILE
          value: /etc/secrets/xtrabackup_password
        image: colinmollenhour/mariadb-galera-swarm
        name: node
        resources: {}
        volumeMounts:
        - mountPath: /var/lib/mysql
          name: mysql-data
        - mountPath: /etc/secrets
          name: galera-secrets
      restartPolicy: Always
      volumes:
        - name: mysql-data
          hostPath:
            path: /var/lib/mysql
            type: Directory
        - name: galera-secrets
          secret:
            secretName: galera-secrets
