diff --git a/charms/garm-configurator/charmcraft.yaml b/charms/garm-configurator/charmcraft.yaml index 40305051..02732d97 100644 --- a/charms/garm-configurator/charmcraft.yaml +++ b/charms/garm-configurator/charmcraft.yaml @@ -84,9 +84,9 @@ config: Minimum number of idle runners in the scaleset. max-runner: type: int - default: 0 + default: 1 description: | - Maximum number of runners in the scaleset. + Maximum number of runners in the scaleset. Must be greater than 0. labels: type: string description: | diff --git a/charms/garm-configurator/src/charm_state.py b/charms/garm-configurator/src/charm_state.py index 8b7df13c..59e86306 100644 --- a/charms/garm-configurator/src/charm_state.py +++ b/charms/garm-configurator/src/charm_state.py @@ -250,9 +250,9 @@ def from_charm(cls, charm: ops.CharmBase) -> "ScalesetConfig": ) max_runner = int(charm.config.get(SCALESET_MAX_RUNNER_CONFIG_NAME, 0)) - if max_runner < 0: + if max_runner <= 0: raise CharmConfigInvalidError( - f"{SCALESET_MAX_RUNNER_CONFIG_NAME} must be non-negative" + f"{SCALESET_MAX_RUNNER_CONFIG_NAME} must be greater than 0" ) if max_runner < min_idle_runner: raise CharmConfigInvalidError( diff --git a/charms/garm-configurator/tests/unit/test_charm.py b/charms/garm-configurator/tests/unit/test_charm.py index 3cd1bcdc..06cff97f 100644 --- a/charms/garm-configurator/tests/unit/test_charm.py +++ b/charms/garm-configurator/tests/unit/test_charm.py @@ -129,9 +129,14 @@ def test_charm_waiting_with_valid_config_no_relation(): ), pytest.param( {"max-runner": -5}, - "max-runner must be non-negative", + "max-runner must be greater than 0", id="negative-max-runner", ), + pytest.param( + {"max-runner": 0}, + "max-runner must be greater than 0", + id="zero-max-runner", + ), pytest.param( {"min-idle-runner": 5, "max-runner": 3}, "max-runner must be greater than or equal to min-idle-runner", diff --git a/charms/garm-configurator/tox.toml b/charms/garm-configurator/tox.toml index 0319323f..056551b1 100644 --- a/charms/garm-configurator/tox.toml +++ b/charms/garm-configurator/tox.toml @@ -37,7 +37,7 @@ commands = [ [env.unit] description = "Run unit tests" -deps = ["pytest", "coverage[toml]", "ops-scenario==8.7.1", "-r requirements.txt"] +deps = ["pytest", "coverage[toml]", "ops-scenario==8.8.0", "-r requirements.txt"] commands = [ [ "coverage", diff --git a/charms/tests/integration/test_garm_configurator.py b/charms/tests/integration/test_garm_configurator.py index 5772375c..c9a12eab 100644 --- a/charms/tests/integration/test_garm_configurator.py +++ b/charms/tests/integration/test_garm_configurator.py @@ -53,6 +53,7 @@ def deploy_garm_configurator_app_fixture( "name": "test-scaleset", "flavor": "m1.large", "os-arch": "amd64", + "max-runner": "1", "repo": "myorg/myrepo", }, ) diff --git a/docs/changelog.md b/docs/changelog.md index 453de5cc..a8ae22ce 100644 --- a/docs/changelog.md +++ b/docs/changelog.md @@ -8,6 +8,10 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/). Each revision is versioned by the date of the revision. +## 2026-07-06 + +- `garm-configurator`: reject `max-runner=0` during config validation. GARM rejects scale set creation with `max_runners cannot be 0`, so the charm now surfaces the invalid configuration before publishing unusable scale set data to GARM. + ## 2026-07-02 - Fix GARM organization and repository registration: the charm now sets a webhook secret when registering entities. GARM requires a non-empty webhook secret to register an org/repo, so registration previously failed with an opaque server error and scalesets were never created. The charm generates a throwaway secret automatically, so no operator configuration is required.