Skip to content

fix(vm): clarify missing default VirtualMachineClass error#2534

Open
eofff wants to merge 1 commit into
mainfrom
chore/vm/correct-no-default-vmc-info
Open

fix(vm): clarify missing default VirtualMachineClass error#2534
eofff wants to merge 1 commit into
mainfrom
chore/vm/correct-no-default-vmc-info

Conversation

@eofff

@eofff eofff commented Jun 24, 2026

Copy link
Copy Markdown
Contributor

Description

Changed the VM mutating webhook behavior for VirtualMachines created without spec.virtualMachineClassName. If no default VirtualMachineClass is configured, the VM class defaulter now returns an explicit error instead of leaving the field empty and letting CRD schema validation produce a generic should be at least 1 chars long message.

Updated the VM defaulter unit test to cover this missing default class case.

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

When a user applies a VM manifest without spec.virtualMachineClassName and the cluster has no default VirtualMachineClass, the API currently returns an unclear schema validation error. The actual problem is that the VM class cannot be defaulted.

After this change, users get a direct explanation: either set spec.virtualMachineClassName explicitly or mark one VirtualMachineClass as default with the virtualmachineclass.virtualization.deckhouse.io/is-default-class=true annotation.

What is the expected result?

Apply a VirtualMachine manifest without spec.virtualMachineClassName in a cluster where no VirtualMachineClass has the default annotation.

The request should be rejected by the webhook with a clear error explaining that no default VirtualMachineClass is configured and how to fix it.

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: fix
summary: "VirtualMachine creation without an explicit VM class now reports a clear error when no default VirtualMachineClass is configured."

@eofff eofff added this to the v1.10.0 milestone Jun 24, 2026
@eofff eofff marked this pull request as draft June 24, 2026 21:27
Signed-off-by: Valeriy Khorunzhin <valeriy.khorunzhin@flant.com>
@eofff eofff force-pushed the chore/vm/correct-no-default-vmc-info branch from fda1fa1 to de049cd Compare June 25, 2026 07:44
@eofff eofff requested a review from LopatinDmitr June 25, 2026 08:33
@eofff eofff marked this pull request as ready for review June 25, 2026 08:33
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