@@ -105,7 +105,6 @@ const (
105105 dnsProxy = "dns-proxy"
106106 hostDNSResolver = "host-dns-resolver"
107107 waitComponents = "wait"
108- force = "force"
109108 dryRun = "dry-run"
110109 waitTimeout = "wait-timeout"
111110 nativeSSH = "native-ssh"
@@ -159,7 +158,7 @@ func initMinikubeFlags() {
159158 // e.g. iso-url => $ENVPREFIX_ISO_URL
160159 viper .SetEnvKeyReplacer (strings .NewReplacer ("-" , "_" ))
161160 viper .AutomaticEnv ()
162- startCmd .Flags ().Bool (force , false , "Force minikube to perform possibly dangerous operations" )
161+ startCmd .Flags ().Bool (flags . Force , false , "Force minikube to perform possibly dangerous operations" )
163162 startCmd .Flags ().Bool (flags .Interactive , true , "Allow user prompts for more information" )
164163 startCmd .Flags ().Bool (dryRun , false , "dry-run mode. Validates configuration, but does not mutate system state" )
165164
@@ -317,7 +316,7 @@ func ClusterFlagValue() string {
317316func generateClusterConfig (cmd * cobra.Command , existing * config.ClusterConfig , k8sVersion string , rtime string , drvName string , options * run.CommandOptions ) (config.ClusterConfig , config.Node , error ) {
318317 var cc config.ClusterConfig
319318 if existing != nil {
320- cc = updateExistingConfigFromFlags (cmd , existing )
319+ cc = updateExistingConfigFromFlags (cmd , existing , options )
321320
322321 // identify appropriate cni then configure cruntime accordingly
323322 if _ , err := cni .New (& cc ); err != nil {
@@ -382,7 +381,7 @@ func getCPUCount(drvName string) int {
382381 return si .CPUs
383382}
384383
385- func getMemorySize (cmd * cobra.Command , drvName string ) int {
384+ func getMemorySize (cmd * cobra.Command , drvName string , options * run. CommandOptions ) int {
386385 sysLimit , containerLimit , err := memoryLimits (drvName )
387386 if err != nil {
388387 klog .Warningf ("Unable to query memory limits: %+v" , err )
@@ -406,7 +405,7 @@ func getMemorySize(cmd *cobra.Command, drvName string) int {
406405 exit .Message (reason .Usage , "{{.driver_name}} has only {{.container_limit}}MB memory but you specified {{.specified_memory}}MB" , out.V {"container_limit" : containerLimit , "specified_memory" : mem , "driver_name" : driver .FullName (drvName )})
407406 }
408407 } else {
409- validateRequestedMemorySize (mem , drvName )
408+ validateRequestedMemorySize (mem , drvName , options )
410409 klog .Infof ("Using suggested %dMB memory alloc based on sys=%dMB, container=%dMB" , mem , sysLimit , containerLimit )
411410 }
412411
@@ -576,7 +575,7 @@ func generateNewConfigFromFlags(cmd *cobra.Command, k8sVersion string, rtime str
576575 KicBaseImage : viper .GetString (kicBaseImage ),
577576 Network : getNetwork (drvName , options ),
578577 Subnet : viper .GetString (subnet ),
579- Memory : getMemorySize (cmd , drvName ),
578+ Memory : getMemorySize (cmd , drvName , options ),
580579 CPUs : getCPUCount (drvName ),
581580 DiskSize : getDiskSize (),
582581 Driver : drvName ,
@@ -749,7 +748,7 @@ func checkNumaCount(k8sVersion string) {
749748}
750749
751750// upgradeExistingConfig upgrades legacy configuration files
752- func upgradeExistingConfig (cmd * cobra.Command , cc * config.ClusterConfig ) {
751+ func upgradeExistingConfig (cmd * cobra.Command , cc * config.ClusterConfig , options * run. CommandOptions ) {
753752 if cc == nil {
754753 return
755754 }
@@ -772,7 +771,7 @@ func upgradeExistingConfig(cmd *cobra.Command, cc *config.ClusterConfig) {
772771
773772 if cc .Memory == 0 && ! driver .IsKIC (cc .Driver ) {
774773 klog .Info ("Existing config file was missing memory. (could be an old minikube config), will use the default value" )
775- memInMB := getMemorySize (cmd , cc .Driver )
774+ memInMB := getMemorySize (cmd , cc .Driver , options )
776775 cc .Memory = memInMB
777776 }
778777
@@ -783,8 +782,8 @@ func upgradeExistingConfig(cmd *cobra.Command, cc *config.ClusterConfig) {
783782
784783// updateExistingConfigFromFlags will update the existing config from the flags - used on a second start
785784// skipping updating existing docker env, docker opt, InsecureRegistry, registryMirror, extra-config, apiserver-ips
786- func updateExistingConfigFromFlags (cmd * cobra.Command , existing * config.ClusterConfig ) config.ClusterConfig { //nolint to suppress cyclomatic complexity 45 of func `updateExistingConfigFromFlags` is high (> 30)
787- validateFlags (cmd , existing .Driver )
785+ func updateExistingConfigFromFlags (cmd * cobra.Command , existing * config.ClusterConfig , options * run. CommandOptions ) config.ClusterConfig { //nolint to suppress cyclomatic complexity 45 of func `updateExistingConfigFromFlags` is high (> 30)
786+ validateFlags (cmd , existing .Driver , options )
788787
789788 cc := * existing
790789
@@ -802,7 +801,7 @@ func updateExistingConfigFromFlags(cmd *cobra.Command, existing *config.ClusterC
802801 updateIntFromFlag (cmd , & cc .APIServerPort , apiServerPort )
803802 }
804803
805- if cmd .Flags ().Changed (memory ) && getMemorySize (cmd , cc .Driver ) != cc .Memory {
804+ if cmd .Flags ().Changed (memory ) && getMemorySize (cmd , cc .Driver , options ) != cc .Memory {
806805 out .WarningT ("You cannot change the memory size for an existing minikube cluster. Please first delete the cluster." )
807806 }
808807
@@ -811,7 +810,7 @@ func updateExistingConfigFromFlags(cmd *cobra.Command, existing *config.ClusterC
811810 }
812811
813812 // validate the memory size in case user changed their system memory limits (example change docker desktop or upgraded memory.)
814- validateRequestedMemorySize (cc .Memory , cc .Driver )
813+ validateRequestedMemorySize (cc .Memory , cc .Driver , options )
815814
816815 if cmd .Flags ().Changed (humanReadableDiskSize ) && getDiskSize () != existing .DiskSize {
817816 out .WarningT ("You cannot change the disk size for an existing minikube cluster. Please first delete the cluster." )
0 commit comments