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

Restart containerd after stopping alternate runtimes #3343

Merged
merged 2 commits into from
Nov 16, 2018
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
22 changes: 15 additions & 7 deletions cmd/minikube/cmd/start.go
Original file line number Diff line number Diff line change
Expand Up @@ -295,31 +295,39 @@ func runStart(cmd *cobra.Command, args []string) {
fmt.Println("Stopping extra container runtimes...")

containerRuntime := viper.GetString(containerRuntime)
if config.VMDriver != "none" && containerRuntime != "" {
if config.VMDriver != constants.DriverNone && containerRuntime != "" {
if _, err := host.RunSSHCommand("sudo systemctl stop docker"); err == nil {
_, err = host.RunSSHCommand("sudo systemctl stop docker.socket")
}
if err != nil {
glog.Errorf("Error stopping docker", err)
glog.Errorf("Error stopping docker: %v", err)
}
}
if config.VMDriver != "none" && (containerRuntime != "crio" && containerRuntime != "cri-o") {
if config.VMDriver != constants.DriverNone && (containerRuntime != constants.CrioRuntime && containerRuntime != constants.Cri_oRuntime) {
if _, err := host.RunSSHCommand("sudo systemctl stop crio"); err != nil {
glog.Errorf("Error stopping crio", err)
glog.Errorf("Error stopping crio: %v", err)
}
}
if config.VMDriver != "none" && containerRuntime != "rkt" {
if config.VMDriver != constants.DriverNone && containerRuntime != constants.RktRuntime {
if _, err := host.RunSSHCommand("sudo systemctl stop rkt-api"); err == nil {
_, err = host.RunSSHCommand("sudo systemctl stop rkt-metadata")
}
if err != nil {
glog.Errorf("Error stopping rkt", err)
glog.Errorf("Error stopping rkt: %v", err)
}
}

if config.VMDriver != constants.DriverNone && containerRuntime == constants.ContainerdRuntime {
fmt.Println("Restarting containerd runtime...")
// restart containerd so that it can install all plugins
if _, err := host.RunSSHCommand("sudo systemctl restart containerd"); err != nil {
glog.Errorf("Error restarting containerd: %v", err)
}
}

fmt.Println("Starting cluster components...")

if !exists || config.VMDriver == "none" {
if !exists || config.VMDriver == constants.DriverNone {
if err := k8sBootstrapper.StartCluster(kubernetesConfig); err != nil {
glog.Errorln("Error starting cluster: ", err)
cmdutil.MaybeReportErrorAndExit(err)
Expand Down
6 changes: 5 additions & 1 deletion pkg/minikube/bootstrapper/kubeadm/kubeadm.go
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,10 @@ func (k *KubeadmBootstrapper) StartCluster(k8s config.KubernetesConfig) error {
}

b := bytes.Buffer{}
preflights := constants.Preflights
if k8s.ContainerRuntime != "" {
preflights = constants.AlternateRuntimePreflights
}
templateContext := struct {
KubeadmConfigFile string
SkipPreflightChecks bool
Expand All @@ -125,7 +129,7 @@ func (k *KubeadmBootstrapper) StartCluster(k8s config.KubernetesConfig) error {
SkipPreflightChecks: !VersionIsBetween(version,
semver.MustParse("1.9.0-alpha.0"),
semver.Version{}),
Preflights: constants.Preflights,
Preflights: preflights,
DNSAddon: "kube-dns",
}
if version.GTE(semver.MustParse("1.12.0")) {
Expand Down
17 changes: 17 additions & 0 deletions pkg/minikube/constants/constants.go
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,23 @@ var Preflights = []string{
"CRI",
}

// AlternateRuntimePreflights are additional preflight checks applied when running
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
// AlternateRuntimePreflights are additional preflight checks applied when running
// AlternateRuntimePreflights are additional preflight checks that are skipped when running

// any container runtime that isn't Docker
var AlternateRuntimePreflights = append(Preflights, []string{
"Service-Docker",
"Port-8443",
"Port-10251",
"Port-10252",
"Port-2379",
}...)

const (
ContainerdRuntime = "containerd"
RktRuntime = "rkt"
CrioRuntime = "crio"
Cri_oRuntime = "cri-o"
)

const (
DefaultUfsPort = "5640"
DefaultUfsDebugLvl = 0
Expand Down