return pointer to k8sissue

pull/11217/head
Sharif Elgamal 2021-05-03 12:25:17 -07:00
parent 9dbe957234
commit e27e9a1e1b
2 changed files with 5 additions and 4 deletions

View File

@ -1371,7 +1371,7 @@ func validateKubernetesVersion(old *config.ClusterConfig) {
}
// If the version of Kubernetes has a known issue, print a warning out to the screen
if issue := reason.ProblematicK8sVersion(nvs); issue.Description != "" {
if issue := reason.ProblematicK8sVersion(nvs); issue != nil {
out.WarningT(issue.Description, out.V{"version": nvs.String()})
if issue.URL != "" {
out.WarningT("For more information, see: {{.url}}", out.V{"url": issue.URL})

View File

@ -45,13 +45,14 @@ var k8sIssues = []K8sIssue{
},
}
func ProblematicK8sVersion(v semver.Version) K8sIssue {
// ProblematicK8sVersion checks for the supplied Kubernetes version and checks if there's a known issue with it.
func ProblematicK8sVersion(v semver.Version) *K8sIssue {
for _, issue := range k8sIssues {
for _, va := range issue.VersionsAffected {
if va == v.String() {
return issue
return &issue
}
}
}
return K8sIssue{}
return nil
}