Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)

virtualisation: implement kubevirt config

KubeVirt[1] allows for VMs to be run and managed as pods inside of
Kubernetes clusters. Information about the guests can be exposed through
qemu-guest-agent[2] as well as startup scripts can be injected through
cloud-init[3].

This config has been duplicated and modified from the `cloudstack`
config/script.

To test this out, deploy KubeVirt locally with KinD[4], build the disk
image, then package it into a container image (or upload to CDI[5]) and
provision a VirtualMachine.

[1]: https://kubevirt.io/user-guide/
[2]: https://kubevirt.io/user-guide/virtual_machines/guest_agent_information/
[3]: https://kubevirt.io/user-guide/virtual_machines/startup_scripts/#cloud-init-examples
[4]: https://kubevirt.io/quickstart_kind/
[5]: https://kubevirt.io/user-guide/operations/containerized_data_importer/#containerized-data-importer

Signed-off-by: jbpratt <jbpratt78@gmail.com>

jbpratt e96e5ddd ec75185e

+30
+30
nixos/modules/virtualisation/kubevirt.nix
···
··· 1 + { config, lib, pkgs, ... }: 2 + 3 + { 4 + imports = [ 5 + ../profiles/qemu-guest.nix 6 + ]; 7 + 8 + config = { 9 + fileSystems."/" = { 10 + device = "/dev/disk/by-label/nixos"; 11 + fsType = "ext4"; 12 + autoResize = true; 13 + }; 14 + 15 + boot.growPartition = true; 16 + boot.kernelParams = [ "console=ttyS0" ]; 17 + boot.loader.grub.device = "/dev/vda"; 18 + boot.loader.timeout = 0; 19 + 20 + services.qemuGuest.enable = true; 21 + services.openssh.enable = true; 22 + services.cloud-init.enable = true; 23 + systemd.services."serial-getty@ttyS0".enable = true; 24 + 25 + system.build.kubevirtImage = import ../../lib/make-disk-image.nix { 26 + inherit lib config pkgs; 27 + format = "qcow2"; 28 + }; 29 + }; 30 + }