alpine-lima
alpine-lima copied to clipboard
Rewrite (most of) lima-init in Go
Especially get rid of the awk
code that is hard to understand/maintain.
Interesting links: SIOCSIFNAME in Go instead of C and vishvananda/netlink: Simple netlink library for go.
Are you going to make "lima-init" into a generic "cloud-init", like: can it be used by other distributions too ?
Previously I was looking into this old project, as a replacement for it: https://github.com/afbjorklund/flamingo
Are you going to make "lima-init" into a generic "cloud-init", like: can it be used by other distributions too ?
Probably not; it is minimal and only implements what is required to run Lima (so we don't need Python and all the other prerequisites for cloud-init).
You may want to take a look at https://github.com/mudler/yip, which is a more generic implementation (and maybe I'll switch to that if it does everything we need).
yip
is used by (and may have been created for) cOS, the containerOS toolkit: https://github.com/rancher-sandbox/cOS-toolkit. Not sure why yip
is in a personal repository and not under rancher-sandbox
.
maybe I'll switch to that if it does everything we need
Forgot to link to the cloud-init compatibility section.
I'm sure we can get changes accepted if we need a little more of cloud-init implemented. I've already seen a request that cOS images should work as-is with Lima. I think the issue was that partition-growing was not supported yet.
What I meant was to use it as a cloud-init
implementation for Lima, but for other Linux distributions than alpine.
But I just went ahead and included python3
and cloud-init instead, you are right about the dependencies though...
- python3
- python-certifi
- python-chardet
- python-configobj
- python-idna
- python-jinja2
- python-jsonpatch
- python-jsonpointer
- python-jsonschema
- python-markupsafe
- python-netifaces
- python-oauthlib
- python-pyyaml
- python-requests
- python-setuptools
- python-six
- python-urllib3
It wasn't that bad in size, when compare to the other dependencies (such as the statically linked Go binaries)
Built on some previous work I did for docker-machine
:
https://github.com/afbjorklund/buildroot4containers
I have a "boot2nerdctl" now, which I'm converting to lima...
Previously I did a version for podman: boot2podman
What I meant was to use it as a
cloud-init
implementation for Lima, but for other Linux distributions than alpine.
I'm not sure what this would entail. Currently lima-init is just a small bash script and a small awk script (plus on openrc config file). It could probably be used by other distributions, but might need some tweaks, e.g. if the network isn't managed by udhcpd.
So I guess I still don't quite know what to say beyond that. I also don't know when/if the rewrite to Go is going to happen; there are so many other things that can be done for Lima that would have actual end-user benefits, and not just change the internal wiring...
Note that the reason for writing lima-init instead of using cloud-init wasn't just the total image size, but also the number of bundled packages: if you don't need to bundle additional dependencies, then you don't care if there are CVEs against them because you don't need to update your image. Having more packages increases the size and increases the probability that they will need to be updated more often, independently of the requirements of your actual project/application.
I just wondered if you were going to do a stand-alone implementation of cloud-init
in Go.
CoreOS's project was cancelled and became "ignition", so that is not currently developed.
But I think it lives on out outside Fedora: https://github.com/flatcar-linux/coreos-cloudinit
Can continue with the shell hacks, since it works fine for "machine" but isn't as extendible. Just wondered if Lima already had some alternatives to using the python implementation.
Will let you know how it goes, once the other changes like UEFI and ext4 are completed...
There was some renewed discussion about this, when mentioning openSUSE MicroOS:
- https://github.com/lima-vm/lima/discussions/1474
Similar to the "virtualbox" driver, I wanted to see if "tinycore" would still work and found these:
-
https://github.com/on-prem/tinycore-cloud-init (python, 2020)
-
https://github.com/spinto/tinycloudinit (bash, 2014)
Despite being much smaller, the shell version was the one that actually worked (with some mods)
FWIW, alpine 3.18 will ship with tiny-cloud.
Weird, another project with the same name (as tiny cloud init, https://github.com/spinto/tinycloudinit)
I thought it was a good name for a TinyCore distro, https://github.com/afbjorklund/tinycloud
Interesting! I was now aware of the tinycloudinit project
another cloud-init clone for alpine https://github.com/jirutka/virt-init