Skip to content

fix(vmclass): make sizing policy validation messages actionable and close gaps#2602

Open
fl64 wants to merge 2 commits into
mainfrom
fix/vm/sizing-policy-validation
Open

fix(vmclass): make sizing policy validation messages actionable and close gaps#2602
fl64 wants to merge 2 commits into
mainfrom
fix/vm/sizing-policy-validation

Conversation

@fl64

@fl64 fl64 commented Jul 6, 2026

Copy link
Copy Markdown
Member

Description

Sizing policy validation errors were confusing and, in some cases, missing. When a VirtualMachineClass sets per-core memory limits, the error reported the allowed values per CPU core, while users configure the total memory — so the suggested numbers matched nothing they could actually set. Messages now report the total memory to set for the current number of cores, name the field to change, and combine multiple violations into a single readable list.

This also fixes cases where the policy was silently not enforced: the CPU cores step was never validated, and a memory / per-core minimum was ignored when no maximum was set.

Why do we need it, and what problem does it solve?

Users hit an admission error like requested VM per core memory ... nearest valid values are [1536Mi, 2Gi] and could not tell that those were per-core values to be multiplied by the number of cores. They would set the shown value as total memory and fail again. On top of that, some misconfigurations passed validation entirely because parts of the policy were never checked.

What is the expected result?

  • A VM that violates the per-core memory policy now gets a total-memory suggestion, e.g. set the memory size (spec.memory.size) to 2Gi or 4Gi, with changing the number of cores offered as an alternative.
  • A policy with a cores step, or a memory minimum without a maximum, now rejects non-matching VMs instead of silently accepting them.
  • When several parameters are wrong at once, all reasons are listed in one message.

Note: on clusters where an administrator already uses cores.step or a memory minimum without a maximum, VMs that slipped through while these checks were missing will now be reported as not matching the sizing policy on their next update. This is the intended effect of the fix. The default generic VMClass does not use these fields and is unaffected.

Checklist

  • The code is covered by unit tests.
  • e2e tests passed.
  • Documentation updated according to the changes.
  • Changes were tested in the Kubernetes cluster manually.

Changelog entries

section: vmclass
type: fix
summary: "VirtualMachineClass sizing policy errors now report the total memory to set and the field to change instead of per-core values, and CPU cores step and minimum-only memory limits are now enforced."

…lose gaps

Sizing policy validation reported per-core memory limits, but users set
total memory (spec.memory.size), so the suggested values were unusable
without manually multiplying them by the number of cores. Errors now
report the total memory to set for the current number of cores, name the
field to change, and render multiple violations as a single readable list.

Also close silent gaps: the CPU cores step was never enforced, and a
memory / per-core minimum was ignored when no maximum was set.

Signed-off-by: Pavel Tishkov <pavel.tishkov@flant.com>
@fl64 fl64 force-pushed the fix/vm/sizing-policy-validation branch from 651837f to 71fddd4 Compare July 6, 2026 18:12
@fl64 fl64 changed the title fix(vm): make sizing policy validation messages actionable and close gaps fix(vmclass): make sizing policy validation messages actionable and close gaps Jul 6, 2026
@fl64 fl64 added this to the v1.10.0 milestone Jul 6, 2026
Signed-off-by: Pavel Tishkov <pavel.tishkov@flant.com>
@fl64 fl64 requested review from goganat and prismagod as code owners July 7, 2026 06:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant