Skip to content

Commit

Permalink
Added check to exit app and show error message if number of cpus
Browse files Browse the repository at this point in the history
is less than the minimum required.
  • Loading branch information
MaxKam committed Aug 15, 2019
1 parent 99f5771 commit e657120
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
5 changes: 5 additions & 0 deletions cmd/minikube/cmd/start.go
Original file line number Diff line number Diff line change
Expand Up @@ -536,6 +536,11 @@ func validateConfig() {
out.V{"memory": memorySizeMB, "default_memorysize": pkgutil.CalculateSizeInMB(constants.DefaultMemorySize)})
}

cpuCount = viper.GetInt(cpus)
if cpuCount < constants.MinimumCPUS {
exit.UsageT("Requested cpu count {{.requested_cpus}} is less than the minimum allowed of {{.minimum_cpus}}", out.V{"requested_cpus": cpuCount, "minimum_cpus": constants.MinimumCPUS})
}

// check that kubeadm extra args contain only whitelisted parameters
for param := range extraOptions.AsMap().Get(kubeadm.Kubeadm) {
if !pkgutil.ContainsString(kubeadm.KubeadmExtraArgsWhitelist[kubeadm.KubeadmCmdParam], param) &&
Expand Down
2 changes: 2 additions & 0 deletions pkg/minikube/constants/constants.go
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,8 @@ const (
MinimumMemorySize = "1024mb"
// DefaultCPUS is the default number of cpus of a host
DefaultCPUS = 2
// MinimumCPUS is the minimum number of cpus of a host
MinimumCPUS = 2
// DefaultDiskSize is the default disk image size, in megabytes
DefaultDiskSize = "20000mb"
// MinimumDiskSize is the minimum disk image size, in megabytes
Expand Down

0 comments on commit e657120

Please sign in to comment.