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

Use --skip-preflight-checks for k8s < 1.9 #2721

Merged
merged 1 commit into from
Apr 13, 2018
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
18 changes: 14 additions & 4 deletions pkg/minikube/bootstrapper/kubeadm/kubeadm.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import (
"strings"
"time"

"github.com/blang/semver"
"github.com/docker/machine/libmachine"
"github.com/docker/machine/libmachine/state"
"github.com/golang/glog"
Expand Down Expand Up @@ -111,13 +112,22 @@ func (k *KubeadmBootstrapper) StartCluster(k8s config.KubernetesConfig) error {
// (it should probably stop doing this, though...)
// We use --ignore-preflight-errors=CRI since /var/run/dockershim.sock is not present.
// (because we start kubelet with an invalid config)
version, err := ParseKubernetesVersion(k8s.KubernetesVersion)
if err != nil {
return errors.Wrap(err, "parsing kubernetes version")
}

b := bytes.Buffer{}
templateContext := struct {
KubeadmConfigFile string
Preflights []string
KubeadmConfigFile string
SkipPreflightChecks bool
Preflights []string
}{
KubeadmConfigFile: constants.KubeadmConfigFile,
Preflights: constants.Preflights,
KubeadmConfigFile: constants.KubeadmConfigFile,
SkipPreflightChecks: !VersionIsBetween(version,
semver.MustParse("1.9.0-alpha.0"),
semver.Version{}),
Preflights: constants.Preflights,
}
if err := kubeadmInitTemplate.Execute(&b, templateContext); err != nil {
return err
Expand Down
2 changes: 1 addition & 1 deletion pkg/minikube/bootstrapper/kubeadm/templates.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ sudo /usr/bin/kubeadm alpha phase etcd local --config {{.KubeadmConfigFile}}
`))

var kubeadmInitTemplate = template.Must(template.New("kubeadmInitTemplate").Parse(
"sudo /usr/bin/kubeadm init --config {{.KubeadmConfigFile}} {{range .Preflights}}--ignore-preflight-errors={{.}} {{end}}"))
"sudo /usr/bin/kubeadm init --config {{.KubeadmConfigFile}} {{if .SkipPreflightChecks}}--skip-preflight-checks{{else}}{{range .Preflights}}--ignore-preflight-errors={{.}} {{end}}{{end}}"))

// printMapInOrder sorts the keys and prints the map in order, combining key
// value pairs with the separator character
Expand Down