Skip to content

feat(vm): validate hotplug CPU/memory limits and project quotas#2419

Open
eofff wants to merge 7 commits into
mainfrom
feat/vm/hotplug-validators
Open

feat(vm): validate hotplug CPU/memory limits and project quotas#2419
eofff wants to merge 7 commits into
mainfrom
feat/vm/hotplug-validators

Conversation

@eofff
Copy link
Copy Markdown
Contributor

@eofff eofff commented Jun 1, 2026

Description

Added HotplugResourcesValidator to VM webhook update validation pipeline.
The new validator checks hotplug CPU/memory changes against platform limits and namespace ResourceQuota availability (including migration-time double allocation).

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

Hotplug resource updates can exceed safe VM limits or project quotas, which may lead to failed operations during migration and unclear runtime failures.
This change rejects invalid updates early at admission time with explicit validation errors.

What is the expected result?

On VM update, changed hotplug CPU/memory values are validated to ensure:

  • CPU cores do not exceed 128
  • memory does not exceed 256Gi
  • requested CPU/memory fit project ResourceQuota limits and migration-time requirements

Invalid updates are rejected with clear error messages; valid updates pass.

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: vm
type: feature
summary: "Add VM hotplug resources validator to enforce CPU/memory limits and ResourceQuota checks on update."

Signed-off-by: Valeriy Khorunzhin <valeriy.khorunzhin@flant.com>
Valeriy Khorunzhin added 2 commits June 2, 2026 10:01
Signed-off-by: Valeriy Khorunzhin <valeriy.khorunzhin@flant.com>
Signed-off-by: Valeriy Khorunzhin <valeriy.khorunzhin@flant.com>
@eofff eofff added this to the v1.9.0 milestone Jun 2, 2026
@eofff eofff changed the title add hotplug validators feat(vm): validate hotplug CPU/memory limits and project quotas Jun 2, 2026
@eofff eofff requested a review from diafour June 2, 2026 10:07
@eofff eofff marked this pull request as ready for review June 2, 2026 10:08
Copy link
Copy Markdown
Member

@diafour diafour left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also:

  • changing memory.size and cpu.cores/cpu.coreFraction is not always a "hotplug", it may require reboot. Do we need this validation?
  • It seems these validations are needed to prevent migration fails, so it only applicable for specific phases, e.g. no need to validate "Stopped" VMs.

eofff and others added 4 commits June 2, 2026 16:57
…dators/hotplug_resources_validator.go

Co-authored-by: Ivan Mikheykin <ivan.mikheykin@flant.com>
Signed-off-by: Valeriy Khorunzhin <b1kapb999@gmail.com>
…dators/hotplug_resources_validator.go

Co-authored-by: Ivan Mikheykin <ivan.mikheykin@flant.com>
Signed-off-by: Valeriy Khorunzhin <b1kapb999@gmail.com>
Signed-off-by: Valeriy Khorunzhin <valeriy.khorunzhin@flant.com>
Signed-off-by: Valeriy Khorunzhin <valeriy.khorunzhin@flant.com>
@eofff eofff requested a review from diafour June 2, 2026 14:26
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.

2 participants