summaryrefslogtreecommitdiffstats
path: root/setup/projects/adei/vars/mysql.yml
diff options
context:
space:
mode:
Diffstat (limited to 'setup/projects/adei/vars/mysql.yml')
-rw-r--r--setup/projects/adei/vars/mysql.yml92
1 files changed, 92 insertions, 0 deletions
diff --git a/setup/projects/adei/vars/mysql.yml b/setup/projects/adei/vars/mysql.yml
new file mode 100644
index 0000000..3349598
--- /dev/null
+++ b/setup/projects/adei/vars/mysql.yml
@@ -0,0 +1,92 @@
+mysql:
+ options:
+ delete: false
+
+ pods:
+ mysql_master:
+ kind: StatefulSet
+ sa: "adeidb"
+ service: { ports: [ 3306 ] }
+ network: { host: "{{ ands_hostnet_db | default(false) }}" }
+ sched: { replicas: 1, strategy: "Recreate", selector: { hostid: "3" } }
+ groups: [ "adei_db" ]
+ labels: { 'service': 'mysql' }
+ pvc: { 'adei_master': {} }
+ images:
+ - image: "chsa/mysql:5.7"
+ command: [ "run-mysqld-master" ]
+ 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_MASTER_USER", value: "replication" }
+ - { name: "MYSQL_MASTER_PASSWORD", value: "secret@adei/service-password" }
+ - { name: "MYSQL_PMA_PASSWORD", value: "secret@adei/pma-password" }
+ - { name: "MYSQL_MAX_CONNECTIONS", value: "500" }
+ - { name: "MYSQL_SYNC_BINLOG", value: "0" }
+ - { name: "MYSQL_FLUSH_LOG_TYPE", value: "2" }
+ - { name: "MYSQL_FLUSH_LOG_TIMEOUT", value: "300" }
+ - { name: "MYSQL_BINLOG_FORMAT", value: "MIXED" }
+# - { name: "MYSQL_BINLOG_FORMAT", value: "ROW" }
+# - { name: "MYSQL_BINLOG_FORMAT", value: "STATEMENT" }
+ mappings:
+ - { name: "adei_master", mount: "/var/lib/mysql/data" }
+ resources: { request: { cpu: 2000m, mem: 4Gi }, limit: { cpu: 6000m, mem: 32Gi } }
+ 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" }
+
+ mysql_slave:
+ kind: StatefulSet
+ sa: "adeidb"
+ service: { ports: [ 3306 ] }
+ network: { host: "{{ ands_hostnet_db | default(false) }}" }
+ sched: { replicas: 1, strategy: "Recreate", limit: { fat_storage: "1" } }
+ affinity:
+ nodeAffinity:
+ requiredDuringSchedulingIgnoredDuringExecution:
+ nodeSelectorTerms:
+ - matchExpressions:
+ - { key: "hostid", operator: "In", values: [ "1", "2" ] }
+ podAntiAffinity:
+ requiredDuringSchedulingIgnoredDuringExecution:
+ topologyKey: kubernetes.io/hostname
+ labelSelector:
+ matchExpressions:
+ - { key: name, operator: In, values: [ "mysql-master", "mysql-slave" ] }
+ groups: [ "adei_db" ]
+ labels: { 'service': 'mysql' }
+ pvc: { 'adei_slave': {} }
+ images:
+ - image: "chsa/mysql:5.7"
+ command: [ "run-mysqld-slave" ]
+ 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_MASTER_USER", value: "replication" }
+ - { name: "MYSQL_MASTER_SERVICE_NAME", value: "mysql-master" }
+ - { name: "MYSQL_MASTER_PASSWORD", value: "secret@adei/service-password" }
+ - { name: "MYSQL_PMA_PASSWORD", value: "secret@adei/pma-password" }
+ - { name: "MYSQL_MAX_CONNECTIONS", value: "500" }
+ - { name: "MYSQL_SYNC_BINLOG", value: "0" }
+ - { name: "MYSQL_FLUSH_LOG_TYPE", value: "2" }
+ - { name: "MYSQL_FLUSH_LOG_TIMEOUT", value: "300" }
+ - { name: "MYSQL_SLAVE_WORKERS", value: "8" }
+ - { name: "MYSQL_SLAVE_SKIP_ERRORS", value: "1007,1008,1050,1051,1054,1060,1061,1068,1094,1146,1304,1359,1476,1537" }
+ - { name: "MYSQL_BINLOG_FORMAT", value: "MIXED" }
+ mappings:
+ - { name: "adei_slave", mount: "/var/lib/mysql/data" }
+# - { name: "adei_init", mount: "/var/lib/init" }
+ resources: { request: { cpu: 2000m, mem: 4Gi }, limit: { cpu: 6000m, mem: 32Gi } }
+ 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" }
+# hooks:
+# - { type: "postStart", command: [ "/bin/bash", "/var/lib/init/mysql/initdb.sh" ] }