Skip to content

Commit

Permalink
Kubevirt: Tag external-boot-image with eve-release
Browse files Browse the repository at this point in the history
At build of pkg/kube:
Save pkg/external-boot-image tag to pkg/kube/external-boot-image.tag

During runtime of cluster-init.sh:
Import and tag external-boot-image to contents of /run/eve-release

pillar kubevirt hypervisor will read /run/eve-release
to determine external-boot-image image to use.

Signed-off-by: Andrew Durbin <andrewd@zededa.com>
  • Loading branch information
andrewd-zededa committed May 16, 2024
1 parent 12c54c2 commit 8f3a501
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 4 deletions.
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -798,8 +798,8 @@ pkg/external-boot-image/build.yml: pkg/external-boot-image/build.yml.in
pkg/external-boot-image: pkg/external-boot-image/build.yml
pkg/kube: pkg/external-boot-image
$(MAKE) eve-external-boot-image
$(MAKE) cache-export IMAGE=$(shell $(LINUXKIT) pkg show-tag pkg/external-boot-image) OUTFILE=pkg/kube/external-boot-image.tar && \
$(MAKE) eve-kube && rm -f pkg/kube/external-boot-image.tar && rm -f pkg/external-boot-image/build.yml
$(MAKE) cache-export IMAGE=$(shell $(LINUXKIT) pkg show-tag pkg/external-boot-image | tee pkg/kube/external-boot-image.tag) OUTFILE=pkg/kube/external-boot-image.tar && \
$(MAKE) eve-kube && rm -f pkg/kube/external-boot-image.tar pkg/kube/external-boot-image.tag pkg/external-boot-image/build.yml
$(QUIET): $@: Succeeded
pkg/pillar: pkg/dnsmasq pkg/gpt-tools pkg/dom0-ztools eve-pillar
$(QUIET): $@: Succeeded
Expand Down
1 change: 1 addition & 0 deletions pkg/kube/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ COPY multus-daemonset.yaml /etc
COPY kubevirt-operator.yaml /etc
COPY kubevirt-features.yaml /etc
COPY external-boot-image.tar /etc/
COPY external-boot-image.tag /etc/

# Longhorn config
COPY iscsid.conf /etc/iscsi/
Expand Down
7 changes: 6 additions & 1 deletion pkg/kube/cluster-init.sh
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,12 @@ check_start_containerd() {
# This is very similar to what we do on kvm based eve to start container as a VM.
logmsg "Trying to install new external-boot-image"
# This import happens once per reboot
if ctr -a /run/containerd-user/containerd.sock image import /etc/external-boot-image.tar docker.io/lfedge/eve-external-boot-image:latest; then
if ctr -a /run/containerd-user/containerd.sock image import /etc/external-boot-image.tar; then
eve_external_boot_img_tag=$(cat /run/eve-release)
eve_external_boot_img=docker.io/lfedge/eve-external-boot-image:"$eve_external_boot_img_tag"
import_tag=$(cat /etc/external-boot-image.tag)
ctr -a /run/containerd-user/containerd.sock image tag "docker.io/${import_tag}" "$eve_external_boot_img"

logmsg "Successfully installed external-boot-image"
rm -f /etc/external-boot-image.tar
fi
Expand Down
6 changes: 5 additions & 1 deletion pkg/pillar/hypervisor/kubevirt.go
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,11 @@ func (ctx kubevirtContext) CreateVMIConfig(domainName string, config types.Domai
// https://kubevirt.io/user-guide/virtual_machines/boot_from_external_source/
// Since disks are virtio disks we assume /dev/vda is the boot disk
kernelArgs := "console=tty0 root=/dev/vda dhcp=1 rootfstype=ext4"
scratchImage := "docker.io/lfedge/eve-external-boot-image:latest"
eveRelease, err := os.ReadFile("/run/eve-release")
if err != nil {
return logError("Failed to fetch eve-release %v", err)
}
scratchImage := "docker.io/lfedge/eve-external-boot-image:" + string(eveRelease)
kernelPath := "/kernel"
initrdPath := "/runx-initrd"

Expand Down

0 comments on commit 8f3a501

Please sign in to comment.