Adding MariaDB charm
[osm/devops.git] / installers / charm / mariadb-k8s / reactive / spec_template_ha.yaml
1 # Copyright 2021 Canonical Ltd.
2 #
3 # Licensed under the Apache License, Version 2.0 (the "License"); you may
4 # not use this file except in compliance with the License. You may obtain
5 # a copy of the License at
6 #
7 #         http://www.apache.org/licenses/LICENSE-2.0
8 #
9 # Unless required by applicable law or agreed to in writing, software
10 # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
11 # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
12 # License for the specific language governing permissions and limitations
13 # under the License.
14 #
15 # For those usages not covered by the Apache License, Version 2.0 please
16 # contact: legal@canonical.com
17 #
18 # To get in touch with the maintainers, please contact:
19 # osm-charmers@lists.launchpad.net
20 ##
21
22 version: 2
23 service:
24   scalePolicy: serial
25   annotations:
26     service.alpha.kubernetes.io/tolerate-unready-endpoints: "true"
27 containers:
28   - name: %(name)s
29     image: %(docker_image)s
30     kubernetes:
31       readinessProbe:
32         tcpSocket:
33           port: %(mysql_port)s
34         initialDelaySeconds: 10
35         periodSeconds: 10
36         timeoutSeconds: 5
37         successThreshold: 1
38         failureThreshold: 3
39       livenessProbe:
40         exec:
41           command: ["bash", "-c", "mysql -uroot -p\"${MYSQL_ROOT_PASSWORD}\" -e 'show databases;'"]
42         initialDelaySeconds: 120
43         periodSeconds: 10
44         timeoutSeconds: 5
45         successThreshold: 1
46         failureThreshold: 3
47     ports:
48     - containerPort: %(mysql_port)s
49       protocol: TCP
50       name: main
51     - containerPort: 4444
52       name: sst
53     - containerPort: 4567
54       name: replication
55     - containerPort: 4568
56       name: ist
57     config:
58       MYSQL_ROOT_PASSWORD: %(root_password)s
59       APPLICATION_NAME: %(application_name)s
60       MYSQL_USER: %(user)s
61       MYSQL_PASSWORD: %(password)s
62       MYSQL_DATABASE: %(database)s
63     files:
64       - name: configurations
65         mountPath: /etc/mysqlconfiguration
66         files:
67           galera.cnf: |
68             [galera]
69             user = mysql
70             bind-address = 0.0.0.0
71         
72             default_storage_engine = InnoDB
73             binlog_format = ROW
74             innodb_autoinc_lock_mode = 2
75             innodb_flush_log_at_trx_commit = 0
76             query_cache_size = 0
77             host_cache_size = 0
78             query_cache_type = 0
79
80             # MariaDB Galera settings
81             wsrep_on=ON
82             wsrep_provider=/usr/lib/galera/libgalera_smm.so
83             wsrep_sst_method=rsync
84
85             # Cluster settings (automatically updated)
86             wsrep_cluster_address=gcomm://
87             wsrep_cluster_name=vimdb_cluser
88             wsrep_node_address=127.0.0.1
89           mariadb.cnf: |
90             [client]
91             default-character-set = utf8
92             [mysqld]
93             character-set-server  = utf8
94             collation-server      = utf8_general_ci
95             plugin_load_add = feedbackx#
96             # InnoDB tuning
97             innodb_log_file_size  = 50M