mirror of
https://github.com/ryan4yin/nix-config.git
synced 2026-11-13 12:13:36 +01:00
feat(upload-vm): write the image into the VM's own disk (#285)
The VMs now declare their root disk as a DataVolume with `source: upload`, so upload straight into `<vm>-disk` (CDI only accepts an upload into a DataVolume) instead of a shared golden PVC. Takes the disk size as an argument.
This commit is contained in:
1 parent
d40ed42f6c
commit
7cedea6161
2 files changed
+17
-16
No files matched your search
@@ -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')]
|
||||
|
||||
@@ -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
|
||||
}
|
||||
Reference in new issue
Block a user