Skip to content

Commit

Permalink
Use --skip-preflight-checks for k8s < 1.9
Browse files Browse the repository at this point in the history
  • Loading branch information
afbjorklund authored and dlorenc committed Apr 13, 2018
1 parent 85cac4d commit fc9f45f
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 5 deletions.
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

0 comments on commit fc9f45f

Please sign in to comment.