提交 2243847f 编写于 作者: M Medya Gh

add kic command runner to machine

上级 c627f58f
......@@ -315,8 +315,7 @@ func runStart(cmd *cobra.Command, args []string) {
exit.WithError("Failed to generate config", err)
}
fmt.Println("Got here")
if !driver.BareMetal(driverName) {
if !driver.BareMetal(driverName) && !driver.IsKIC(driverName) {
if err := cluster.CacheISO(config); err != nil {
exit.WithError("Failed to cache ISO", err)
}
......@@ -341,6 +340,7 @@ func runStart(cmd *cobra.Command, args []string) {
// exits here in case of --download-only option.
handleDownloadOnly(&cacheGroup, k8sVersion)
mRunner, preExists, machineAPI, host := startMachine(&config)
fmt.Println("After startMachine &config")
defer machineAPI.Close()
// configure the runtime (docker, containerd, crio)
cr := configureRuntimes(mRunner, driverName, config.KubernetesConfig)
......@@ -478,12 +478,16 @@ func startMachine(config *cfg.MachineConfig) (runner command.Runner, preExists b
exit.WithError("Failed to get machine client", err)
}
host, preExists = startHost(m, *config)
fmt.Println("after startHost(m, *config)")
runner, err = machine.CommandRunner(host)
if err != nil {
exit.WithError("Failed to get command runner", err)
}
fmt.Println("after machine.CommandRunner(host)")
ip := validateNetwork(host, runner)
fmt.Println("after validateNetwork")
// Bypass proxy for minikube's vm host ip
err = proxy.ExcludeIP(ip)
if err != nil {
......@@ -977,6 +981,12 @@ func autoSetDriverOptions(cmd *cobra.Command, drvName string) error {
glog.Infof("auto set container runtime to %s for kic driver.", hints.ContainerRuntime)
}
if !cmd.Flags().Changed("bootstrapper") && hints.Bootstrapper != "" {
viper.Set(cmdcfg.Bootstrapper, hints.Bootstrapper)
glog.Infof("auto set bootstrapper to %s for kic driver.", hints.Bootstrapper)
}
return nil
}
......
......@@ -90,7 +90,7 @@ func (d *Driver) Create() error {
_, err := node.CreateNode(params)
if err != nil {
return errors.Wrap(err, "create kic from spec")
return errors.Wrap(err, "create kic node")
}
return nil
}
......
......@@ -51,6 +51,7 @@ type Bootstrapper interface {
const (
// BootstrapperTypeKubeadm is the kubeadm bootstrapper type
BootstrapperTypeKubeadm = "kubeadm"
BootstrapperTypeKICBS = "kicbs"
)
// GetCachedBinaryList returns the list of binaries
......@@ -68,6 +69,8 @@ func GetCachedImageList(imageRepository string, version string, bootstrapper str
switch bootstrapper {
case BootstrapperTypeKubeadm:
return images.Kubeadm(imageRepository, version)
case BootstrapperTypeKICBS:
return []string{"alpine"}, nil // for testing purpose just caching alpine for kicbs
default:
return []string{}, nil
}
......
......@@ -22,6 +22,7 @@ import (
"sort"
"github.com/golang/glog"
"k8s.io/minikube/pkg/minikube/bootstrapper"
"k8s.io/minikube/pkg/minikube/registry"
)
......@@ -68,6 +69,11 @@ func Supported(name string) bool {
return false
}
// IsKIC checks if the driver is a kubernetes in continer
func IsKIC(name string) bool {
return name == KicDocker
}
// BareMetal returns if this driver is unisolated
func BareMetal(name string) bool {
return name == None || name == Mock
......@@ -78,6 +84,7 @@ type FlagHints struct {
ExtraOptions string
CacheImages bool
ContainerRuntime string
Bootstrapper string
}
// FlagDefaults returns suggested defaults based on a driver
......@@ -87,6 +94,7 @@ func FlagDefaults(name string) FlagHints {
// only for kic, till other run-times are available we auto-set containerd.
if name == KicDocker {
fh.ContainerRuntime = "containerd"
fh.Bootstrapper = bootstrapper.BootstrapperTypeKICBS
}
return fh
}
......
......@@ -153,6 +153,9 @@ func CommandRunner(h *host.Host) (command.Runner, error) {
if driver.BareMetal(h.Driver.DriverName()) {
return &command.ExecRunner{}, nil
}
if h.Driver.DriverName() == driver.KicDocker {
return command.NewKICRunner(h.Name, "docker"), nil
}
client, err := sshutil.NewSSHClient(h.Driver)
if err != nil {
return nil, errors.Wrap(err, "getting ssh client for bootstrapper")
......@@ -204,7 +207,7 @@ func (api *LocalClient) Create(h *host.Host) error {
{
"provisioning",
func() error {
if driver.BareMetal(h.Driver.DriverName()) {
if driver.BareMetal(h.Driver.DriverName()) || driver.IsKIC(h.Driver.DriverName()) {
return nil
}
pv := provision.NewBuildrootProvisioner(h.Driver)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册