mirror of
https://github.com/siderolabs/talos.git
synced 2025-09-12 17:31:13 +02:00
Talos shouldn't try to re-encode the machine config it was provided with. So add a `ReadonlyWrapper` around `*v1alpha1.Config` which makes sure that raw config object is not available anymore (it's a private field), but config accessors are available for read-only access. Another thing that `ReadonlyWrapper` does is that it preserves the original `[]byte` encoding of the config keeping it exactly same way as it was loaded from file or read over the network. Improved `talosctl edit mc` to preserve the config as it was submitted, and preserve the edits on error from Talos (previously edits were lost). `ReadonlyWrapper` is not used on config generation path though - config there is represented by `*v1alpha.Config` and can be freely modified. Why almost? Some parts of Talos (platform code) patch the machine configuration with new data. We need to fix platforms to provide networking configuration in a different way, but this will come with other PRs later. Signed-off-by: Andrey Smirnov <andrey.smirnov@talos-systems.com>