提交 9f09f02e 编写于 作者: T Thomas Stromberg

Address PR comments, make sure PullImages code path is exercised

上级 27aafce1
......@@ -350,7 +350,10 @@ This can also be done automatically by setting the env var CHANGE_MINIKUBE_NONE_
}
if !exists || config.VMDriver == constants.DriverNone {
fmt.Println("Starting cluster components...")
fmt.Println("Pulling images...")
if err := bs.PullImages(kubernetesConfig); err != nil {
fmt.Printf("Unable to pull images, which may be OK: %v", err)
}
if err := bs.StartCluster(kubernetesConfig); err != nil {
glog.Errorf("Error starting cluster: %v", err)
cmdutil.MaybeReportErrorAndExit(err)
......
......@@ -122,7 +122,7 @@ func (d *Driver) GetURL() (string, error) {
// GetState returns the state that the host is in (running, stopped, etc)
func (d *Driver) GetState() (state.State, error) {
if err := runningKubelet(d.exec); err != nil {
if err := checkKubelet(d.exec); err != nil {
glog.Infof("kubelet not running: %v", err)
return state.Stopped, nil
}
......@@ -153,7 +153,7 @@ func (d *Driver) Remove() error {
if err := d.Kill(); err != nil {
return errors.Wrap(err, "kill")
}
// TODO(tstromberg): Make sure this calls into the bootstrapper to perform `kubeadm reset`
// TODO(#3637): Make sure this calls into the bootstrapper to perform `kubeadm reset`
cmd := fmt.Sprintf("sudo rm -rf %s", strings.Join(cleanupPaths, " "))
if err := d.exec.Run(cmd); err != nil {
glog.Errorf("cleanup incomplete: %v", err)
......@@ -212,8 +212,8 @@ func restartKubelet(exec bootstrapper.CommandRunner) error {
return exec.Run("sudo systemctl restart kubelet.service")
}
// runningKubelet returns an error if the kubelet is not running.
func runningKubelet(exec bootstrapper.CommandRunner) error {
// checkKubelet returns an error if the kubelet is not running.
func checkKubelet(exec bootstrapper.CommandRunner) error {
glog.Infof("checking for running kubelet ...")
return exec.Run("systemctl is-active --quiet service kubelet")
}
......@@ -74,7 +74,7 @@ func (r *Containerd) Disable() error {
// LoadImage loads an image into this runtime
func (r *Containerd) LoadImage(path string) error {
return nil
return pullImageCRI(r.Runner, path)
}
// KubeletOptions returns kubelet options for a containerd
......
......@@ -21,6 +21,8 @@ import (
"fmt"
"html/template"
"path"
"github.com/golang/glog"
)
// listCRIContainers returns a list of containers using crictl
......@@ -29,12 +31,18 @@ func listCRIContainers(_ CommandRunner, _ string) ([]string, error) {
return []string{}, fmt.Errorf("unimplemented")
}
// pullImageCRI uses ctr to pull images into a CRI runtime
func pullImageCRI(cr CommandRunner, path string) error {
glog.Infof("Loading image: %s", path)
return cr.Run(fmt.Sprintf("sudo ctr cri load %s", path))
}
// criCRIContainers kills a list of containers using crictl
func killCRIContainers(CommandRunner, []string) error {
return fmt.Errorf("unimplemented")
}
// StopCRIContainers stops containers using crictl
// stopCRIContainers stops containers using crictl
func stopCRIContainers(CommandRunner, []string) error {
return fmt.Errorf("unimplemented")
}
......
......@@ -73,7 +73,9 @@ func (r *CRIO) Disable() error {
// LoadImage loads an image into this runtime
func (r *CRIO) LoadImage(path string) error {
// This should use ctr via pullImageCRI once we sort out why api.v1.CRIPluginService is unimplemented.
return r.Runner.Run(fmt.Sprintf("sudo podman load -i %s", path))
}
// KubeletOptions returns kubelet options for a runtime.
......
......@@ -67,6 +67,7 @@ func (r *Docker) Disable() error {
// LoadImage loads an image into this runtime
func (r *Docker) LoadImage(path string) error {
glog.Infof("Loading image: %s", path)
return r.Runner.Run(fmt.Sprintf("docker load -i %s", path))
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册