mirror of
https://github.com/cozystack/cozystack.git
synced 2026-11-08 21:14:56 +09:00
KubeVirt refuses a VirtualMachine that carries an instancetype matcher and explicit domain sizing at once. validateCPU in pkg/instancetype/apply conflicts on domain.cpu.cores and domain.cpu.sockets when they are non-zero, and validateMemory conflicts on domain.resources.requests.memory whenever the key is present. The chart rendered both, because the matcher keyed off instanceType while the domain sizing keyed off resources, and neither side looked at the other. values.yaml ships instanceType "u1.medium", so clearing that field in the dashboard only falls back to the default. A user who then fills in cpu, sockets and memory gets a VM the webhook rejects, with an error naming fields the form gives them no way to clear. Resources that size the VM completely now replace the matcher, the same way the kubernetes-nodes chart sizes its worker VMs. Beside an instance type, sizing that is only partial stops the render, because there is then no safe reading: dropping the matcher would size the VM from fields the user never finished, and keeping it either loses to the webhook or silently discards what was typed. With no instance type in play there is nothing to conflict with, so that half is left as it renders today. Completeness is decided from what domainResources emitted, not from which keys the user set, and the two readings come apart. resources.cpu on its own emits nothing, so it conflicts with nothing and goes on rendering a plain instancetype-sized VM. cpu and sockets pass through int64, which yields 0 for a quantity the schema accepts, so a cpu of 500m beside a whole sockets and a memory would read as complete from the values, drop the matcher, and hand KubeVirt a cores of 0 the user never asked for. And a resources block nulled outright leaves .Values.resources nil, where a raw field read is a render-time nil pointer and the emitted object is merely empty. The existence check and the update hook read the same effective value. Keying the lookup on the raw one would fail a resource-sized render over an instance type it never references, which is the same confusing error this fixes. Reading .Values in the hook would see the leftover instanceType, skip the removal patch, and leave spec.instancetype.revisionName on a VM Helm had just given explicit domain resources. Assisted-by: LLM Signed-off-by: Aleksei Sviridkin <f@lex.la>
230 lines
7.0 KiB
JSON
230 lines
7.0 KiB
JSON
{
|
|
"title": "Chart Values",
|
|
"type": "object",
|
|
"properties": {
|
|
"external": {
|
|
"description": "Enable external access from outside the cluster.",
|
|
"type": "boolean",
|
|
"default": false
|
|
},
|
|
"externalMethod": {
|
|
"description": "Method to pass through traffic to the VM.",
|
|
"type": "string",
|
|
"default": "PortList",
|
|
"enum": [
|
|
"PortList",
|
|
"WholeIP"
|
|
]
|
|
},
|
|
"externalPorts": {
|
|
"description": "Ports to forward from outside the cluster.",
|
|
"type": "array",
|
|
"default": [
|
|
22
|
|
],
|
|
"items": {
|
|
"type": "integer"
|
|
}
|
|
},
|
|
"externalAllowICMP": {
|
|
"description": "Whether to accept ICMP traffic to the VM in PortList mode (preserves ping and PMTU discovery). No effect in WholeIP mode. Default true so ping behaves as users expect even when port filtering is in effect.",
|
|
"type": "boolean",
|
|
"default": true
|
|
},
|
|
"runStrategy": {
|
|
"description": "Requested running state of the VirtualMachineInstance",
|
|
"type": "string",
|
|
"default": "Always",
|
|
"enum": [
|
|
"Always",
|
|
"Halted",
|
|
"Manual",
|
|
"RerunOnFailure",
|
|
"Once"
|
|
]
|
|
},
|
|
"instanceType": {
|
|
"description": "Virtual Machine instance type. Ignored when `resources` sizes the VM, which needs whole-number cpu and sockets plus memory; the whole type is dropped then, so any dedicated CPU placement, hugepages, NUMA or realtime settings it carries go with it. While this field is set, a `resources` block that sizes only part of the VM is rejected outright instead of ignored, so complete it or clear it.",
|
|
"type": "string",
|
|
"default": "u1.medium",
|
|
"x-cozystack-options": {
|
|
"source": "instancetype"
|
|
}
|
|
},
|
|
"instanceProfile": {
|
|
"description": "Virtual Machine preferences profile.",
|
|
"type": "string",
|
|
"default": "ubuntu",
|
|
"x-cozystack-options": {
|
|
"source": "instanceprofile"
|
|
}
|
|
},
|
|
"disks": {
|
|
"description": "List of disks to attach.",
|
|
"type": "array",
|
|
"default": [],
|
|
"items": {
|
|
"type": "object",
|
|
"required": [
|
|
"name"
|
|
],
|
|
"properties": {
|
|
"bus": {
|
|
"description": "Disk bus type (e.g. \"sata\").",
|
|
"type": "string"
|
|
},
|
|
"name": {
|
|
"description": "Disk name.",
|
|
"type": "string",
|
|
"x-cozystack-options": {
|
|
"source": "vmdisk"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"networks": {
|
|
"description": "Networks to attach the VM to.",
|
|
"type": "array",
|
|
"default": [],
|
|
"items": {
|
|
"type": "object",
|
|
"properties": {
|
|
"name": {
|
|
"description": "Network attachment name.",
|
|
"type": "string",
|
|
"x-cozystack-options": {
|
|
"source": "network"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"subnets": {
|
|
"description": "Deprecated: use networks instead.",
|
|
"type": "array",
|
|
"default": [],
|
|
"items": {
|
|
"type": "object",
|
|
"properties": {
|
|
"name": {
|
|
"description": "Network attachment name.",
|
|
"type": "string",
|
|
"x-cozystack-options": {
|
|
"source": "network"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"gpus": {
|
|
"description": "List of GPUs to attach (NVIDIA driver requires at least 4 GiB RAM).",
|
|
"type": "array",
|
|
"default": [],
|
|
"items": {
|
|
"type": "object",
|
|
"required": [
|
|
"name"
|
|
],
|
|
"properties": {
|
|
"name": {
|
|
"description": "The name of the GPU resource to attach.",
|
|
"type": "string",
|
|
"x-cozystack-options": {
|
|
"source": "gpu"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"cpuModel": {
|
|
"description": "Model specifies the CPU model inside the VMI. List of available models https://github.com/libvirt/libvirt/tree/master/src/cpu_map",
|
|
"type": "string",
|
|
"default": ""
|
|
},
|
|
"firmware": {
|
|
"description": "Firmware and boot configuration (UEFI/BIOS selection, Secure Boot, persistent EFI NVRAM).",
|
|
"type": "object",
|
|
"default": {},
|
|
"properties": {
|
|
"bootloader": {
|
|
"description": "Bootloader to boot the VM with: \"uefi\" (OVMF) or \"bios\" (SeaBIOS). Empty inherits the instanceProfile default.",
|
|
"type": "string"
|
|
},
|
|
"efiPersistent": {
|
|
"description": "Persist EFI NVRAM (e.g. enrolled Secure Boot keys, such as an updated Microsoft UEFI CA) across reboots. Only applies when bootloader is \"uefi\". On default RWO storage the VM is node-pinned (no live-migration).",
|
|
"type": "boolean"
|
|
},
|
|
"secureBoot": {
|
|
"description": "Enable UEFI Secure Boot. Only applies when bootloader is \"uefi\".",
|
|
"type": "boolean"
|
|
}
|
|
}
|
|
},
|
|
"resources": {
|
|
"description": "Resource configuration for the virtual machine. Set whole-number cpu and sockets together with memory to size the VM directly, which overrides `instanceType`. Alongside an `instanceType`, a block that sizes only part of the VM is rejected; cpu or sockets on its own sizes nothing and is ignored.",
|
|
"type": "object",
|
|
"default": {},
|
|
"properties": {
|
|
"cpu": {
|
|
"description": "Number of CPU cores allocated.",
|
|
"pattern": "^(\\+|-)?(([0-9]+(\\.[0-9]*)?)|(\\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\\+|-)?(([0-9]+(\\.[0-9]*)?)|(\\.[0-9]+))))?$",
|
|
"anyOf": [
|
|
{
|
|
"type": "integer"
|
|
},
|
|
{
|
|
"type": "string"
|
|
}
|
|
],
|
|
"x-kubernetes-int-or-string": true
|
|
},
|
|
"memory": {
|
|
"description": "Amount of memory allocated.",
|
|
"pattern": "^(\\+|-)?(([0-9]+(\\.[0-9]*)?)|(\\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\\+|-)?(([0-9]+(\\.[0-9]*)?)|(\\.[0-9]+))))?$",
|
|
"anyOf": [
|
|
{
|
|
"type": "integer"
|
|
},
|
|
{
|
|
"type": "string"
|
|
}
|
|
],
|
|
"x-kubernetes-int-or-string": true
|
|
},
|
|
"sockets": {
|
|
"description": "Number of CPU sockets (vCPU topology).",
|
|
"pattern": "^(\\+|-)?(([0-9]+(\\.[0-9]*)?)|(\\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\\+|-)?(([0-9]+(\\.[0-9]*)?)|(\\.[0-9]+))))?$",
|
|
"anyOf": [
|
|
{
|
|
"type": "integer"
|
|
},
|
|
{
|
|
"type": "string"
|
|
}
|
|
],
|
|
"x-kubernetes-int-or-string": true
|
|
}
|
|
}
|
|
},
|
|
"sshKeys": {
|
|
"description": "List of SSH public keys for authentication.",
|
|
"type": "array",
|
|
"default": [],
|
|
"items": {
|
|
"type": "string"
|
|
}
|
|
},
|
|
"cloudInit": {
|
|
"description": "Cloud-init user data.",
|
|
"type": "string",
|
|
"default": ""
|
|
},
|
|
"cloudInitSeed": {
|
|
"description": "Seed string to generate SMBIOS UUID for the VM.",
|
|
"type": "string",
|
|
"default": ""
|
|
}
|
|
}
|
|
}
|