Repository navigation
Conversation
Signed-off-by: somaz <genius5711@gmail.com>
somaz94
added a commit
to somaz94/somaz94
that referenced
this pull request
Oct 12, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Refs #1595
When a stopped instance is deleted without
--data, the runtime disk keeps/var/lib/rancher, but the k3s listen port only lives in/etc/colima/colima.jsonon the root disk. The nextcolima startpicks a new random port, while the kubeconfigs k3s generated under/var/lib/rancher/k3s/server/credstill point at the old one. k3s then restarts in a loop withcontroller-manager exited ... connect: connection refused, which is what juliantibble traced in the issue. Deleting a running instance does not hit this, because the teardown runsk3s-uninstall.shand the k3s state goes with it.This change records the port in the instance store, which is kept and reset together with the runtime disk, and reuses it when the VM is recreated on a formatted disk. An existing instance records its port on its next start, so an instance that is already in the broken state still needs
colima delete --data.Testing
Test_getPortNumbercovers reusing the stored port, storing the port read from the VM, and ignoring a stored port when there is no formatted disk. All three fail without the change.go test ./...passes with Go 1.26.1, and golangci-lint v2.11.3 reports no issues for darwin and linux.I also reproduced it on macOS 14 (Apple Silicon, vz, containerd, k3s v1.35.0+k3s1). On main,
colima stop,colima deleteandcolima startleft k3s listening on a new port with the cred kubeconfigs on the old one, and it restarted 4 times in the first 8 minutes. With this change, the same sequence on an instance first created by main kept the port and the existing cluster, and k3s did not restart.AI disclosure: all of the code and tests in this PR were written with Claude Code (Claude Opus 5.5), and the checks above were run through it. I reviewed the whole diff before opening this PR.