abstract kubernetes issues away

pull/11217/head
Sharif Elgamal 2021-04-28 16:01:59 -07:00
parent 7afe98b855
commit fb5f275baa
3 changed files with 57 additions and 29 deletions

View File

@ -77,16 +77,6 @@ var (
apiServerNames []string
apiServerIPs []net.IP
hostRe = regexp.MustCompile(`^[^-][\w\.-]+$`)
slowK8sVersions = map[string]struct{}{
"1.18.16": {},
"1.18.17": {},
"1.19.8": {},
"1.19.9": {},
"1.20.3": {},
"1.20.4": {},
"1.20.5": {},
"1.21.0": {},
}
)
func init() {
@ -1380,9 +1370,12 @@ func validateKubernetesVersion(old *config.ClusterConfig) {
exitIfNotForced(reason.KubernetesTooOld, "Kubernetes {{.version}} is not supported by this release of minikube", out.V{"version": nvs})
}
if _, ok := slowK8sVersions[nvs.String()]; ok {
out.WarningT("The requested version of Kubernetes has a known performance issue on cluster startup. It might take 2 to 3 minutes for a cluster to start.")
out.WarningT("For more info, see https://github.com/kubernetes/kubeadm/issues/2395")
// If the version of Kubernetes has a known issue, print a warning out to the screen
if issue := reason.ProblematicK8sVersion(nvs); issue.Suggestion != "" {
out.WarningT(issue.Suggestion, out.V{"version": nvs.String()})
if issue.URL != "" {
out.WarningT("For more information, see: {{.url}}", out.V{"url": issue.URL})
}
}
if old == nil || old.KubernetesConfig.KubernetesVersion == "" {

View File

@ -0,0 +1,51 @@
/*
Copyright 2021 The Kubernetes Authors All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package reason
import "github.com/blang/semver"
type K8sIssue struct {
VersionsAffected map[string]struct{}
Suggestion string
URL string
}
var k8sIssues = []K8sIssue{
{
VersionsAffected: map[string]struct{}{
"1.18.16": {},
"1.18.17": {},
"1.19.8": {},
"1.19.9": {},
"1.20.3": {},
"1.20.4": {},
"1.20.5": {},
"1.21.0": {},
},
Suggestion: "Kubernetes {{.version}} has a known performance issue on cluster startup. It might take 2 to 3 minutes for a cluster to start.",
URL: "https://github.com/kubernetes/kubeadm/issues/2395",
},
}
func ProblematicK8sVersion(v semver.Version) K8sIssue {
for _, issue := range k8sIssues {
if _, ok := issue.VersionsAffected[v.String()]; ok {
return issue
}
}
return K8sIssue{}
}

View File

@ -14,22 +14,6 @@ See the License for the specific language governing permissions and
limitations under the License.
*/
/*
Copyright 2020 The Kubernetes Authors All rights reserved.
Licensed under the Apache License, Version 2.0 (the Kind{ID: "License", ExitCode: });
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an Kind{ID: "AS IS", ExitCode: } BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package reason
import (