talos
talos copied to clipboard
talosctl: standard file locations, part II
Feature Request
talosctl
creates and uses two types of files in the user's home directory:
- configuration
- data
Currently, these are mostly shoved into the non-standard .talos
directory.
We will opportunistically use the standard XDG_CONFIG_DATA/talos
directory for the client config if you hold your nose just right and you try very hard, but this is a poor UX and a poor adherence to standards.
While we should endeavour to not break current installations, we should do a much better job of using standard locations.
Configuration should NOT be stored in the OLD os.Path(os.UserHome(), ".talos", "config")
UNLESS BOTH:
- that directory does not exist
-
os.Path(os.UserDir(), ".talos")
does exist
Then we can use the old $HOME/.talos
.
Data stores, such as is presently $HOME/.talos/clusters
, and other data files should be stored in:
- (Linux)
os.Getenv("XDG_DATA_HOME") || os.Path(os.UserDir(), ".local", "share", "talos")
- (Mac)
os.Path(os.UserDir(), "Library", "talos")
- (Windows)
os.Path(os.Getenv("APPDATA"), "talos")
I only know Linux, so for people who know anything about other platforms, please feel free to correct me.
None of this prevents users from creating symlinks for the old locations.
As for Linux, https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html should probably be used as a reference.
Do you consider old .talos/config
to be "user-specific data files" or "user-specific configuration files"? I'd be inclined to the former, as it's talos writing these…
In reality, config directory and data directory discovery is a bit more complicated, and people set XDG_{CONFIG,DATA}_HOME
, or specify a search path via XDG_{CONFIG,DATA}_DIRS
.
As for the talosctl cluster create stuff
, where do you intend to store ~/.talos/cni
? What about the disk images, what about the log files, sockets and pidfiles for the vms?
The ~/.talos/config
is configuration, and that will already be in ~/.config/talos/config.yaml
(this already works, so long as you remove ~/.talos/config
and make sure that ~/.config/talos/config.yaml
exists (touch is sufficient). This will be even better when we can extract more secret information from this file (with upcoming authentication changes).
The current ~/.talos/clusters
is data, so it should be stored in $XDG_DATA_HOME/talos/clusters
.
All the rest of the stuff, I'd just put into the DATA home, also, though you could certainly argue some of that is better stored as CACHE, not data.
I agree that the XDG_{CONFIG,DATA}_DIRS
variant does offer additional complexity, but I think I would simply elide that for the first draft, and if it becomes an issue, we just add support as needed later.
I noticed that
The
~/.talos/config
is configuration, and that will already be in~/.config/talos/config.yaml
(this already works, so long as you remove~/.talos/config
and make sure that~/.config/talos/config.yaml
exists (touch is sufficient). This will be even better when we can extract more secret information from this file (with upcoming authentication changes).
Doesn't seem to be the case. https://www.talos.dev/v1.4/introduction/getting-started/ also mentions that it should be created, but if I talosctl config merge /path/to/talosconfig
It doesn't actually populate the ~/.config/talos/config.yaml even if it already exists.
I presume this is the same for $XDG_DATA_HOME for now.