Skip to content

Commit

Permalink
Merge pull request #5845 from tstromberg/none-memory
Browse files Browse the repository at this point in the history
none driver: Warn about --cpus, --memory, and --container-runtime settings
  • Loading branch information
tstromberg authored Nov 7, 2019
2 parents 1d1b148 + 0af762e commit 79fcf71
Showing 1 changed file with 14 additions and 3 deletions.
17 changes: 14 additions & 3 deletions cmd/minikube/cmd/start.go
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,6 @@ func init() {
if err := viper.BindPFlags(startCmd.Flags()); err != nil {
exit.WithError("unable to bind flags", err)
}

}

// initMinikubeFlags includes commandline flags for minikube.
Expand Down Expand Up @@ -296,7 +295,7 @@ func runStart(cmd *cobra.Command, args []string) {
glog.Errorf("Error autoSetOptions : %v", err)
}

validateFlags(driverName)
validateFlags(cmd, driverName)
validateUser(driverName)

// No need to install a driver in download-only mode
Expand Down Expand Up @@ -721,7 +720,7 @@ func validateUser(drvName string) {
}

// validateFlags validates the supplied flags against known bad combinations
func validateFlags(drvName string) {
func validateFlags(cmd *cobra.Command, drvName string) {
diskSizeMB := pkgutil.CalculateSizeInMB(viper.GetString(humanReadableDiskSize))
if diskSizeMB < pkgutil.CalculateSizeInMB(minimumDiskSize) && !viper.GetBool(force) {
exit.WithCodeT(exit.Config, "Requested disk size {{.requested_size}} is less than minimum of {{.minimum_size}}", out.V{"requested_size": diskSizeMB, "minimum_size": pkgutil.CalculateSizeInMB(minimumDiskSize)})
Expand All @@ -742,6 +741,18 @@ func validateFlags(drvName string) {
exit.WithCodeT(exit.Config, "The 'none' driver does not support multiple profiles: https://minikube.sigs.k8s.io/docs/reference/drivers/none/")
}

if cmd.Flags().Changed(cpus) {
out.WarningT("The 'none' driver does not respect the --cpus flag")
}
if cmd.Flags().Changed(memory) {
out.WarningT("The 'none' driver does not respect the --memory flag")
}

runtime := viper.GetString(containerRuntime)
if runtime != "docker" {
out.WarningT("Using the '{{.runtime}}' runtime with the 'none' driver is an untested configuration!", out.V{"runtime": runtime})
}

// Uses the gopsutil cpu package to count the number of physical cpu cores
ci, err := cpu.Counts(false)
if err != nil {
Expand Down

0 comments on commit 79fcf71

Please sign in to comment.