add auto-set container-runtime for kic

pull/6112/head
Medya Gh 2019-12-17 22:19:39 -08:00
parent 2bf1289bf3
commit b6dbf3bd0d
2 changed files with 16 additions and 3 deletions

View File

@ -969,6 +969,13 @@ func autoSetDriverOptions(cmd *cobra.Command, drvName string) error {
if !cmd.Flags().Changed(cacheImages) {
viper.Set(cacheImages, hints.CacheImages)
}
// currently only used for kic
if !cmd.Flags().Changed(containerRuntime) && hints.ContainerRuntime != "" {
viper.Set(containerRuntime, hints.ContainerRuntime)
glog.Infof("auto set container runtime to %s for kic driver.", hints.ContainerRuntime)
}
return nil
}

View File

@ -75,14 +75,20 @@ func BareMetal(name string) bool {
// FlagHints are hints for what default options should be used for this driver
type FlagHints struct {
ExtraOptions string
CacheImages bool
ExtraOptions string
CacheImages bool
ContainerRuntime string
}
// FlagDefaults returns suggested defaults based on a driver
func FlagDefaults(name string) FlagHints {
if name != None {
return FlagHints{CacheImages: true}
fh := FlagHints{CacheImages: true}
// only for kic, till other run-times are available we auto-set containerd.
if name == KicDocker {
fh.ContainerRuntime = "containerd"
}
return fh
}
extraOpts := ""