k3d-io / k3d

Little helper to run CNCF's k3s in Docker
https://k3d.io/
MIT License
5.48k stars 462 forks source link

[BUG] Documentation for kubeconfig write doesn't match actual behaviour #1467

Open Cavaler opened 4 months ago

Cavaler commented 4 months ago

Documentation for kubeconfig write says: this will create (or update) the file $HOME/.k3d/kubeconfig-mycluster.yaml

This is actually not true. Judging by the code it is created either in the directory returned by GetConfigDirOrCreate() which uses $XDG_CONFIG_HOME or defaults to ~/.config/k3d.

There are also some other (obsolete?) mentions of ~/.k3d in the code comments as well.

What did you do

k3d kubeconfig merge edge-local

What did you expect to happen

/home/pavel/.k3d/kubeconfig-edge-local.yaml

Screenshots or terminal output

/home/pavel/.config/kubeconfig-edge-local.yaml

Which OS & Architecture

Ubuntu 20.04 amd64

Which version of k3d

v5.6.3

totallyGreg commented 3 weeks ago

More importantly, if XDG_CONFIG_HOME is set it uses that directory without appending a k3d

☸ k3d-uds in ~/.config/zsh
 [17:01] ❯ k3d kubeconfig write uds
/Users/totally/.config/kubeconfig-uds.yaml

☸ k3d-uds in ~/.config/zsh
 [17:01] ❯ echo $XDG_CONFIG_HOME
/Users/totally/.config

☸ k3d-uds in ~/.config/zsh
 [17:02] ❯ unset XDG_CONFIG_HOME

☸ k3d-uds in ~/.config/zsh
 [17:05] ❯ k3d kubeconfig write uds
/Users/totally/.config/k3d/kubeconfig-uds.yaml