Merge branch 'master' into pr/27
diff --git a/.kitchen.travis.yml b/.kitchen.travis.yml
new file mode 100644
index 0000000..f847543
--- /dev/null
+++ b/.kitchen.travis.yml
@@ -0,0 +1,6 @@
+suites:
+
+  - name: <%= ENV['SUITE'] %>
+    provisioner:
+      pillars-from-files:
+        neutron.sls: tests/pillar/<%= ENV['SUITE'] %>.sls
diff --git a/.travis.yml b/.travis.yml
index 7d6d051..25c8368 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -17,15 +17,17 @@
   - bundle install
 
 env:
-    - PLATFORM=trevorj/salty-whales:trusty
-    - PLATFORM=trevorj/salty-whales:xenial
+    - PLATFORM=trevorj/salty-whales:trusty SUITE=master_cluster
+    - PLATFORM=trevorj/salty-whales:xenial SUITE=master_cluster
+    - PLATFORM=trevorj/salty-whales:trusty SUITE=slave_cluster
+    - PLATFORM=trevorj/salty-whales:xenial SUITE=slave_cluster
 
 before_script:
   - set -o pipefail
   - make test | tail
 
 script:
-  - bundle exec kitchen test -t tests/integration
+  - KITCHEN_LOCAL_YAML=.kitchen.travis.yml bundle exec kitchen test -t tests/integration
 
 notifications:
   webhooks:
diff --git a/README.rst b/README.rst
index 7b24c83..5f85850 100644
--- a/README.rst
+++ b/README.rst
@@ -56,7 +56,6 @@
           user: root
           password: pass
 
-
 Additional mysql users:
 
 .. code-block:: yaml
@@ -93,19 +92,19 @@
         - available_when_readonly: 1
         - port 9200
 
-InnoDB parameters
-=================
+Configurable soft parameters
+============================
 
-- **innodb_buffer_pool_size** - the default value is 35% of the available ram
+
+- **galera_innodb_buffer_pool_size** - the default value is 3138M
+- **galera_max_connections** - the default value is 20000
 
 Usage:
 .. code-block:: yaml
 
-    galera:
-        master:
-          innodb_buffer_pool_size: 1024M
-        slave:
-          innodb_buffer_pool_size: 1024M
+    _param:
+      galera_innodb_buffer_pool_size: 1024M
+      galera_max_connections: 200 
 
 
 Usage
diff --git a/galera/files/debian.cnf b/galera/files/debian.cnf
index e1b543b..dd1e6fa 100644
--- a/galera/files/debian.cnf
+++ b/galera/files/debian.cnf
@@ -1,8 +1,8 @@
-{%- if pillar.galera.master is defined %}
+{%- if pillar.galera.get('master',{}).get('enabled', False) %}
 {%- from "galera/map.jinja" import master with context %}
 {%- set service = master %}
 {%- endif %}
-{%- if pillar.galera.slave is defined %}
+{%- if pillar.galera.get('slave',{}).get('enabled', False) %}
 {%- from "galera/map.jinja" import slave with context %}
 {%- set service = slave %}
 {%- endif %}
diff --git a/galera/files/my.cnf b/galera/files/my.cnf
index 070efcc..ea04def 100644
--- a/galera/files/my.cnf
+++ b/galera/files/my.cnf
@@ -1,11 +1,11 @@
 # All files in this package is subject to the GPL v2 license
 # More information is in the COPYING file in the top directory of this package.
 # Copyright (C) 2011 severalnines.com
-{%- if pillar.galera.master is defined %}
+{%- if pillar.galera.get('master',{}).get('enabled', False) %}
 {%- from "galera/map.jinja" import master with context %}
 {%- set service = master %}
 {%- endif %}
-{%- if pillar.galera.slave is defined %}
+{%- if pillar.galera.get('slave',{}).get('enabled', False) %}
 {%- from "galera/map.jinja" import slave with context %}
 {%- set service = slave %}
 {%- endif %}
@@ -16,7 +16,7 @@
 datadir=/var/lib/mysql
 bind-address={{ service.bind.address }}
 port=3306
-max_connections={{ service.get('max_connections', 20000) }}
+max_connections={{ service.max_connections }}
 default-storage-engine=innodb
 binlog_format=ROW
 collation-server=utf8_general_ci
@@ -26,6 +26,7 @@
 #log_error=/var/log/mysql/error.log
 skip-external-locking
 skip-name-resolve
+socket = /var/run/mysqld/mysqld.sock
 
 myisam_sort_buffer_size=64M
 wait_timeout=1800
@@ -38,12 +39,7 @@
 
 innodb_file_format=Barracuda
 innodb_file_per_table=1
-{%- if service.innodb_buffer_pool_size is not defined %}
-  {% set buffer_pool_size = '%.0fM'%(grains['mem_total']*0.35) %}
-{%- else %}
-  {% set buffer_pool_size = service.innodb_buffer_pool_size %}
-{%- endif %}
-innodb_buffer_pool_size={{ buffer_pool_size }}
+innodb_buffer_pool_size={{ service.innodb_buffer_pool_size }}
 innodb_log_file_size=627M
 innodb_read_io_threads=8
 innodb_write_io_threads=8
diff --git a/galera/files/my.cnf.container b/galera/files/my.cnf.container
index ec85ef1..0a2645e 100644
--- a/galera/files/my.cnf.container
+++ b/galera/files/my.cnf.container
@@ -1,4 +1,4 @@
-{%- if pillar.galera.master is defined %}
+{%- if pillar.galera.get('master',{}).get('enabled', False) %}
 {%- from "galera/map.jinja" import master with context %}
 {%- set service = master %}
 {%- endif %}
@@ -12,7 +12,7 @@
 pid_file=/var/lib/mysql/mysql.pid
 port=3306
 log_warnings=2
-innodb_buffer_pool_size=3138M
+innodb_buffer_pool_size={{ service.innodb_buffer_pool_size }}
 innodb_flush_log_at_trx_commit=2
 innodb_file_per_table=1
 innodb_data_file_path = ibdata1:100M:autoextend
@@ -45,7 +45,7 @@
 skip_name_resolve
 memlock=0
 sysdate_is_now=1
-max_connections={{ service.get('max_connections', 20000) }}
+max_connections={{ service.max_connections }}
 thread_cache_size=512
 query_cache_type = 0
 query_cache_size = 0
@@ -79,4 +79,4 @@
 [xtrabackup]
 parallel=4
 user={{ service.admin.user }}
-password={{ service.admin.password }}
\ No newline at end of file
+password={{ service.admin.password }}
diff --git a/galera/files/my.cnf.init b/galera/files/my.cnf.init
index ea0e0f0..9b0a0c1 100644
--- a/galera/files/my.cnf.init
+++ b/galera/files/my.cnf.init
@@ -1,11 +1,11 @@
 # All files in this package is subject to the GPL v2 license
 # More information is in the COPYING file in the top directory of this package.
 # Copyright (C) 2011 severalnines.com
-{%- if pillar.galera.master is defined %}
+{%- if pillar.galera.get('master',{}).get('enabled', False) %}
 {%- from "galera/map.jinja" import master with context %}
 {%- set service = master %}
 {%- endif %}
-{%- if pillar.galera.slave is defined %}
+{%- if pillar.galera.get('slave',{}).get('enabled', False) %}
 {%- from "galera/map.jinja" import slave with context %}
 {%- set service = slave %}
 {%- endif %}
@@ -15,7 +15,7 @@
 datadir=/var/lib/mysql
 bind-address={{ service.bind.address }}
 port=3306
-max_connections={{ service.get('max_connections', 20000) }}
+max_connections={{ service.max_connections }}
 default-storage-engine=innodb
 binlog_format=ROW
 collation-server=utf8_general_ci
@@ -36,7 +36,7 @@
 
 innodb_file_format=Barracuda
 innodb_file_per_table=1
-innodb_buffer_pool_size=3138M
+innodb_buffer_pool_size={{ service.innodb_buffer_pool_size }}
 innodb_log_file_size=627M
 innodb_read_io_threads=8
 innodb_write_io_threads=8
diff --git a/galera/map.jinja b/galera/map.jinja
index 96f3736..2db08d1 100644
--- a/galera/map.jinja
+++ b/galera/map.jinja
@@ -1,5 +1,9 @@
 
 {%- set master = salt['grains.filter_by']({
+  'default': {
+    'max_connections': 20000,
+    'innodb_buffer_pool_size': '3138M',
+  },
   'Debian': {
     'pkgs': ['mysql-wsrep-5.6', 'galera-3', 'rsync', 'python-mysqldb', 'psmisc', 'netcat', 'percona-xtrabackup', 'socat', 'libdbd-mysql', 'python-pymysql'],
     'service': 'mysql',
@@ -17,9 +21,13 @@
     'socket': '/var/run/mariadb/mysqld.sock',
     'config': '/etc/my.cnf',
   },
-}, merge=pillar.galera.get('master', {})) %}
+}, merge=pillar.galera.get('master', {}), base='default') %}
 
 {%- set slave = salt['grains.filter_by']({
+  'default': {
+    'max_connections': 20000,
+    'innodb_buffer_pool_size': '3138M',
+  },
   'Debian': {
     'pkgs': ['mysql-wsrep-5.6', 'galera-3', 'rsync', 'python-mysqldb', 'libmysqlclient18', 'psmisc', 'netcat', 'percona-xtrabackup', 'socat', 'libdbd-mysql', 'python-pymysql'],
     'service': 'mysql',
@@ -54,7 +62,7 @@
     'socket': '/var/run/mysqld/mysqld.sock',
     'config': '/etc/mysql/my.cnf',
     },
-}, grain='oscodename', merge=pillar.galera.get('slave', {}))) %}
+}, grain='oscodename', merge=pillar.galera.get('slave', {})), base='default') %}
 
 {% set clustercheck = salt['grains.filter_by']({
   'Debian': {
@@ -72,4 +80,3 @@
     'port': '9200'
     },
 }, merge=pillar.galera.get('clustercheck', {})) %}
-
diff --git a/galera/master.sls b/galera/master.sls
index e1d9e4e..8b2ee5f 100644
--- a/galera/master.sls
+++ b/galera/master.sls
@@ -1,5 +1,5 @@
 {%- from "galera/map.jinja" import master with context %}
-{%- if master.enabled %}
+{%- if master.get('enabled', False) %}
 
 {%- if grains.os_family == 'RedHat' %}
 xtrabackup_repo:
diff --git a/galera/slave.sls b/galera/slave.sls
index 9d9f123..547fbad 100644
--- a/galera/slave.sls
+++ b/galera/slave.sls
@@ -1,5 +1,5 @@
 {%- from "galera/map.jinja" import slave with context %}
-{%- if slave.enabled %}
+{%- if slave.get('enabled', False) %}
 
 {%- if grains.os_family == 'RedHat' %}
 xtrabackup_repo:
diff --git a/metadata/service/master/cluster.yml b/metadata/service/master/cluster.yml
index 7705f6b..05c4c57 100644
--- a/metadata/service/master/cluster.yml
+++ b/metadata/service/master/cluster.yml
@@ -8,6 +8,8 @@
     galera_server_bind_address: ${_param:cluster_local_address}
     galera_server_bind_port: 3306
     galera_server_admin_user: root
+    galera_max_connections: 20000
+    galera_innodb_buffer_pool_size: 3138M
   galera:
     master:
       enabled: true
@@ -26,6 +28,8 @@
         port: 4567
       - host: ${_param:cluster_node03_address}
         port: 4567
+      max_connections: ${_param:galera_max_connections}
+      innodb_buffer_pool_size: ${_param:galera_innodb_buffer_pool_size}
   mysql:
     server:
       users:
diff --git a/metadata/service/master/container.yml b/metadata/service/master/container.yml
index e6ac462..c80beef 100644
--- a/metadata/service/master/container.yml
+++ b/metadata/service/master/container.yml
@@ -3,6 +3,8 @@
     galera_server_cluster_name: galeracluster
     galera_server_bind_port: 3306
     galera_server_admin_user: root
+    galera_max_connections: 20000
+    galera_innodb_buffer_pool_size: 3138M
   kubernetes:
     control:
       configmap:
@@ -28,6 +30,8 @@
                   port: 4567
                 - host: ${_param:mysql_service_host03}
                   port: 4567
+                max_connections: ${_param:galera_max_connections}
+                innodb_buffer_pool_size: ${_param:galera_innodb_buffer_pool_size}
             mysql:
               server:
                 users:
diff --git a/metadata/service/slave/cluster.yml b/metadata/service/slave/cluster.yml
index 2432da6..de05623 100644
--- a/metadata/service/slave/cluster.yml
+++ b/metadata/service/slave/cluster.yml
@@ -8,6 +8,8 @@
     galera_server_bind_address: ${_param:cluster_local_address}
     galera_server_bind_port: 3306
     galera_server_admin_user: root
+    galera_max_connections: 20000
+    galera_innodb_buffer_pool_size: 3138M
   galera:
     slave:
       enabled: true
@@ -26,6 +28,8 @@
         port: 4567
       - host: ${_param:cluster_node03_address}
         port: 4567
+      max_connections: ${_param:galera_max_connections}
+      innodb_buffer_pool_size: ${_param:galera_innodb_buffer_pool_size}
   mysql:
     server:
       users:
diff --git a/tests/pillar/master_cluster.sls b/tests/pillar/master_cluster.sls
index b0c12cc..a8f0633 100644
--- a/tests/pillar/master_cluster.sls
+++ b/tests/pillar/master_cluster.sls
@@ -23,6 +23,8 @@
       available_when_donor: 1
       available_when_readonly: 1
       port: 9200
+      max_connections: 20000
+      innodb_buffer_pool_size: 3138M
   mysql:
     server:
       database:
diff --git a/tests/pillar/slave_cluster.sls b/tests/pillar/slave_cluster.sls
index 73bf999..38c8420 100644
--- a/tests/pillar/slave_cluster.sls
+++ b/tests/pillar/slave_cluster.sls
@@ -23,6 +23,8 @@
       available_when_donor: 1
       available_when_readonly: 1
       port: 9200
+      max_connections: 20000
+      innodb_buffer_pool_size: 3138M
   mysql:
     server:
       users: