summaryrefslogtreecommitdiffstats
path: root/setup/projects
diff options
context:
space:
mode:
Diffstat (limited to 'setup/projects')
-rw-r--r--setup/projects/adei/templates/40-mysql-svc.yml.j216
-rw-r--r--setup/projects/adei/templates/40-mysql-svc.yml.j2~0
-rw-r--r--setup/projects/adei/vars/apps.yml5
-rw-r--r--setup/projects/adei/vars/globals.yml16
-rw-r--r--setup/projects/adei/vars/mysql.yml92
-rw-r--r--setup/projects/adei/vars/mysql_galera.yml (renamed from setup/projects/adei/vars/galera.yml)33
-rw-r--r--setup/projects/adei/vars/mysql_simple.yml26
-rw-r--r--setup/projects/adei/vars/phpmyadmin.yml16
-rw-r--r--setup/projects/adei/vars/pods.yml55
-rw-r--r--setup/projects/adei/vars/script.yml8
-rw-r--r--setup/projects/adei/vars/volumes.yml24
11 files changed, 214 insertions, 77 deletions
diff --git a/setup/projects/adei/templates/40-mysql-svc.yml.j2 b/setup/projects/adei/templates/40-mysql-svc.yml.j2
new file mode 100644
index 0000000..6263966
--- /dev/null
+++ b/setup/projects/adei/templates/40-mysql-svc.yml.j2
@@ -0,0 +1,16 @@
+apiVersion: v1
+kind: Template
+metadata:
+ name: "mysql-service"
+objects:
+ - apiVersion: v1
+ kind: Service
+ metadata:
+ name: mysql
+ spec:
+ selector:
+ service: mysql
+ ports:
+ - name: "mysql"
+ port: 3306
+ targetPort: 3306
diff --git a/setup/projects/adei/templates/40-mysql-svc.yml.j2~ b/setup/projects/adei/templates/40-mysql-svc.yml.j2~
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/setup/projects/adei/templates/40-mysql-svc.yml.j2~
diff --git a/setup/projects/adei/vars/apps.yml b/setup/projects/adei/vars/apps.yml
new file mode 100644
index 0000000..20cdefe
--- /dev/null
+++ b/setup/projects/adei/vars/apps.yml
@@ -0,0 +1,5 @@
+apps:
+ mysql: { provision: true, instantiate: false }
+ galera: { provision: true, instantiate: false }
+# simple_mysql: { provision: false, instantiate: false }
+ phpmyadmin: { provision: true, instantiate: true }
diff --git a/setup/projects/adei/vars/globals.yml b/setup/projects/adei/vars/globals.yml
index 86911aa..8435926 100644
--- a/setup/projects/adei/vars/globals.yml
+++ b/setup/projects/adei/vars/globals.yml
@@ -5,8 +5,6 @@ adei_pod_history_limit: 2
adei_pod_env:
- name: "HOME"
value: "/tmp"
- - name: "MYSQL_SERVER"
- value: "mysql.adei.svc.cluster.local"
- name: "MYSQL_PORT"
value: "3306"
- name: "MYSQL_USER"
@@ -28,6 +26,8 @@ adei_pod_env:
value: "/adei/src"
adei_prod_env:
+ - name: "MYSQL_SERVER"
+ value: "mysql.adei.svc.cluster.local"
- name: "ADEI_SETUP"
value: "${setup}"
- name: "ADEI_RELEASE"
@@ -42,6 +42,8 @@ adei_prod_env:
value: "${continuous_caching}"
adei_log_env:
+ - name: "MYSQL_SERVER"
+ value: "mysql.adei.svc.cluster.local"
- name: "ADEI_SETUP"
value: "${setup}-logs"
- name: "ADEI_RELEASE"
@@ -54,6 +56,8 @@ adei_log_env:
value: "5"
adei_debug_env:
+ - name: "MYSQL_SERVER"
+ value: "mysql.adei.svc.cluster.local"
- name: "ADEI_SETUP"
value: "${setup}"
- name: "ADEI_RELEASE"
@@ -66,6 +70,8 @@ adei_debug_env:
value: "5"
adei_cron_env:
+ - name: "MYSQL_SERVER"
+ value: "mysql-master.adei.svc.cluster.local"
- name: "ADEI_SETUP"
value: "${setup}"
- name: "ADEI_SCHEDULER"
@@ -76,6 +82,8 @@ adei_update_env:
value: "${continuous_caching}"
adei_cache_env:
+ - name: "MYSQL_SERVER"
+ value: "mysql-master.adei.svc.cluster.local"
- name: "ADEI_SETUP"
value: "${setup}"
- name: "ADEI_URL"
@@ -86,6 +94,8 @@ adei_cache_env:
value: "5"
adei_arc_cache_env:
+ - name: "MYSQL_SERVER"
+ value: "mysql-master.adei.svc.cluster.local"
- name: "ADEI_SETUP"
value: "${setup}"
- name: "ADEI_URL"
@@ -96,6 +106,8 @@ adei_arc_cache_env:
value: "300"
adei_log_cache_env:
+ - name: "MYSQL_SERVER"
+ value: "mysql-master.adei.svc.cluster.local"
- name: "ADEI_SETUP"
value: "${setup}-logs"
- name: "ADEI_URL"
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" ] }
diff --git a/setup/projects/adei/vars/galera.yml b/setup/projects/adei/vars/mysql_galera.yml
index ea64daa..e986268 100644
--- a/setup/projects/adei/vars/galera.yml
+++ b/setup/projects/adei/vars/mysql_galera.yml
@@ -1,26 +1,35 @@
-galera_app:
- name: galera
- provision: true
- instantiate: false
+# We need to set cluster name in environment if we configure host networking...
+galera:
+ options:
+ delete: false
pods:
galera:
kind: StatefulSet
- service: { ports: [ 3306 ] }
+ 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 }
+# 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/adei-password" }
+ - { 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" }
@@ -28,13 +37,13 @@ galera_app:
- { 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_init", mount: "/var/lib/init" }
- - { name: "adei_host", path: "galera", mount: "/var/lib/mysql/data" }
+ - { name: "adei_galera", 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" }
+ 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:
diff --git a/setup/projects/adei/vars/mysql_simple.yml b/setup/projects/adei/vars/mysql_simple.yml
new file mode 100644
index 0000000..d58a5fe
--- /dev/null
+++ b/setup/projects/adei/vars/mysql_simple.yml
@@ -0,0 +1,26 @@
+simple_mysql:
+ pods:
+ mysql:
+ service: { ports: [ 3306 ] }
+ sched: { replicas: 1, strategy: "Recreate", selector: { hostid: "3" } }
+ groups: [ "adei_db" ]
+ images:
+ - image: "centos/mysql-57-centos7"
+ env:
+ - { name: "MYSQL_USER", value: "adei" }
+ - { name: "MYSQL_PASSWORD", value: "secret@adei/adei-password" }
+ - { name: "MYSQL_ROOT_PASSWORD", value: "secret@adei/root-password" }
+ - { name: "MYSQL_DATABASE", value: "adei" }
+ - { name: "MYSQL_PMA_PASSWORD", value: "secret@adei/pma-password" }
+ - { name: "MYSQL_MAX_CONNECTIONS", value: "500" }
+ mappings:
+ - { name: "adei_init", mount: "/var/lib/init" }
+ - { name: "adei_host", path: "mysql", mount: "/var/lib/mysql/data" }
+# - { name: "adei_db", path: "mysql", mount: "/var/lib/mysql/data" }
+ resources: { request: { cpu: 2000m, mem: 4Gi }, limit: { cpu: 6000m, mem: 32Gi } }
+ probes:
+ - { port: 3306 }
+# - { 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'] }
+ hooks:
+ - { type: "postStart", command: [ "/bin/bash", "/var/lib/init/mysql/initdb.sh" ] }
diff --git a/setup/projects/adei/vars/phpmyadmin.yml b/setup/projects/adei/vars/phpmyadmin.yml
new file mode 100644
index 0000000..63bd5d8
--- /dev/null
+++ b/setup/projects/adei/vars/phpmyadmin.yml
@@ -0,0 +1,16 @@
+phpmyadmin:
+ pods:
+ phpmyadmin:
+ service: { host: "phpmyadmin.{{ openshift_master_default_subdomain }}", ports: [ 80/8080 ] }
+ sched: { replicas: 1 }
+ images:
+ - image: "chsa/phpmyadmin-centos:4"
+ env:
+ - { name: "DB_SERVICE_HOST", value: "mysql.adei.svc.cluster.local" }
+ - { name: "DB_SERVICE_PORT", value: "3306" }
+ - { name: "DB_EXTRA_HOSTS", value: "mysql-master.adei.svc.cluster.local,mysql-slave.adei.svc.cluster.local,mysql.katrin.svc.cluster.local,galera.adei.svc.cluster.local" }
+# - { name: "DB_SERVICE_CONTROL_USER", value: "pma" }
+# - { name: "DB_SERVICE_CONTROL_PASSWORD", value: "secret@adei/pma-password" }
+ probes:
+ - { port: 8080, path: '/' }
+ \ No newline at end of file
diff --git a/setup/projects/adei/vars/pods.yml b/setup/projects/adei/vars/pods.yml
deleted file mode 100644
index 8857fcd..0000000
--- a/setup/projects/adei/vars/pods.yml
+++ /dev/null
@@ -1,55 +0,0 @@
-pods:
- mysql:
- service: { ports: [ 3306 ] }
- sched: { replicas: 1, strategy: "Recreate", selector: { hostid: "3" } }
- groups: [ "adei_db" ]
- images:
- - image: "centos/mysql-57-centos7"
- env:
- - { name: "MYSQL_USER", value: "adei" }
- - { name: "MYSQL_PASSWORD", value: "secret@adei/adei-password" }
- - { name: "MYSQL_ROOT_PASSWORD", value: "secret@adei/root-password" }
- - { name: "MYSQL_DATABASE", value: "adei" }
- - { name: "MYSQL_PMA_PASSWORD", value: "secret@adei/pma-password" }
- - { name: "MYSQL_MAX_CONNECTIONS", value: "500" }
- mappings:
- - { name: "adei_init", mount: "/var/lib/init" }
- - { name: "adei_host", path: "mysql", mount: "/var/lib/mysql/data" }
-# - { name: "adei_db", path: "mysql", mount: "/var/lib/mysql/data" }
- resources: { request: { cpu: 2000m, mem: 4Gi }, limit: { cpu: 6000m, mem: 32Gi } }
- probes:
- - { port: 3306 }
-# - { 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'] }
- hooks:
- - { type: "postStart", command: [ "/bin/bash", "/var/lib/init/mysql/initdb.sh" ] }
-
- phpmyadmin:
- service: { host: "phpmyadmin.{{ openshift_master_default_subdomain }}", ports: [ 80/8080 ] }
- sched: { replicas: 1 }
- images:
- - image: "chsa/phpmyadmin-centos:4"
- env:
- - { name: "DB_SERVICE_HOST", value: "mysql.adei.svc.cluster.local" }
- - { name: "DB_SERVICE_PORT", value: "3306" }
- - { name: "DB_EXTRA_HOSTS", value: "mysql.katrin.svc.cluster.local" }
-# - { name: "DB_SERVICE_CONTROL_USER", value: "pma" }
-# - { name: "DB_SERVICE_CONTROL_PASSWORD", value: "secret@adei/pma-password" }
- probes:
- - { port: 8080, path: '/' }
-
-
-
-apps:
- - "galera_app"
-
-
-
-
-#oc:
-# - template: "[0-3]*"
-# - template: "[4-6]*"
-# - resource: "route/apache"
-# oc: "expose svc/kaas --name apache --hostname=apache.{{ openshift_master_default_subdomain }}"
-# - template: "*"
- \ No newline at end of file
diff --git a/setup/projects/adei/vars/script.yml b/setup/projects/adei/vars/script.yml
new file mode 100644
index 0000000..cbd01ba
--- /dev/null
+++ b/setup/projects/adei/vars/script.yml
@@ -0,0 +1,8 @@
+oc:
+ - storage: ".*"
+ - keys: ".*"
+ - oc: "create sa adeidb"
+ resource: "sa/adeidb"
+ - oc: "{{ ands_hostnet_db | default(false) | ternary('adm policy add-scc-to-user hostnetwork -z adeidb', 'adm policy remove-scc-from-user hostnetwork -z adeidb') }}"
+ - templates: "*"
+ - apps: ".*"
diff --git a/setup/projects/adei/vars/volumes.yml b/setup/projects/adei/vars/volumes.yml
index 82f2e18..fdceaae 100644
--- a/setup/projects/adei/vars/volumes.yml
+++ b/setup/projects/adei/vars/volumes.yml
@@ -13,13 +13,21 @@ volumes:
adei_log: { volume: "temporary", path: "/adei/log", write: true } # per-replica (should be fine) temporary files
# adei_db: { volume: "databases", path: "/adei", write: true } # mysql
+# This is not part of volumes and the permissions should be always provisioned using files on adei_host 'osv'
+local_volumes:
+ adei_master: { volume: "hostraid", path: "/adei/mysql_master", nodes: [3], write: true }
+ adei_slave: { volume: "hostraid", path: "/adei/mysql_slave", nodes: [1, 2], write: true }
+ adei_galera: { volume: "hostraid", path: "/adei/galera", write: true }
+
files:
- - { osv: "adei_cfg", path: "/", state: "directory", group: "adei", mode: "02775" }
- - { osv: "adei_src", path: "/", state: "directory", group: "adei", mode: "02775" }
- - { osv: "adei_src", path: "/prod", state: "directory", group: "adei", mode: "02775" }
- - { osv: "adei_src", path: "/dbg", state: "directory", group: "adei", mode: "02775" }
- - { osv: "adei_log", path: "/", state: "directory", group: "adei", mode: "02775" }
- - { osv: "adei_tmp", path: "/", state: "directory", group: "adei", mode: "02775" }
- - { osv: "adei_host",path: "mysql", state: "directory", group: "adei_db", mode: "02775" }
- - { osv: "adei_host",path: "galera", state: "directory", group: "adei_db", mode: "02775" }
+ - { osv: "adei_cfg", path: "/", state: "directory", group: "adei", mode: "02775" }
+ - { osv: "adei_src", path: "/", state: "directory", group: "adei", mode: "02775" }
+ - { osv: "adei_src", path: "/prod", state: "directory", group: "adei", mode: "02775" }
+ - { osv: "adei_src", path: "/dbg", state: "directory", group: "adei", mode: "02775" }
+ - { osv: "adei_log", path: "/", state: "directory", group: "adei", mode: "02775" }
+ - { osv: "adei_tmp", path: "/", state: "directory", group: "adei", mode: "02775" }
+ - { osv: "adei_host",path: "mysql", state: "directory", group: "adei_db", mode: "02775" }
+ - { osv: "adei_host",path: "galera", state: "directory", group: "adei_db", mode: "02775" }
+ - { osv: "adei_host",path: "mysql_master", state: "directory", group: "adei_db", mode: "02775" }
+ - { osv: "adei_host",path: "mysql_slave", state: "directory", group: "adei_db", mode: "02775" }
# - { osv: "adei_db", path: "mysql", state: "directory", group: "adei_db", mode: "02775" }