Files
cozystack/packages
Myasnikov DaniilandClaude Opus 4.8 32aed58ad0 fix(kubernetes): make explicit resources take precedence over instanceType
A node group's instanceType is required and defaulted (u1.medium) in the
schema, so it is effectively always present. When a user — or the dashboard,
which cannot send an empty instanceType — sizes a group with an explicit
resources block, both the instancetype and domain.cpu/memory are rendered and
the KubeVirt admission webhook rejects the VirtualMachine
("...conflicts with selected instance type"); the Machine then hangs in
Provisioning with only a VMCreateFailed condition visible via describe.

Resolve by precedence rather than by failing: when a node group is sized by
explicit resources (both cpu and memory), the instancetype is omitted from the
rendered VM, so the resources-sized VM is valid. Sizing by instanceType alone
is unchanged, and the instancetype lookup is skipped when resources are the
sizing source so a stale instancetype does not fail an otherwise valid group.

This fixes the conflict without changing the schema (instanceType stays
required+defaulted) or the dashboard, so a console user can size by resources
without first clearing instanceType (which the instanceType dropdown does not
allow). Partial overrides (only cpu or only memory) keep the existing
override-layer behaviour. Builds on #3121, which makes resources optional.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Signed-off-by: Myasnikov Daniil <myasnikovdaniil2001@gmail.com>
2026-06-29 16:09:27 +05:00
..