mirror of
https://github.com/harvester/harvester-ui-extension.git
synced 2026-08-16 20:59:16 +00:00
* feat(vm): allow Cloud Config for Windows guests Currently the Cloud Config editor is completely hidden when a VM's OS Type is set to Windows, and no `cloudinitdisk` volume or secret is written to the VM spec even if the user has entered content. This blocks a common Windows-on-Harvester workflow: using Cloudbase-Init to run first-boot configuration (install VMDP, enable OpenSSH server, add authorized_keys, join a domain, run `runcmd` steps, etc.). Users on Windows today have to hand-edit the VM YAML after creation to attach a cloudinitdisk, which is fragile and undiscoverable. Changes: - Remove the `v-if="!isWindows"` on the CloudConfig component so the editor is available for every OS type. The Sysprep editor continues to render only for Windows, so Windows now gets both panels; Linux is unchanged. - Drop the `if (!this.isWindows)` guard around the cloudinitdisk volume serialization so the disk is attached whenever the user provided user-data or network-data, regardless of OS. - Drop the `|| this.isWindows` early-return in `saveSecret` so the cloud-init secret is persisted for Windows VMs too. - `getInitUserData` now returns a bare `#cloud-config\n` header for Windows instead of the Linux qemu-guest-agent runcmd template (which would fail on Cloudbase-Init). VMDP installs the QGA on Windows as a native service, so the runcmd path is not needed. The "Install guest agent" checkbox stays disabled for Windows because it specifically drives the Linux QGA-via-runcmd recipe. Fixes point 2 of harvester/harvester#11124. Signed-off-by: Alejandro Bonilla <abonilla@suse.com> * fix(vm): do not clear cloud-config on isWindows watcher fire The isWindows watcher runs on every change of the isWindows computed property, including on mount when editing an existing Windows VM. Setting this['userScript'] and this['networkScript'] to undefined at that point wipes the cloud-config data that was just loaded from the existing VM's cloudinit secret, so the Advanced -> Cloud Config editor shows empty even though the VM has data on the wire. Remove the two clears - Cloud Config is now supported for Windows guests by this PR, so there is no reason to unset the user/network scripts when the OS type is Windows. sshKey and installAgent remain gated (SSH keys are injected via cloud-init on Linux only, and the qemu-guest-agent package install checkbox does not apply to Windows). Signed-off-by: Alejandro Bonilla <abonilla@suse.com> Co-authored-by: Volker Theile <vtheile@suse.com> * refactor(vm): Get CloudInit working for VM templates - Remove unnecessary osType watcher in cloud config. The watcher (see `pkg/harvester/edit/kubevirt.io.virtualmachine/VirtualMachineCloudConfig/DataTemplate.vue`) that cleared the cloud config template for Windows VMs is no longer necessary. - Automatically strip the CloudInit `User Data` properties `package_update` and `packages` for OS type `Windows`. Signed-off-by: Volker Theile <vtheile@suse.com> --------- Signed-off-by: Alejandro Bonilla <abonilla@suse.com> Signed-off-by: Volker Theile <vtheile@suse.com> Co-authored-by: Volker Theile <vtheile@suse.com>