Skip to content

Commit c89e84d

Browse files
authored
Merge pull request #11217 from sharifelgamal/warn-k8s
warn about performance for certain versions of kubernetes
2 parents 4ba1901 + e27e9a1 commit c89e84d

File tree

3 files changed

+67
-17
lines changed

3 files changed

+67
-17
lines changed

cmd/minikube/cmd/start.go

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -394,7 +394,7 @@ func startWithDriver(cmd *cobra.Command, starter node.Starter, existing *config.
394394
}
395395

396396
func warnAboutMultiNodeCNI() {
397-
out.WarningT("Cluster was created without any CNI, adding node to it might cause broken network.")
397+
out.WarningT("Cluster was created without any CNI, adding a node to it might cause broken networking.")
398398
}
399399

400400
func updateDriver(driverName string) {
@@ -1370,6 +1370,14 @@ func validateKubernetesVersion(old *config.ClusterConfig) {
13701370
exitIfNotForced(reason.KubernetesTooOld, "Kubernetes {{.version}} is not supported by this release of minikube", out.V{"version": nvs})
13711371
}
13721372

1373+
// If the version of Kubernetes has a known issue, print a warning out to the screen
1374+
if issue := reason.ProblematicK8sVersion(nvs); issue != nil {
1375+
out.WarningT(issue.Description, out.V{"version": nvs.String()})
1376+
if issue.URL != "" {
1377+
out.WarningT("For more information, see: {{.url}}", out.V{"url": issue.URL})
1378+
}
1379+
}
1380+
13731381
if old == nil || old.KubernetesConfig.KubernetesVersion == "" {
13741382
return
13751383
}

pkg/minikube/reason/k8s.go

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
/*
2+
Copyright 2021 The Kubernetes Authors All rights reserved.
3+
4+
Licensed under the Apache License, Version 2.0 (the "License");
5+
you may not use this file except in compliance with the License.
6+
You may obtain a copy of the License at
7+
8+
http://www.apache.org/licenses/LICENSE-2.0
9+
10+
Unless required by applicable law or agreed to in writing, software
11+
distributed under the License is distributed on an "AS IS" BASIS,
12+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
See the License for the specific language governing permissions and
14+
limitations under the License.
15+
*/
16+
17+
package reason
18+
19+
import "github.com/blang/semver"
20+
21+
// K8sIssue represents a known issue with a particular version of Kubernetes
22+
type K8sIssue struct {
23+
// VersionAffected is the list of Kubernetes versions that has a particular issue
24+
VersionsAffected []string
25+
// Description is what will be printed to the user describing the issue
26+
Description string
27+
// URL is a link to an issue or documentation about the issue, optional.
28+
URL string
29+
}
30+
31+
var k8sIssues = []K8sIssue{
32+
{
33+
VersionsAffected: []string{
34+
"1.18.16",
35+
"1.18.17",
36+
"1.19.8",
37+
"1.19.9",
38+
"1.20.3",
39+
"1.20.4",
40+
"1.20.5",
41+
"1.21.0",
42+
},
43+
Description: "Kubernetes {{.version}} has a known performance issue on cluster startup. It might take 2 to 3 minutes for a cluster to start.",
44+
URL: "https://github.com/kubernetes/kubeadm/issues/2395",
45+
},
46+
}
47+
48+
// ProblematicK8sVersion checks for the supplied Kubernetes version and checks if there's a known issue with it.
49+
func ProblematicK8sVersion(v semver.Version) *K8sIssue {
50+
for _, issue := range k8sIssues {
51+
for _, va := range issue.VersionsAffected {
52+
if va == v.String() {
53+
return &issue
54+
}
55+
}
56+
}
57+
return nil
58+
}

pkg/minikube/reason/reason.go

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -14,22 +14,6 @@ See the License for the specific language governing permissions and
1414
limitations under the License.
1515
*/
1616

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

3519
import (

0 commit comments

Comments
 (0)