add supported k8s version check

This commit is contained in:
2025-08-09 17:00:02 +03:00
parent 5e8b03ff10
commit 5466c3e36f
4 changed files with 57 additions and 8 deletions

View File

@@ -1,13 +1,45 @@
package config
import (
"golang.org/x/crypto/bcrypt"
"slices"
)
func getBcryptHash(input string) string {
hashedPassword, err := bcrypt.GenerateFromPassword([]byte(input), bcrypt.DefaultCost)
if err != nil {
panic(err)
}
return string(hashedPassword)
var kubernetesVersions = []string{
"1.32.5",
"1.32.4",
"1.32.3",
"1.32.2",
"1.32.1",
"1.32.0",
"1.31.9",
"1.31.8",
"1.31.7",
"1.31.6",
"1.31.5",
"1.31.4",
"1.31.3",
"1.31.2",
"1.31.1",
"1.31.0",
"1.30.13",
"1.30.12",
"1.30.11",
"1.30.10",
"1.30.9",
"1.30.8",
"1.30.7",
"1.30.6",
"1.30.5",
"1.30.4",
"1.30.3",
"1.30.2",
"1.30.1",
"1.30.0",
}
func validateConfig(cfg Config) error {
if !slices.Contains(kubernetesVersions, cfg.Orchestrator.Version) {
return &UnsupportedK8sVersion{Version: cfg.Orchestrator.Version}
}
return nil
}