abiosoft / abiosoft/colima

colima inconsistent behavior with COLIMA_SAVE_CONFIG=0

Aperta
#1,561 0 commenti 1 reazione 0 assegnatari Vedi su GitHub
Lingua principale
Go
Stelle
30.8k
Fork
613
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Descrizione

### Description

I took the same approach others did using Nix to create the colima configuration files, Relates to https://github.com/abiosoft/colima/issues/613#issuecomment-2294682560. Nix does this in a declarative fashion and makes the files read-only. Colima added the ability to not save over those configurations in #1123, I set COLIMA_SAVE_CONFIG=0.

However when taking that approach, I had a few issues that led to inconsistent behavior.

### Version

```sh
🍎 ❯ colima version && limactl --version && qemu-img --version
colima version 0.10.1
git commit: ed90520
limactl version 2.1.1
zsh: command not found: qemu-img
```

### Operating System

- [ ] macOS Intel <= 13 (Ventura)
- [ ] macOS Intel >= 14 (Sonoma)
- [ ] Apple Silicon <= 13 (Ventura)
- [x] Apple Silicon >= 14 (Sonoma)
- [ ] Linux

### Output of `colima status`

did not capture when i was encountering these issues.

### Reproduction Steps

Following examples assume that the underlying `~/.colima/mtest/colima.yaml` is readonly with the following contents
```yaml
cpu: 4
disk: 80
kubernetes:
enabled: true
k3sArgs:
- --disable=coredns,flannel,local-storage,metrics-server,servicelb,traefik
- --flannel-backend='none'
- --disable-network-policy
- --disable-cloud-controller
- --disable-kube-proxy
- --node-ip=192.168.106.2
port: 6443
version: v1.35.3+k3s1
memory: 12
network:
address: true
mode: shared
runtime: containerd
vmType: krunkit
```

### `~/.lima/_config/networks.yaml` was still being loaded
* originally installed `vmnet` via brew
* uninstalled and reinstalled following https://lima-vm.io/docs/config/network/vmnet/#socket_vmnet
* `COLIMA_SAVE_CONFIG=0 colima start -p mtest`
* colima would still use original homebrew path in the `~/.lima/_config/networks.yaml`
* `rm -rf ~/.lima/_config/networks.yaml`
* `COLIMA_SAVE_CONFIG=1 colima start -p mtest` regenerate the file then error
* `COLIMA_SAVE_CONFIG=0 colima start -p mtest`

### `colima restart -p mtest` failed to resize
`COLIMA_SAVE_CONFIG=0 colima restart -p mtest`
vm would shutdown successfull. vm would begin to start up. Then it would error out saying it needed to resize disk from 80gb to 0b.

### `colima list` frequently never showed ip address
this would also impact other profiles that were functional & not using readonly too.

### Expected behaviour

I would expect the same user experience when COLIMA_SAVE_CONFIG=0 & COLIMA_SAVE_CONFIG=1 outside of saving back to the configuration file.

Honestly I would expect these configurations to be treated as overlays ontop of the default configurations specified. Fully rendered out configurations can be rendere and stored somewhere--but reusing an input appears to have side-effects.

### Additional context

Following some of the other suggestions here. I choose to have nix render out my own base configuration in a declarative way, then copy the contents into the profile i want to run
```sh
mkdir -p ~/.colima/localdev
cat ~/.colima/mytemplate/colima.yaml > ~/.colima/localdev/colima.yaml
colima start -p localdev
```
After doing that I have had 0 issues removing the colima safe file flag. No hangs restarting. No missing ip address from `colima list`. No resizing issues. No stray lima templating issues.

I understand wanting to enrich configuration details for the end users--just wish it was opt in instead of the default. I follow your reasoning, but it does appear something is breaking fundamentally when using that option.

Additional thoughts thoughts:
`colima config list` to print the fully enriched configurations that colima rendered with your colima.yaml
`colima config enrich` to update the colima.yaml, including the self-dcoumenting results

Guida per i contributori

Nessuna guida per i contributori indicizzata per questo repository

Valutazione

Questa issue non è ancora stata valutata.

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.