fix(vm): clarify missing default VirtualMachineClass error#2534
Open
eofff wants to merge 1 commit into
Open
Conversation
fda1fa1 to
de049cd
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Changed the VM mutating webhook behavior for VirtualMachines created without
spec.virtualMachineClassName. If no defaultVirtualMachineClassis configured, the VM class defaulter now returns an explicit error instead of leaving the field empty and letting CRD schema validation produce a genericshould be at least 1 chars longmessage.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.virtualMachineClassNameand the cluster has no defaultVirtualMachineClass, 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.virtualMachineClassNameexplicitly or mark oneVirtualMachineClassas default with thevirtualmachineclass.virtualization.deckhouse.io/is-default-class=trueannotation.What is the expected result?
Apply a VirtualMachine manifest without
spec.virtualMachineClassNamein a cluster where noVirtualMachineClasshas the default annotation.The request should be rejected by the webhook with a clear error explaining that no default
VirtualMachineClassis configured and how to fix it.Checklist
Changelog entries