Passthrough of netplan from template `networks` config to VM
- Dominant language
- Go
- Stars
- 21.9k
- Forks
- 957
- Avg merge
- 2d 6h
- Merged PRs (30d)
- 53
Description
### Description
Configuring custom networking in lima can be slightly painful, usually related to non DHCP networks where start up of the VM will have a 120 second timeout for the VM to boot.
- limactl create --name=vm
- wait 2 minutes for DHCP timeout
- Run provisioning to configure netplan as needed.
- Set `network: {config: disabled}` in `/etc/cloud/cloud.cfg.d/99-disable-network-config.cfg`
- `netplan apply`
- `limactl stop vm`
- `limactl start vm`
Then remember that you disabled network config next time you edit lima config and wonder why the VM isn't updating to the same spec.
As cloud init already does pass through of [version 2 config](https://cloudinit.readthedocs.io/en/22.3/topics/network-config-format-v2.html#netplan-passthrough) from the network datasource to netplan, it would be brilliant if lima could pass through netplan config from `lima.yml` to `/mnt/lima-cidata/network-config`
I'm not sure if anything in lima's `networks` schema that clashes with netplan, but lima does have a slightly different base to it's schema so it might be best if the data is nested? Something like:
```
networks:
- vzNAT: true
- lima: 'bridged'
netplan:
addresses:
- 192.168.17.34/23
routes:
- to: 192.168.24/23
via: 192.168.17.99
```
Then there are probably some precedence questions, for where other lima config already apply's to the `/mnt/lima-cidata/network-config` file.
Injection of the `bonds`, `bridges` and `vlans` parent types in netplan would not be supported by the above schema, but in my experience those are used more at the hypervisor level.
Contributor guide
Assessment
This issue has not been assessed yet.