mirror of
https://github.com/edgelesssys/constellation.git
synced 2025-05-02 06:16:08 -04:00
config: allow k8s version MAJOR.MINOR for v2.6 (#1222)
To adhere to our compatibility goal of not breaking old configs, the kubernetes patch version is automatically extended for configs in the transistional version v2.6.
This commit is contained in:
parent
b6b353c53e
commit
c0a62a52d1
3 changed files with 43 additions and 4 deletions
|
@ -311,8 +311,27 @@ func getPlaceholderEntries(m Measurements) []uint32 {
|
|||
return placeholders
|
||||
}
|
||||
|
||||
func validateK8sVersion(fl validator.FieldLevel) bool {
|
||||
return versions.IsSupportedK8sVersion(compatibility.EnsurePrefixV(fl.Field().String()))
|
||||
func (c *Config) validateK8sVersion(fl validator.FieldLevel) bool {
|
||||
// TODO: v2.7: do not create extendedVersion variable and directly validate field from fl.
|
||||
// This patch is for compatibility with configs from v2.5 only. Configs specifying k8s
|
||||
// the version as MAJOR.MINOR automatically get extended with the respective patch version.
|
||||
configVersion := compatibility.EnsurePrefixV(fl.Field().String())
|
||||
if !semver.IsValid(configVersion) {
|
||||
return false
|
||||
}
|
||||
var extendedVersion string
|
||||
switch semver.MajorMinor(configVersion) {
|
||||
case semver.MajorMinor(string(versions.V1_24)):
|
||||
extendedVersion = string(versions.V1_24)
|
||||
case semver.MajorMinor(string(versions.V1_25)):
|
||||
extendedVersion = string(versions.V1_25)
|
||||
case semver.MajorMinor(string(versions.V1_26)):
|
||||
extendedVersion = string(versions.V1_26)
|
||||
default:
|
||||
return false
|
||||
}
|
||||
c.KubernetesVersion = extendedVersion
|
||||
return versions.IsSupportedK8sVersion(extendedVersion)
|
||||
}
|
||||
|
||||
func registerVersionCompatibilityError(ut ut.Translator) error {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue