cli: change upgrade-plan to upgrade-check

Upgrade check is used to find updates for the current cluster.
Optionally the found upgrades can be persisted to the config
for consumption by the upgrade-execute cmd.
The old `upgrade execute` in this commit does not work with
the new `upgrade plan`.
The current versions are read from the cluster.
Supported versions are read from the cli and the versionsapi.
Adds a new config field MicroserviceVersion that will be used
by `upgrade execute` to update the service versions.
The field is optional until 2.7
A deprecation warning for the upgrade key is printed during
config validation.
Kubernetes versions now specify the patch version to make it
explicit for users if an upgrade changes the k8s version.
This commit is contained in:
Otto Bittner 2023-01-31 12:12:19 +01:00
parent f204c24174
commit c275464634
27 changed files with 1080 additions and 992 deletions

View file

@ -13,12 +13,28 @@ package versions
import (
"fmt"
"sort"
"strings"
"github.com/edgelesssys/constellation/v2/internal/constants"
"github.com/edgelesssys/constellation/v2/internal/versions/components"
"golang.org/x/mod/semver"
)
// SupportedK8sVersions returns a list (sorted) of supported Kubernetes versions.
func SupportedK8sVersions() []string {
validVersions := make([]string, len(VersionConfigs))
i := 0
for _, conf := range VersionConfigs {
validVersions[i] = conf.ClusterVersion
i++
}
validVersionsSorted := semver.ByVersion(validVersions)
sort.Sort(validVersionsSorted)
return validVersionsSorted
}
// ValidK8sVersion represents any of the three currently supported k8s versions.
type ValidK8sVersion string
@ -85,11 +101,11 @@ const (
// currently supported versions.
//nolint:revive
V1_24 ValidK8sVersion = "1.24"
V1_24 ValidK8sVersion = "v1.24.9"
//nolint:revive
V1_25 ValidK8sVersion = "1.25"
V1_25 ValidK8sVersion = "v1.25.6"
//nolint:revive
V1_26 ValidK8sVersion = "1.26"
V1_26 ValidK8sVersion = "v1.26.1"
// Default k8s version deployed by Constellation.
Default ValidK8sVersion = V1_25