Skip to content

Commit

Permalink
Simplify AKS version validation code
Browse files Browse the repository at this point in the history
Co-authored-by: stephybun <[email protected]>
  • Loading branch information
weisdd and stephybun authored Jun 22, 2022
1 parent 124a8d9 commit 4a167e3
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions internal/services/containers/kubernetes_cluster_validate.go
Original file line number Diff line number Diff line change
Expand Up @@ -272,11 +272,10 @@ func validateNodePoolSupportsVersion(ctx context.Context, client *client.Client,
continue
}

supportedVersions = append(supportedVersions, *version.KubernetesVersion)
if *version.KubernetesVersion == desiredNodePoolVersion {
versionExists = true
} else if strings.Count(desiredNodePoolVersion, ".") == 1 && strings.HasPrefix(*version.KubernetesVersion, fmt.Sprintf("%s.", desiredNodePoolVersion)) {
// alias versions (major.minor) are also fine as the latest supported GA patch version is chosen automatically in this case
v := *version.KubernetesVersion
supportedVersions = append(supportedVersions, v)
// alias versions (major.minor) are also fine as the latest supported GA patch version is chosen automatically in this case
if v == desiredNodePoolVersion || v[:strings.LastIndex(v, ".")] == desiredNodePoolVersion {
versionExists = true
}
}
Expand Down

0 comments on commit 4a167e3

Please sign in to comment.