From b9cb070525f810689e6c24bc5d0fc57124fb54f3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ram=C3=B3n=20Cahenzli?= Date: Wed, 17 May 2023 16:31:35 +0200 Subject: [PATCH] Add parameters 'master_failure_mode' and 'master_reconnection' for readwritesplit router MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Ramón Cahenzli --- class/defaults.yml | 2 ++ component/main.jsonnet | 2 ++ configs/maxscale.cnf | 25 ++----------------- .../ROOT/pages/references/parameters.adoc | 17 +++++++++++++ tests/defaults.yml | 2 ++ 5 files changed, 25 insertions(+), 23 deletions(-) diff --git a/class/defaults.yml b/class/defaults.yml index 52e7bf1..b0c7079 100644 --- a/class/defaults.yml +++ b/class/defaults.yml @@ -15,6 +15,8 @@ parameters: monitor_user: maxscale service_pwd: ?{vaultkv:${cluster:tenant}/${cluster:name}/${_instance}/service_pwd} monitor_pwd: ?{vaultkv:${cluster:tenant}/${cluster:name}/${_instance}/monitor_pwd} + master_failure_mode: fail_instantly + master_reconnection: false replicas: 2 affinity: {} images: diff --git a/component/main.jsonnet b/component/main.jsonnet index 34260f5..58e58f8 100644 --- a/component/main.jsonnet +++ b/component/main.jsonnet @@ -77,6 +77,8 @@ local deployment = kube.Deployment('maxscale') { SERVICE_PWD: kube.SecretKeyRef(secret, 'service_pwd'), MONITOR_USER: params.monitor_user, MONITOR_PWD: kube.SecretKeyRef(secret, 'monitor_pwd'), + MASTER_FAILURE_MODE: params.master_failure_mode, + MASTER_RECONNECTION: params.master_reconnection, }), ports_+: { masteronly: { containerPort: 3306 }, diff --git a/configs/maxscale.cnf b/configs/maxscale.cnf index e5ab11e..0454d56 100644 --- a/configs/maxscale.cnf +++ b/configs/maxscale.cnf @@ -11,6 +11,8 @@ router=readwritesplit servers=db1,db2,db3 type=service user=$SERVICE_USER +master_failure_mode=$MASTER_FAILURE_MODE +master_reconnection=$MASTER_RECONNECTION [ReadWriteSplit-Listener] address=$READ_WRITE_LISTEN_ADDRESS @@ -63,26 +65,3 @@ address=$DB3_ADDRESS port=$DB3_PORT protocol=MariaDBBackend priority=3 - -#[MaxInfo] -#type=service -#router=maxinfo -#user=monitor -#password=$SERVICE_PWD -# -#[MaxInfo-JSON-Listener] -#type=listener -#service=MaxInfo -#protocol=HTTPD -#port=8003 -# -#[CLI] -#type=service -#router=cli -# -#[CLI-Listener] -#type=listener -#service=CLI -#protocol=maxscaled -#socket=default - diff --git a/docs/modules/ROOT/pages/references/parameters.adoc b/docs/modules/ROOT/pages/references/parameters.adoc index ea6ceda..af5a2bf 100644 --- a/docs/modules/ROOT/pages/references/parameters.adoc +++ b/docs/modules/ROOT/pages/references/parameters.adoc @@ -90,6 +90,23 @@ default:: `?{vaultkv:${cluster:tenant}/${cluster:name}/maxscale/service_pwd}` type:: string default:: `?{vaultkv:${cluster:tenant}/${cluster:name}/maxscale/monitor_pwd}` +== `master_failure_mode` + +Controls behavior of the readwritesplit router module on master failure, see [upstream documentation](https://mariadb.com/kb/en/mariadb-maxscale-6-readwritesplit/#master_failure_mode). + +[horizontal] +type:: string +default:: `fail_instantly` + +== `master_reconnection` + +Whether the readwritesplit router module allows the master server to change mid-session, see [upstream documentation](https://mariadb.com/kb/en/mariadb-maxscale-6-readwritesplit/#master_reconnection). + +[horizontal] +type:: boolean +default:: `false` + + = Pod Affinity Parameters By default, `affinity` is set to `{}` so the pods get no specific affinity. You can override this freely to [choose any pod affinity rules](https://kubernetes.io/docs/concepts/scheduling-eviction/assign-pod-node/). diff --git a/tests/defaults.yml b/tests/defaults.yml index 842cb98..f0048a4 100644 --- a/tests/defaults.yml +++ b/tests/defaults.yml @@ -20,6 +20,8 @@ parameters: monitor_user: maxscale-testmonitor service_pwd: ?{vaultkv:${cluster:tenant}/${cluster:name}/${_instance}/service_pwd} monitor_pwd: ?{vaultkv:${cluster:tenant}/${cluster:name}/${_instance}/monitor_pwd} + master_failure_mode: fail_instantly + master_reconnection: false resources: limits: memory: 512Mi