lima
lima copied to clipboard
Support command-line specification of VM configuration
I think it would be nice to be able to pass flags to limactl start in order to add/override settings in a YAML config. For example:
limactl start --config arch=aarch64
would start lima with the default configuration, except for the arch setting, which is set to aarch64. This should ideally work even when passed a YAML config, like so:
limactl start --config key=value config.yaml
where key may or may not be specified in config.yaml. But in either case, the command line flag takes precedence.
Of course, specifying collection types on the command line can get a little complicated, but presumably, there is some default format that can be used.
A perhaps more general way to implement this would be to allow users to pass multiple YAML configs to limactl start, where configuration that appears later would take precedence where they conflict. This would still enable overriding configuration on the command line with something like
limactl start config.yaml <(echo 'arch: "aarch64"')
In fact, it seems like overriding the default configuration is already possible this way by doing
limactl start <(echo 'arch: "aarch64"')
so it seems a bit natural to allow this for a given YAML config too, while also making the syntax a bit more natural.
Hope that makes sense. Thanks for your work on Lima!
Possibly the same level of overkill / feature growth as in:
- #443
But I do believe there is support for merging config already ?
i.e. filling in values from the default.yaml
but presumably, there is some default format that can be used.
like... YAML :-)
But I do believe there is support for merging config already ?
Suppose I start with config1.yaml as a base (contains settings that are not the default), how do I tell limactl that I want all the settings in config1.yaml as long as they aren't in config2.yaml, and if they are in config2.yaml, limactl should take the value in config2.yaml?
like... YAML :-)
Well, yes. It's just not great trying to write YAML in a single line in your terminal given the whitespace requirements... I guess I'm just hoping for a way to pass small pieces of configuration without having to open up my text editor (whether before calling limactl or selecting the interactive option after calling limactl start).
Possibly the same level of overkill / feature growth
Yes, I can see how that might be the case, especially if one wants to try passing more complicated YAML fragments in the command line. Perhaps you'd also/alternatively consider adding flags for some of the more simple settings (e.g. arch, cpus, memory, disk)?
I think it would be nice to be able to quickly start up VMs where I'm only interested in tweaking these settings relative to a given YAML config without having to open up my editor, no?
I agree that setting cpus memory and disk are handy*, but I will leave it up to the others.
* and also used to setting them that way, from docker-machine and minikube and such
Set arch very rarely myself, but that is mostly because of the performance impact it involves.
Perhaps it should be even be hardcoded to just those flags. (--arch --cpus --memory --disk)
How would you go around with it (changing a value in the default), otherwise ? If there were no such flags, I mean.
Expect it is something like yq e '.arch = "aarch64"' /usr/local/share/doc/lima/examples/default.yaml ?
Then it looks more appetizing with something like --arch=aarch64, at least for those generic VM values.
For other yaml engineering, we used hacks like setting the editor to sed. It wasn't a very clean feeling.
Sorry, too busy to read/respond in detail right now, but I've wanted this feature before (some discussion in #131), and still do want it. I've already implemented the global override.yaml support; extending it to a local override is simple.
My main open question is how to map --set arguments automatically to the limayaml schema. I was envisioning it to work pretty much like the helm --set option, but that one doesn't constrain the arguments to a schema.
Will provide detailed feedback hopefully next week.
This is probably done ?
limactl start --arch=aarch64
limactl start --set '.arch = "aarch64"' (experimental)
v0.17.0 : 3b8e0cebb434e89999632133a9741f6a65ac4590
Yes, it is done; you can specify arbitrary settings via yq syntax now. Here is an example I posted in a discussion thread earlier today:
limactl start --tty=false --set '.images=[{"location":"https://github.com/rancher-sandbox/alpine-lima/releases/download/v0.2.31.rd5/alpine-lima-rd-3.18.0-x86_64.iso", "arch": "x86_64"}]' template://alpine