Watch
0
0
Fork
You've already forked hyperhive
0

swarm-controller: refuse a percentage with a leading zero in its whole part

systemd ignores `08%` and `085480%` for CPUQuota= and `08%` for MemoryMax=
("Invalid ... ignoring"), which leaves the agent uncapped. `hundredths` now
refuses a whole part that starts with `0` unless it is exactly `0`, for both
fields. `0.5%` and `0.01%` stay accepted.
This commit is contained in:
atlas 2026-10-12 15:25:37 +02:00 • committed by mara
commit 05c9075825
2 changed files with 15 additions and 4 deletions

View file

@ -493,7 +493,8 @@ caps. swarm-controller alone writes it:
`PUT` refuses an agent no hive's wanted state declares, unknown fields, and
any value systemd would ignore, which would leave the agent uncapped. A
percentage has at most two decimals and is above zero, up to `100%` for
percentage has at most two decimals, no leading zero in its whole part (it
refuses `08%`), and is above zero, up to `100%` for
`memory_max` and `21474836.47%` for `cpu_quota`. A size is digits with an
optional fraction and an optional `B`, `K`, `M`, `G` or `T` (upper case), at
least one byte and below 2^64 - 1 bytes. The controller stores each value as