mirror of
https://github.com/edgelesssys/constellation.git
synced 2025-05-02 06:16:08 -04:00
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:
parent
f204c24174
commit
c275464634
27 changed files with 1080 additions and 992 deletions
|
@ -55,7 +55,7 @@ func translateInvalidK8sVersionError(ut ut.Translator, fe validator.FieldError)
|
|||
validVersionsSorted := semver.ByVersion(validVersions)
|
||||
sort.Sort(validVersionsSorted)
|
||||
|
||||
var errorMsg string
|
||||
errorMsg := fmt.Sprintf("Supported versions: %s", strings.Join(validVersionsSorted, " "))
|
||||
configured, ok := fe.Value().(string)
|
||||
if !ok {
|
||||
errorMsg = "The configured version is not a valid string"
|
||||
|
@ -310,12 +310,12 @@ func translateVersionCompatibilityError(ut ut.Translator, fe validator.FieldErro
|
|||
err := validateVersionCompatibilityHelper(fe.Field(), fe.Value().(string))
|
||||
var msg string
|
||||
|
||||
switch err {
|
||||
case compatibility.ErrSemVer:
|
||||
switch {
|
||||
case errors.Is(err, compatibility.ErrSemVer):
|
||||
msg = fmt.Sprintf("configured version (%s) does not adhere to SemVer syntax", fe.Value().(string))
|
||||
case compatibility.ErrMajorMismatch:
|
||||
case errors.Is(err, compatibility.ErrMajorMismatch):
|
||||
msg = fmt.Sprintf("the CLI's major version (%s) has to match your configured major version (%s)", constants.VersionInfo, fe.Value().(string))
|
||||
case compatibility.ErrMinorDrift:
|
||||
case errors.Is(err, compatibility.ErrMinorDrift):
|
||||
msg = fmt.Sprintf("only the CLI (%s) can be up to one minor version newer than the configured version (%s)", constants.VersionInfo, fe.Value().(string))
|
||||
default:
|
||||
msg = err.Error()
|
||||
|
@ -350,3 +350,8 @@ func validateVersionCompatibilityHelper(fieldName string, configuredVersion stri
|
|||
func returnsTrue(fl validator.FieldLevel) bool {
|
||||
return true
|
||||
}
|
||||
|
||||
// validateUpgradeConfig prints a warning to STDERR and validates the field successfully.
|
||||
func validateUpgradeConfig(sl validator.StructLevel) {
|
||||
fmt.Printf("WARNING: the config key `upgrade` will be deprecated in an upcoming version. Please check the documentation for more information.\n")
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue