summaryrefslogtreecommitdiffstats
path: root/setup/projects/adei/vars/mysql_galera.yml
blob: a1b4e879bed7d43b05114397eb866e8af8cb5e69 (plain)
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
# We need to set cluster name in environment if we configure host networking...
galera:
  options:
    delete: false
  pods:
    galera:
      kind: StatefulSet
      sa: "adeidb"
      service: { headless: true, ports: [ 3306 ] }
      network: { host: "{{ ands_hostnet_db | default(false) }}" }
      sched: { replicas: 3, strategy: "Recreate", restrict: { fat_storage: "1" } }
#      update: { strategy: RollingUpdate, min_ready: 30 }
      affinity: 
        nodeAffinity:
          requiredDuringSchedulingIgnoredDuringExecution: 
            nodeSelectorTerms:
            - matchExpressions:
              - { key: "hostid", operator: "In", values: [ "1", "2", "3" ] }
        podAntiAffinity:
          requiredDuringSchedulingIgnoredDuringExecution:
            topologyKey: kubernetes.io/hostname
            labelSelector:
              matchExpressions: 
                - { key: name, operator: In, values: [ "galera" ] }
      groups: [ "adei_db" ]
      pvc: { 'adei_galera': {} }
      images:
        - image: "chsa/mysql-galera:5.7"
          command: [ "run-mysqld-galera" ]
          ports: [ 3306, 4444, 4567, 4568 ]
          env:
            - { name: "MYSQL_ROOT_PASSWORD", value: "secret@adei/root-password" } 
            - { name: "MYSQL_USER", value: "adei" }
            - { name: "MYSQL_USER_PRIV_SUPER", value: "1" }
            - { name: "MYSQL_PASSWORD", value: "secret@adei/adei-password" } 
            - { name: "MYSQL_DATABASE", value: "adei" }
            - { name: "MYSQL_EXTRADB", value: "adei_%" }
            - { name: "MYSQL_GALERA_USER", value: "xtrabackup_sst" }
            - { name: "MYSQL_GALERA_PASSWORD", value: "secret@adei/service-password" }
            - { name: "MYSQL_GALERA_CLUSTER", value: "galera-ss" }
          mappings: 
            - { name: "adei_galera", mount: "/var/lib/mysql/data" }
          resources: {  request: { cpu: 2000m, mem: 4Gi } }
          probes:
            - { type: "liveness", port: 3306 }
            - { type: "readiness", command: [ /bin/sh, -i, -c, MYSQL_PWD="$MYSQL_PASSWORD" mysql -h 127.0.0.1 -u $MYSQL_USER -D $MYSQL_DATABASE -e 'SELECT 1' ], delay: "15", timeout: "5" }


    grecovery:
      sched: { replicas: 0, strategy: "Recreate", restrict: { fat_storage: "1" } }
      affinity: 
        nodeAffinity:
          requiredDuringSchedulingIgnoredDuringExecution: 
            nodeSelectorTerms:
            - matchExpressions:
              - { key: "hostid", operator: "In", values: [ "1", "2", "3" ] }
      groups: [ "adei_db" ]
      images:
        - image: "chsa/mysql-galera:5.7"
          command: [ "run-mysqld-manager" ]
          ports: [ 3306, 4444, 4567, 4568 ]
          env:
            - { name: "MYSQL_ROOT_PASSWORD", value: "secret@adei/adei-password" } 
            - { name: "MYSQL_USER", value: "adei" }
            - { name: "MYSQL_USER_PRIV_SUPER", value: "1" }
            - { name: "MYSQL_PASSWORD", value: "secret@adei/adei-password" } 
            - { name: "MYSQL_DATABASE", value: "adei" }
            - { name: "MYSQL_EXTRADB", value: "adei_%" }
            - { name: "MYSQL_GALERA_USER", value: "xtrabackup_sst" }
            - { name: "MYSQL_GALERA_PASSWORD", value: "secret@adei/service-password" }
            - { name: "POD_NAMESPACE", value: "fieldref@metadata.namespace" }
            - { name: "MYSQL_GALERA_CLUSTER", value: "galera-ss" }
          mappings: 
            - { name: "adei_host", path: "galera", mount: "/var/lib/mysql/data" }