From ef560b3fce79386d376ec7e71752c0c77e6e68bc Mon Sep 17 00:00:00 2001 From: Teddy Andrieux Date: Fri, 15 Sep 2023 10:17:37 +0200 Subject: [PATCH] salt: Make salt-master `worker_threads` and `timeout` configurable --- CHANGELOG.md | 3 +++ docs/installation/bootstrap.rst | 10 ++++++++++ salt/_pillar/metalk8s.py | 8 ++++++++ salt/metalk8s/salt/master/configured.sls | 2 ++ .../salt/master/files/master-99-metalk8s.conf.j2 | 4 ++-- salt/tests/unit/formulas/config.yaml | 2 ++ 6 files changed, 27 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 25a86a6387..89a2f2f5e6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,9 @@ - Make `KubeJobNotCompleted` alert time configurable (PR[4128](https://github.com/scality/metalk8s/pull/4128)) +- Make salt master `worker_threads` and `timeout` configurable + (PR[4149](https://github.com/scality/metalk8s/pull/4149)) + ## Release 125.0.5 ### Additions diff --git a/docs/installation/bootstrap.rst b/docs/installation/bootstrap.rst index 140c874b2d..871b933d62 100644 --- a/docs/installation/bootstrap.rst +++ b/docs/installation/bootstrap.rst @@ -90,6 +90,10 @@ Configuration kubelet: config: maxPods: 110 + salt: + master: + worker_threads: 12 + timeout: 20 The ``networks`` field specifies a range of IP addresses written in CIDR notation for it's various subfields. @@ -241,6 +245,12 @@ defaults kubernetes configuration. From ``kubelet`` section you can override the max number of pods that can be scheduled on each nodes. +The ``salt`` field can be omitted if you do not have any specific salt settings +to configure. + + From ``master`` section you can override the number of worker threads used + by salt master and the timeout for salt master to get an answer from minions + .. _Feature Gates: https://kubernetes.io/docs/reference/command-line-tools-reference/feature-gates/ .. _specific OpenID for kube-apiserver: https://kubernetes.io/docs/reference/access-authn-authz/authentication/#openid-connect-tokens diff --git a/salt/_pillar/metalk8s.py b/salt/_pillar/metalk8s.py index deeb7e86f6..11b714675d 100644 --- a/salt/_pillar/metalk8s.py +++ b/salt/_pillar/metalk8s.py @@ -177,6 +177,13 @@ def _load_addons(config_data): return addons_data +def _load_salt(config_data): + """Load Salt information from BootstrapConfiguration""" + salt_data = config_data.get("salt", {}) + + return salt_data + + def ext_pillar(minion_id, pillar, bootstrap_config): # pylint: disable=unused-argument config = _load_config(bootstrap_config) if config.get("_errors"): @@ -203,6 +210,7 @@ def ext_pillar(minion_id, pillar, bootstrap_config): # pylint: disable=unused-a "proxies": config.get("proxies", {}), "kubernetes": _load_kubernetes(config), "addons": _load_addons(config), + "salt": _load_salt(config), } if not isinstance(metal_data["archives"], list): diff --git a/salt/metalk8s/salt/master/configured.sls b/salt/metalk8s/salt/master/configured.sls index a013f457ba..9683baff6d 100644 --- a/salt/metalk8s/salt/master/configured.sls +++ b/salt/metalk8s/salt/master/configured.sls @@ -20,6 +20,8 @@ Configure salt master: kubeconfig: "{{ certificates.kubeconfig.files['salt-master'].path }}" salt_api_ssl_crt: {{ certificates.server.files['salt-api'].path }} saltenv: "{{ saltenv }}" + worker_threads: {{ salt.pillar.get("salt:master:worker_threads", default=12) }} + timeout: {{ salt.pillar.get("salt:master:timeout", default=20) }} Configure salt master roots paths: file.serialize: diff --git a/salt/metalk8s/salt/master/files/master-99-metalk8s.conf.j2 b/salt/metalk8s/salt/master/files/master-99-metalk8s.conf.j2 index b18a3e462d..50719889c7 100644 --- a/salt/metalk8s/salt/master/files/master-99-metalk8s.conf.j2 +++ b/salt/metalk8s/salt/master/files/master-99-metalk8s.conf.j2 @@ -2,9 +2,9 @@ interface: {{ salt_ip }} log_level: {{ 'debug' if debug else 'info' }} -timeout: 20 +timeout: {{ timeout }} sock_pool_size: 15 -worker_threads: 10 +worker_threads: {{ worker_threads}} peer: .*: diff --git a/salt/tests/unit/formulas/config.yaml b/salt/tests/unit/formulas/config.yaml index 8be891fe89..a553114029 100644 --- a/salt/tests/unit/formulas/config.yaml +++ b/salt/tests/unit/formulas/config.yaml @@ -931,6 +931,8 @@ metalk8s: kubeconfig: /etc/salt/master-kubeconfig.conf salt_api_ssl_crt: /etc/salt/pki/api/salt-api.crt saltenv: metalk8s-2.7.1 + worker_threads: 58 + timeout: 42 salt-master-manifest.yaml.j2: _cases: