3 Commits

Author SHA1 Message Date
Andrey Smirnov
2f4b9d8d6d
feat: make machine configuration read-only in Talos (almost)
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>
2021-12-28 20:12:55 +03:00
Artem Chernyshev
70d2505b7c fix: do not require ToVersion to be set when detecting version
We do not know the upgrade version when checking components versions in
Theila.

Signed-off-by: Artem Chernyshev <artem.0xD2@gmail.com>
2021-07-21 08:51:26 -07:00
Artem Chernyshev
f8f1c83a75 feat: detect the lowest Kubernetes version in upgrade-k8s CLI command
Scan all pods in `kube-system` and find `kube-proxy`, `kube-scheduler`,
`kube-controller-manager` and `kube-apiserver` ones, then check the
lowest version amongst them.

Signed-off-by: Artem Chernyshev <artem.0xD2@gmail.com>
2021-07-19 08:24:04 -07:00