Add feature flag for cache-images
parent
ac65b58363
commit
3fb711c8ea
|
@ -66,6 +66,7 @@ const (
|
|||
dnsDomain = "dns-domain"
|
||||
mountString = "mount-string"
|
||||
disableDriverMounts = "disable-driver-mounts"
|
||||
cacheImages = "cache-images"
|
||||
)
|
||||
|
||||
var (
|
||||
|
@ -86,7 +87,10 @@ assumes you have already installed one of the VM drivers: virtualbox/vmwarefusio
|
|||
}
|
||||
|
||||
func runStart(cmd *cobra.Command, args []string) {
|
||||
go machine.CacheImagesForBootstrapper(viper.GetString(cmdcfg.Bootstrapper))
|
||||
shouldCacheImages := viper.GetBool(cacheImages)
|
||||
if shouldCacheImages {
|
||||
go machine.CacheImagesForBootstrapper(viper.GetString(cmdcfg.Bootstrapper))
|
||||
}
|
||||
api, err := machine.NewAPIClient()
|
||||
if err != nil {
|
||||
fmt.Fprintf(os.Stderr, "Error getting client: %s\n", err)
|
||||
|
@ -179,15 +183,16 @@ func runStart(cmd *cobra.Command, args []string) {
|
|||
}
|
||||
|
||||
kubernetesConfig := bootstrapper.KubernetesConfig{
|
||||
KubernetesVersion: selectedKubernetesVersion,
|
||||
NodeIP: ip,
|
||||
NodeName: cfg.GetMachineName(),
|
||||
APIServerName: viper.GetString(apiServerName),
|
||||
DNSDomain: viper.GetString(dnsDomain),
|
||||
FeatureGates: viper.GetString(featureGates),
|
||||
ContainerRuntime: viper.GetString(containerRuntime),
|
||||
NetworkPlugin: viper.GetString(networkPlugin),
|
||||
ExtraOptions: extraOptions,
|
||||
KubernetesVersion: selectedKubernetesVersion,
|
||||
NodeIP: ip,
|
||||
NodeName: cfg.GetMachineName(),
|
||||
APIServerName: viper.GetString(apiServerName),
|
||||
DNSDomain: viper.GetString(dnsDomain),
|
||||
FeatureGates: viper.GetString(featureGates),
|
||||
ContainerRuntime: viper.GetString(containerRuntime),
|
||||
NetworkPlugin: viper.GetString(networkPlugin),
|
||||
ExtraOptions: extraOptions,
|
||||
ShouldLoadCachedImages: shouldCacheImages,
|
||||
}
|
||||
|
||||
clusterBootstrapper, err := GetClusterBootstrapper(api, viper.GetString(cmdcfg.Bootstrapper))
|
||||
|
@ -356,6 +361,7 @@ func init() {
|
|||
startCmd.Flags().String(containerRuntime, "", "The container runtime to be used")
|
||||
startCmd.Flags().String(networkPlugin, "", "The name of the network plugin")
|
||||
startCmd.Flags().String(featureGates, "", "A set of key=value pairs that describe feature gates for alpha/experimental features.")
|
||||
startCmd.Flags().Bool(cacheImages, true, "If true, cache docker images for the current bootstrapper and load them into the machine.")
|
||||
startCmd.Flags().Var(&extraOptions, "extra-config",
|
||||
`A set of key=value pairs that describe configuration that may be passed to different components.
|
||||
The key should be '.' separated, and the first part before the dot is the component to apply the configuration to.
|
||||
|
|
|
@ -42,6 +42,8 @@ type KubernetesConfig struct {
|
|||
NetworkPlugin string
|
||||
FeatureGates string
|
||||
ExtraOptions util.ExtraOptionSlice
|
||||
|
||||
ShouldLoadCachedImages bool
|
||||
}
|
||||
|
||||
const (
|
||||
|
|
|
@ -106,8 +106,11 @@ func (lk *LocalkubeBootstrapper) RestartCluster(kubernetesConfig bootstrapper.Ku
|
|||
}
|
||||
|
||||
func (lk *LocalkubeBootstrapper) UpdateCluster(config bootstrapper.KubernetesConfig) error {
|
||||
// Make best effort to load any cached images
|
||||
go machine.LoadImages(lk.cmd, constants.LocalkubeCachedImages, constants.ImageCacheDir)
|
||||
if config.ShouldLoadCachedImages {
|
||||
// Make best effort to load any cached images
|
||||
go machine.LoadImages(lk.cmd, constants.LocalkubeCachedImages, constants.ImageCacheDir)
|
||||
|
||||
}
|
||||
|
||||
copyableFiles := []assets.CopyableFile{}
|
||||
var localkubeFile assets.CopyableFile
|
||||
|
|
Loading…
Reference in New Issue