-
Notifications
You must be signed in to change notification settings - Fork 26
--set type-coercion for IP-shaped values is an operator footgun (use --set-string) #182
Copy link
Copy link
Open
Labels
area/commandsIssues or PRs related to pkg/commands (CLI subcommands, flag parsing, root detection)Issues or PRs related to pkg/commands (CLI subcommands, flag parsing, root detection)area/docsDocumentation / README / inline help / hint copyDocumentation / README / inline help / hint copyarea/templateIssues or PRs related to talm template (chart render, -I rewrite, --set/--values overlays)Issues or PRs related to talm template (chart render, -I rewrite, --set/--values overlays)kind/documentationCategorizes issue or PR as related to documentation, README, hint copy, error-message UXCategorizes issue or PR as related to documentation, README, hint copy, error-message UXpriority/backlogGeneral backlog priority. Lower than priority/important-longtermGeneral backlog priority. Lower than priority/important-longtermtriage/acceptedIndicates an issue is ready to be actively worked onIndicates an issue is ready to be actively worked on
Metadata
Metadata
Assignees
Labels
area/commandsIssues or PRs related to pkg/commands (CLI subcommands, flag parsing, root detection)Issues or PRs related to pkg/commands (CLI subcommands, flag parsing, root detection)area/docsDocumentation / README / inline help / hint copyDocumentation / README / inline help / hint copyarea/templateIssues or PRs related to talm template (chart render, -I rewrite, --set/--values overlays)Issues or PRs related to talm template (chart render, -I rewrite, --set/--values overlays)kind/documentationCategorizes issue or PR as related to documentation, README, hint copy, error-message UXCategorizes issue or PR as related to documentation, README, hint copy, error-message UXpriority/backlogGeneral backlog priority. Lower than priority/important-longtermGeneral backlog priority. Lower than priority/important-longtermtriage/acceptedIndicates an issue is ready to be actively worked onIndicates an issue is ready to be actively worked on
Problem
talm template --set floatingIP=192.168.1.1(andtalm apply --set ...) feed values through Helm'sstrvals.ParseInto, which type-coerces ambiguous values. An IP literal like192.168.1.1is parsed by Helm as a float-shaped token (multiple dots, no leading+/-). The exact behaviour is library-version-dependent but unsafe by default.Operators who scripted
--set floatingIP=...may get unintended type coercion silently; the chart sees a numeric value where it expected a string, and Sprig'stoStringround-trip may bake in formatting differences (192.168.1.1vs192168.0011if the parser landed on a float).Reproduction
With the post-#163 chart, the fail-fast validator catches the malformed value:
Without the validator (older preset), the value goes through as an integer literal
700(octal interpretation suppressed by Sprig'stoString, but the type information is already lost).For numeric-shaped non-IP keys (
--set replicas=1.0), Helm's coercion is silent — no validator catches it.Workaround
Use
--set-stringfor any value where type-stability matters:--set-stringskips type coercion and stores the value as a string verbatim.Expected
--sethelp text and README: for IP / hostname / version literals, use--set-stringto avoid type coercion. Concrete examples in the help text.floatingIP/endpointvalidators and coerce-through-toString as the first step, the way PR fix(charts): pin Layer2VIPConfig to subnet-matching link, not default route #163 already does for nil and integer values.Why this matters
Most operators copy commands from internal runbooks / Slack. A
--set floatingIP=10.17.100.10example will be pasted-and-pasted. Each fork of the value carries the float-coercion risk. Documenting the gotcha + the--set-stringescape hatch is one README paragraph.Surfaced during the dev17 manual test plan exercise (J0-1).