diff --git a/Justfile b/Justfile index 819d2ea0..8446f76e 100644 --- a/Justfile +++ b/Justfile @@ -192,10 +192,10 @@ col tag mode="switch": # Build and upload a vm image [linux] [group('homelab')] -upload-vm name verbosity="normal": +upload-vm name size verbosity="normal": #!/usr/bin/env nu use {{utils_nu}} *; - upload-vm {{name}} {{verbosity}} + upload-vm {{name}} {{size}} {{verbosity}} # Deploy all the KubeVirt nodes(Physical machines running KubeVirt) [linux] @@ -230,9 +230,9 @@ youko mode="switch": upload-idols verbosity="normal": #!/usr/bin/env nu use {{utils_nu}} *; - upload-vm aquamarine {{verbosity}} - upload-vm ruby {{verbosity}} - upload-vm kana {{verbosity}} + upload-vm aquamarine 80Gi {{verbosity}} + upload-vm ruby 100Gi {{verbosity}} + upload-vm kana 100Gi {{verbosity}} [linux] [group('homelab')] @@ -261,12 +261,12 @@ kana mode="switch": upload-k3s-test verbosity="normal": #!/usr/bin/env nu use {{utils_nu}} *; - upload-vm k3s-test-1-master-1 {{verbosity}}; - upload-vm k3s-test-1-master-2 {{verbosity}}; - upload-vm k3s-test-1-master-3 {{verbosity}}; - upload-vm k3s-test-1-worker-1 {{verbosity}}; - upload-vm k3s-test-1-worker-2 {{verbosity}}; - upload-vm k3s-test-1-worker-3 {{verbosity}}; + upload-vm k3s-test-1-master-1 50Gi {{verbosity}}; + upload-vm k3s-test-1-master-2 50Gi {{verbosity}}; + upload-vm k3s-test-1-master-3 50Gi {{verbosity}}; + upload-vm k3s-test-1-worker-1 50Gi {{verbosity}}; + upload-vm k3s-test-1-worker-2 50Gi {{verbosity}}; + upload-vm k3s-test-1-worker-3 50Gi {{verbosity}}; [linux] [group('homelab')] diff --git a/utils.nu b/utils.nu index 52cfe932..25ff0527 100644 --- a/utils.nu +++ b/utils.nu @@ -78,6 +78,7 @@ export def darwin-rollback [] { # Build and upload a VM image export def upload-vm [ name: string + size: string verbosity: string ] { print $"upload-vm '($name)' with '($verbosity)' verbosity..." @@ -89,14 +90,14 @@ export def upload-vm [ nix build $target } - # Push the freshly built image into its golden-image PVC. The PVC is - # declared in k8s-gitops (vms/golden-images) and lives on the shared NFS - # store exported by kubevirt-youko, so every node can clone it when a VM - # is (re)created. + # Write the freshly built image straight into the VM's own root disk (a + # DataVolume with `source: upload` in k8s-gitops). CDI only accepts an + # upload into a DataVolume, and this way the disk is populated once, on the + # node the VM is pinned to. # # Requires the CDI upload proxy to be reachable from here; it is exposed # as a NodePort by the cluster (see infra/configs/base/kubevirt). let uploadProxyUrl = "https://192.168.5.181:30443" let image = (glob result/nixos-image-*.qcow2 | first) - virtctl image-upload pvc $"golden-($name)" -n vms --image-path $image --uploadproxy-url $uploadProxyUrl --insecure + virtctl image-upload dv $"($name)-disk" -n vms --size $size --image-path $image --uploadproxy-url $uploadProxyUrl --insecure }