Skip to content

Commit

Permalink
fixup! leo feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
elchead committed Sep 8, 2023
1 parent 09d9291 commit 9a9916e
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
5 changes: 4 additions & 1 deletion cli/internal/kubecmd/kubecmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,10 @@ func (k *KubeCmd) UpgradeNodeVersion(ctx context.Context, conf *config.Config, f
// Therefore, this code has to skip k8s updates if a user configures an outdated (i.e. invalid) k8s version.
var components *corev1.ConfigMap
currentK8sVersion := conf.KubernetesVersion
versionConfig := versions.VersionConfigs[currentK8sVersion]
versionConfig, ok := versions.VersionConfigs[currentK8sVersion]
if !ok {
return fmt.Errorf("no version config matching K8s %s", currentK8sVersion)
}
components, err = k.updateK8s(&nodeVersion, versionConfig.ClusterVersion, versionConfig.KubernetesComponents, force)

switch {
Expand Down
6 changes: 3 additions & 3 deletions internal/versions/versions.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ func ResolveK8sPatchVersion(k8sVersion string) (string, error) {
if hasPatchVersion(k8sVersion) {
return k8sVersion, nil
}
extendedVersion := K8sVersionFromMajorMinor(k8sVersion)
extendedVersion := k8sVersionFromMajorMinor(k8sVersion)
if extendedVersion == "" {
return "", fmt.Errorf("Kubernetes version %s is not valid. Supported versions: %s",
strings.TrimPrefix(k8sVersion, "v"), supportedVersions())
Expand All @@ -94,10 +94,10 @@ func ResolveK8sPatchVersion(k8sVersion string) (string, error) {
return extendedVersion, nil
}

// K8sVersionFromMajorMinor takes a semver in format MAJOR.MINOR
// k8sVersionFromMajorMinor takes a semver in format MAJOR.MINOR
// and returns the version in format MAJOR.MINOR.PATCH with the
// supported patch version as PATCH.
func K8sVersionFromMajorMinor(version string) string {
func k8sVersionFromMajorMinor(version string) string {
switch version {
case semver.MajorMinor(string(V1_26)):
return string(V1_26)
Expand Down

0 comments on commit 9a9916e

Please sign in to comment.