Repository navigation
fix: refuse values that could never be deployed when a configuration is saved - #319
Conversation
…is saved A value could pass the schema and still be impossible to deploy: a CPU or a duration too large to count, more CPU or memory than the agent accepts, less memory than Docker accepts. The configuration was saved, and every deployment of it failed later. Both validators now refuse these values, with the same paths and messages, and the API reads values through the same functions. Closes #314 Signed-off-by: samuel mbabhazi <[email protected]>
|
No actionable comments were generated in the recent review. Walkthrough
Merge Risk:
|
Closes #314. Second of two changes: #317 made a deployment that cannot be planned fail instead of staying stuck; this one refuses the values behind such deployments when the configuration is saved.
What changed
A value could pass the JSON Schema and still be impossible to deploy. The configuration was saved, and every deployment of it failed later, sometimes without a readable reason.
Both validators now refuse these values, after the schema, with the same paths and messages:
resources.cpuresources.memory6Miresources.memory1Ti, or too large to countrun.healthcheck.interval,timeout,start_period,release.timeout,deploy.drain_timeoutvalueIssuesinpackages/config-schema, called byvalidateShipkeepConfig, so the API, and the editor in the browser, report the problem at its field.valueIssuesinlib/config, called byValidate, soshipkeep deployrefuses the same file before it is sent.packages/config-schemainstead of its own copies.A correction
Issue #314 and SPEC 16 said that Docker refuses a CPU limit under 0.01 CPU. I checked on Docker 29.1.3: it accepts
--cpus 0.001, and refuses-m 5mwithMinimum memory limit allowed is 6MB. So there is a memory minimum and no CPU minimum beyond "greater than zero", which the schema already enforces.How it was tested
1mand6Mi,256and1Ti).6Mis under6Mi), and values that overflow.invalid_application_configwith the issue at/resources/cpu, and a release stored with such a value before this check still fails its deployment cleanly (fix(api): fail a deployment that cannot be planned instead of retrying it #317).Not run on the installation rig: no agent action and no installer changes.
Security considerations
Summary by CodeRabbit