replace addonList variable with viper provided data
Signed-off-by: Utkarsh Srivastava <srivastavautkarsh8097@gmail.com>pull/11469/head
parent
316f5ea3b2
commit
5a3843b074
|
@ -147,7 +147,7 @@ func initMinikubeFlags() {
|
||||||
startCmd.Flags().String(containerRuntime, constants.DefaultContainerRuntime, fmt.Sprintf("The container runtime to be used (%s).", strings.Join(cruntime.ValidRuntimes(), ", ")))
|
startCmd.Flags().String(containerRuntime, constants.DefaultContainerRuntime, fmt.Sprintf("The container runtime to be used (%s).", strings.Join(cruntime.ValidRuntimes(), ", ")))
|
||||||
startCmd.Flags().Bool(createMount, false, "This will start the mount daemon and automatically mount files into minikube.")
|
startCmd.Flags().Bool(createMount, false, "This will start the mount daemon and automatically mount files into minikube.")
|
||||||
startCmd.Flags().String(mountString, constants.DefaultMountDir+":/minikube-host", "The argument to pass the minikube mount command on start.")
|
startCmd.Flags().String(mountString, constants.DefaultMountDir+":/minikube-host", "The argument to pass the minikube mount command on start.")
|
||||||
startCmd.Flags().StringSliceVar(&config.AddonList, "addons", nil, "Enable addons. see `minikube addons list` for a list of valid addon names.")
|
startCmd.Flags().StringSlice(config.AddonListName, nil, "Enable addons. see `minikube addons list` for a list of valid addon names.")
|
||||||
startCmd.Flags().String(criSocket, "", "The cri socket path to be used.")
|
startCmd.Flags().String(criSocket, "", "The cri socket path to be used.")
|
||||||
startCmd.Flags().String(networkPlugin, "", "Kubelet network plug-in to use (default: auto)")
|
startCmd.Flags().String(networkPlugin, "", "Kubelet network plug-in to use (default: auto)")
|
||||||
startCmd.Flags().Bool(enableDefaultCNI, false, "DEPRECATED: Replaced by --cni=bridge")
|
startCmd.Flags().Bool(enableDefaultCNI, false, "DEPRECATED: Replaced by --cni=bridge")
|
||||||
|
|
|
@ -20,6 +20,7 @@ import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"strconv"
|
"strconv"
|
||||||
|
|
||||||
|
"github.com/spf13/viper"
|
||||||
"k8s.io/minikube/pkg/minikube/assets"
|
"k8s.io/minikube/pkg/minikube/assets"
|
||||||
"k8s.io/minikube/pkg/minikube/config"
|
"k8s.io/minikube/pkg/minikube/config"
|
||||||
"k8s.io/minikube/pkg/minikube/cruntime"
|
"k8s.io/minikube/pkg/minikube/cruntime"
|
||||||
|
@ -63,7 +64,8 @@ func IsVolumesnapshotsEnabled(cc *config.ClusterConfig, _, value string) error {
|
||||||
isCsiDriverEnabled, _ := strconv.ParseBool(value)
|
isCsiDriverEnabled, _ := strconv.ParseBool(value)
|
||||||
// assets.Addons[].IsEnabled() returns the current status of the addon or default value.
|
// assets.Addons[].IsEnabled() returns the current status of the addon or default value.
|
||||||
// config.AddonList contains list of addons to be enabled.
|
// config.AddonList contains list of addons to be enabled.
|
||||||
isVolumesnapshotsEnabled := assets.Addons[volumesnapshotsAddon].IsEnabled(cc) || contains(config.AddonList, volumesnapshotsAddon)
|
addonList := viper.GetStringSlice(config.AddonListName)
|
||||||
|
isVolumesnapshotsEnabled := assets.Addons[volumesnapshotsAddon].IsEnabled(cc) || contains(addonList, volumesnapshotsAddon)
|
||||||
if isCsiDriverEnabled && !isVolumesnapshotsEnabled {
|
if isCsiDriverEnabled && !isVolumesnapshotsEnabled {
|
||||||
// just print out a warning directly, we don't want to return any errors since
|
// just print out a warning directly, we don't want to return any errors since
|
||||||
// that would prevent the addon from being enabled (callbacks wouldn't be run)
|
// that would prevent the addon from being enabled (callbacks wouldn't be run)
|
||||||
|
|
|
@ -56,6 +56,8 @@ const (
|
||||||
AddonImages = "addon-images"
|
AddonImages = "addon-images"
|
||||||
// AddonRegistries stores custom addon images config
|
// AddonRegistries stores custom addon images config
|
||||||
AddonRegistries = "addon-registries"
|
AddonRegistries = "addon-registries"
|
||||||
|
// AddonListName represents the key for addons parameter
|
||||||
|
AddonListName = "addons"
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
|
@ -67,8 +69,6 @@ var (
|
||||||
DockerOpt []string
|
DockerOpt []string
|
||||||
// ExtraOptions contains extra options (if any)
|
// ExtraOptions contains extra options (if any)
|
||||||
ExtraOptions ExtraOptionSlice
|
ExtraOptions ExtraOptionSlice
|
||||||
// AddonList contains the list of addons
|
|
||||||
AddonList []string
|
|
||||||
)
|
)
|
||||||
|
|
||||||
// ErrNotExist is the error returned when a config does not exist
|
// ErrNotExist is the error returned when a config does not exist
|
||||||
|
|
|
@ -171,12 +171,13 @@ func Start(starter Starter, apiServer bool) (*kubeconfig.Settings, error) {
|
||||||
}()
|
}()
|
||||||
|
|
||||||
// enable addons, both old and new!
|
// enable addons, both old and new!
|
||||||
|
addonList := viper.GetStringSlice(config.AddonListName)
|
||||||
if starter.ExistingAddons != nil {
|
if starter.ExistingAddons != nil {
|
||||||
if viper.GetBool("force") {
|
if viper.GetBool("force") {
|
||||||
addons.Force = true
|
addons.Force = true
|
||||||
}
|
}
|
||||||
wg.Add(1)
|
wg.Add(1)
|
||||||
go addons.Start(&wg, starter.Cfg, starter.ExistingAddons, config.AddonList)
|
go addons.Start(&wg, starter.Cfg, starter.ExistingAddons, addonList)
|
||||||
}
|
}
|
||||||
|
|
||||||
if apiServer {
|
if apiServer {
|
||||||
|
|
Loading…
Reference in New Issue