feat: support version contract for Talos config generation

This allows to generating current version Talos configs (by default) or
backwards compatible configuration (e.g. for Talos 0.8).

`talosctl gen config` defaults to current version, but explicit version
can be passed to the command via flags.

`talosctl cluster create` defaults to install/container image version,
but that can be overridden. This makes `talosctl cluster create` now
compatible with 0.8.1 images out of the box.

Upgrade tests use contract based on source version in the test.

When used as a library, `VersionContract` can be omitted (defaults to
current version) or passed explicitly. `VersionContract` can be
convienietly parsed from Talos version string or specified as one of the
constants.

Fixes #3130

Signed-off-by: Andrey Smirnov <smirnov.andrey@gmail.com>
This commit is contained in:
Andrey Smirnov
2021-02-09 23:50:39 +03:00
committed by talos-bot
parent f9896777fc
commit daea9d3811
12 changed files with 259 additions and 31 deletions

View File

@@ -112,7 +112,7 @@ func Generate(ctx context.Context, in *machine.GenerateConfigurationRequest) (re
switch {
case os.IsNotExist(err):
secrets, err = generate.NewSecretsBundle(clock, false)
secrets, err = generate.NewSecretsBundle(clock)
if err != nil {
return nil, err
}