Closed myitcv closed 2 years ago
Hi @myitcv , thanks for opening this issue! Sure, it should be possible to disable this behavior :+1: Since the community is the most important piece of k3d, I fixed it on the spot and it will be released in v5.3.0 scheduled for Thursday. What will your talk at FOSDEM be about?
I fixed it on the spot and it will be released in v5.3.0 scheduled for Thursday.
Wonderful. Is there any way that I can test it before then?
My current means on installing k3d
is as follows:
curl -s https://raw.githubusercontent.com/rancher/k3d/v5.2.2/install.sh | TAG=v5.2.2 bash
What will your talk at FOSDEM be about?
I work on the CUE project:
Marcel and I are presenting on the topic: "A practical guide to CUE: patterns for everyday use"
https://fosdem.org/2022/schedule/event/cue_pratical_guide/
We are using k3d
as part of our demo, and are sharing that demo so that others can play around with it locally. k3d
being so lightweight etc is ideal in this situation.
@myitcv ah, amazing and super interesting project 🙂 I'll release tomorrow after polishing the code a bit, so I guess any overhead is unnecessary 👍
@myitcv rc.2 is released that you can use for testing. The final release is just missing a proper changelog and compatibility matrix. No more code changes to go into it 👍
@iwilltry42 looks like you mistagged the release?
https://github.com/rancher/k3d/tree/v3.5.0-rc.2
i.e. v3.5.0-rc.2
should be v5.3.0-rc.2
?
Whoops.. yep 😬 I was just doing that at the side to have a release ready for you to test.. Will re-release later.
No worries!
I've just tested the release in any case and spotted an issue. I think this comparison should be inverted:
https://github.com/rancher/k3d/blob/a8f937fa01c3abf7740d1c70edab830706267e1c/cmd/root.go#L159
Also, if that issue is fixed, I'm seeing quite verbose, unfriendly logging when LOG_COLORS=false
:
$ LOG_COLORS=false LOG_LEVEL=info /tmp/tmp.SAYk3kAPEL/k3d/bin/k3d cluster delete newcluster
time="2022-02-03T08:59:16Z" level=info msg="Deleting cluster 'newcluster'"
time="2022-02-03T08:59:16Z" level=info msg="Deleting 2 attached volumes..."
time="2022-02-03T08:59:16Z" level=warning msg="Failed to delete volume 'k3d-newcluster-images' of cluster 'failed to find volume 'k3d-newcluster-images': Error: No such volume: k3d-newcluster-images': newcluster -> Try to delete it manually"
time="2022-02-03T08:59:16Z" level=info msg="Removing cluster details from default kubeconfig..."
time="2022-02-03T08:59:16Z" level=info msg="Removing standalone kubeconfig file (if there is one)..."
time="2022-02-03T08:59:16Z" level=info msg="Successfully deleted cluster newcluster!"
My own preference would be to drop the timestamps and the level from the output to instead give:
$ LOG_COLORS=false LOG_LEVEL=info /tmp/tmp.SAYk3kAPEL/k3d/bin/k3d cluster delete newcluster
Deleting cluster 'newcluster'
Deleting 2 attached volumes...
Failed to delete volume 'k3d-newcluster-images' of cluster 'failed to find volume 'k3d-newcluster-images': Error: No such volume: k3d-newcluster-images': newcluster -> Try to delete it manually
Removing cluster details from default kubeconfig...
Removing standalone kubeconfig file (if there is one)...
Successfully deleted cluster newcluster!
Thoughts?
I raised https://github.com/rancher/k3d/pull/958 in case it's helpful. Please feel free to disregard if you have your own fix.
Yep, thanks for the fix @myitcv ! Release for v5.3.0-rc.1 is running now. I'm quite busy today so won't cut the final release yet.
Thanks @iwilltry42: rc.1
looks good.
Thanks very much for creating
k3d
. We are using it in an upcoming live demo, for FOSDEM 2022, that we are sharing for others to be able to run locally... and unfortunately this bug is a show-stopper so would appreciate any thoughts/workarounds in the short term.What did you do
n/a. Just looked at the output of the above commands.
What did you expect to happen
For the output not to use control characters by default. The issue appears to be rooted in the hardcoding of coloured output:
https://github.com/rancher/k3d/blob/793fbce86c225033188bd992b753fa79eb6e2fb2/cmd/root.go#L188
I realise however that with
docker
and other commands that ship has somewhat sailed to have coloured output by default.Therefore, perhaps a more realistic expectation would be to be able to turn off coloured output via an environment variable and/or flag. Much like
docker buildx build --progress plain
. Ideally both a flag and environment variable would be supported. In our situation we would prefer to set an environment variable because we runk3d
within a scripted setup where the output, whilst atty
, should not be coloured and hence it should not include any control characters.Screenshots or terminal output
Output from above is:
Which OS & Architecture
Which version of
k3d
Which version of docker