siderolabs / talos

Talos Linux is a modern Linux distribution built for Kubernetes.
https://www.talos.dev
Mozilla Public License 2.0
6.06k stars 494 forks source link

talosctl: standard file locations, part II #5203

Open Ulexus opened 2 years ago

Ulexus commented 2 years ago

Feature Request

talosctl creates and uses two types of files in the user's home directory:

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:

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:

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.

flokli commented 2 years ago

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?

Ulexus commented 2 years ago

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.

Ulexus commented 2 years ago

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.

neutralalice commented 1 year ago

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.

github-actions[bot] commented 3 weeks ago

This issue is stale because it has been open 180 days with no activity. Remove stale label or comment or this will be closed in 7 days.

github-actions[bot] commented 2 weeks ago

This issue was closed because it has been stalled for 7 days with no activity.