1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
|
sds:
pods:
sds-mysql:
service: { ports: [ 3306 ] }
sched: { replicas: 1, strategy: "Recreate" }
groups: [ "services_sds" ]
images:
- stream: "openshift/mysql:5.7"
env:
- { name: "MYSQL_USER", value: "sds" }
- { name: "MYSQL_PASSWORD", value: "secret@sds/database-password" }
- { name: "MYSQL_ROOT_PASSWORD", value: "secret@sds/root-password" }
- { name: "MYSQL_DATABASE", value: "sds" }
- { name: "MYSQL_MAX_CONNECTIONS", value: "50" }
mappings:
- { name: "db", path: "sds", mount: "/var/lib/mysql/data" }
resources: { limit: { cpu: 1000m, mem: 2Gi } }
# probes:
# - { port: 3306 }
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/sh, -i, -c, sleep 10; MYSQL_PWD="$MYSQL_ROOT_PASSWORD" mysql -h 127.0.0.1 -u root -D $MYSQL_DATABASE -e "GRANT ALL ON *.* TO 'sds'@'%'; UPDATE mysql.user SET Super_Priv='Y' WHERE user='sds' AND host='%'; FLUSH PRIVILEGES;" ] }
|