Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

warn about performance for certain versions of kubernetes #11217

Merged
merged 6 commits into from
May 3, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion cmd/minikube/cmd/start.go
Original file line number Diff line number Diff line change
Expand Up @@ -394,7 +394,7 @@ func startWithDriver(cmd *cobra.Command, starter node.Starter, existing *config.
}

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

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

// If the version of Kubernetes has a known issue, print a warning out to the screen
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})
}
}

if old == nil || old.KubernetesConfig.KubernetesVersion == "" {
return
}
Expand Down
58 changes: 58 additions & 0 deletions pkg/minikube/reason/k8s.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
/*
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"

// K8sIssue represents a known issue with a particular version of Kubernetes
type K8sIssue struct {
sharifelgamal marked this conversation as resolved.
Show resolved Hide resolved
// VersionAffected is the list of Kubernetes versions that has a particular issue
VersionsAffected []string
// Description is what will be printed to the user describing the issue
Description string
// URL is a link to an issue or documentation about the issue, optional.
URL string
}

var k8sIssues = []K8sIssue{
{
VersionsAffected: []string{
"1.18.16",
"1.18.17",
"1.19.8",
"1.19.9",
"1.20.3",
"1.20.4",
"1.20.5",
"1.21.0",
},
Description: "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",
},
}

// 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 nil
}
16 changes: 0 additions & 16 deletions pkg/minikube/reason/reason.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
Expand Down