forked from gardener/gardener
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathversion.go
38 lines (31 loc) · 901 Bytes
/
version.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
// SPDX-FileCopyrightText: 2024 SAP SE or an SAP affiliate company and Gardener contributors
//
// SPDX-License-Identifier: Apache-2.0
package kubernetesversion
import (
"fmt"
versionutils "github.com/gardener/gardener/pkg/utils/version"
)
// SupportedVersions is the list of supported Kubernetes versions for all runtime and target clusters, i.e. all gardens,
// seeds, and shoots.
var SupportedVersions = []string{
"1.25",
"1.26",
"1.27",
"1.28",
"1.29",
"1.30",
}
// CheckIfSupported checks if the provided version is part of the supported Kubernetes versions list.
func CheckIfSupported(gitVersion string) error {
for _, supportedVersion := range SupportedVersions {
ok, err := versionutils.CompareVersions(gitVersion, "~", supportedVersion)
if err != nil {
return err
}
if ok {
return nil
}
}
return fmt.Errorf("unsupported kubernetes version %q", gitVersion)
}