-
Notifications
You must be signed in to change notification settings - Fork 753
Allow an image URL instead of a template reference #3338
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
This implementation also allows you to use image URLs as base templates: ❯ cat my.yaml
base: https://yum.oracle.com/templates/OracleLinux/OL8/u10/aarch64/OL8U10_aarch64-kvm-cloud-b100.qcow2
❯ limactl tmpl copy --embed my.yaml -
WARN[0000] `base` is experimental
arch: "aarch64"
images:
- location: "https://yum.oracle.com/templates/OracleLinux/OL8/u10/aarch64/OL8U10_aarch64-kvm-cloud-b100.qcow2"
arch: "aarch64"
❯ limactl start my.yaml
...
❯ limactl shell my grep PRETTY /etc/os-release
PRETTY_NAME="Oracle Linux Server 8.10" |
d3e8ac5 to
53d6eb7
Compare
| "stream", // CentOS | ||
| "uefi", // Alpine | ||
| "vm", // openSUSE | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
MaybefileName.trimPrefix("nocloud_").splitWords[0].toLower() just suffices
e.g.,
nocloud_alpine-3.21.2-x86_64-uefi-cloudinit-r0.qcow2->alpineubuntu-24.10-server-cloudimg-arm64.img->ubuntu
Arch-Linux-x86_64-cloudimg-20250201.304316.qcow2 may still needs an exceptional rule though, if we want the instance name to be archlinux, not arch
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I kind of like the more descriptive names. You can always use --name ubuntu https//... if you want a really short name or predictable name.
So I would prefer to keep the current logic, unless you really dislike it.
Also don't want to add unit tests if you are going to make me remove it again. 😄
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@lima-vm/maintainers Thoughts?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Arch-Linux-x86_64-cloudimg-20250201.304316.qcow2may still needs an exceptional rule though, if we want the instance name to bearchlinux, notarch
I just noticed that I didn't add linux to the list of generic tags. I would want to strip that too, so the default instance name for this image would be arch-20250201.304316.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've selected all image names from all our templates and filtered out just the amd64 ones:
find templates -name "*.yaml" -exec yq '.images[].location' {} \; | xargs basename | sed s/nocloud_// | sort -fu | grep -E 'amd|x86'I've then manually transformed each of them into the instance name produced by the current algorithm:
almalinux-8
almalinux-8-8.10-20240819
almalinux-9
almalinux-9-9.5-20241120
alpine-3.21.2-r0
alpine-lima-3.20.3
arch
arch-20250201.304316
centos-10
centos-10-20250210.0
centos-9
centos-9-20250210.0
debian-11
debian-11-20241202-1949
debian-12
debian-12-20250210-2019
debian-sid
fedora-41-1.4
gentoo
ol8u10-b237
ol9u5-b253
opensuse-leap-15.6
opensuse-tumbleweed
rocky-8
rocky-8-8.10-20240528.0
rocky-9
rocky-9-9.5-20241118.0
ubuntu-20.04
ubuntu-22.04
ubuntu-24.04
ubuntu-24.10
I think the names look reasonable, and I would prefer them to just picking the first word from the string.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've added a special rule to translate arch to archlinux and another rule to strip the datestamps, which leaves us with this list of instance names (duplicates pruned):
almalinux-8
almalinux-8-8.10
almalinux-9
almalinux-9-9.5
alpine-3.21.2-r0
alpine-lima-3.20.3
archlinux
centos-10
centos-9
debian-11
debian-12
debian-sid
fedora-41-1.4
gentoo
ol8u10-b237
ol9u5-b253
opensuse-leap-15.6
opensuse-tumbleweed
rocky-8
rocky-8-8.10
rocky-9
rocky-9-9.5
ubuntu-20.04
ubuntu-22.04
ubuntu-24.04
ubuntu-24.10
53d6eb7 to
f1916fa
Compare
|
Changes:
|
b0474bb to
4cd31db
Compare
ab3ddfe to
d75dae4
Compare
The template.Read() method will guess the architecture based on the image filename and construct a template dynamically. It also strips generic tags from the image name to generate an instance name candidate. Signed-off-by: Jan Dubois <[email protected]>
d75dae4 to
4525227
Compare
AkihiroSuda
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks
The template.Read() method will guess the architecture based on the image filename and construct a template dynamically.
It also strips generic tags from the image name to generate an instance name candidate.
Closes #3322
This code needs to be updated with
s390xheuristics once #3319 is merged (or the other way around, depending on which one is merged first).