Skip to content

Commit 3e07731

Browse files
committed
Added check to exit app and show error message if number of cpus
is less than the minimum required.
1 parent cebaad1 commit 3e07731

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

cmd/minikube/cmd/start.go

+5
Original file line numberDiff line numberDiff line change
@@ -538,6 +538,11 @@ func validateConfig() {
538538
out.V{"memory": memorySizeMB, "default_memorysize": pkgutil.CalculateSizeInMB(constants.DefaultMemorySize)})
539539
}
540540

541+
cpuCount = viper.GetInt(cpus)
542+
if cpuCount < constants.MinimumCPUS {
543+
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})
544+
}
545+
541546
// check that kubeadm extra args contain only whitelisted parameters
542547
for param := range extraOptions.AsMap().Get(kubeadm.Kubeadm) {
543548
if !cfg.ContainsParam(kubeadm.KubeadmExtraArgsWhitelist[kubeadm.KubeadmCmdParam], param) &&

pkg/minikube/constants/constants.go

+2
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,8 @@ const (
141141
MinimumMemorySize = "1024mb"
142142
// DefaultCPUS is the default number of cpus of a host
143143
DefaultCPUS = 2
144+
// MinimumCPUS is the minimum number of cpus of a host
145+
MinimumCPUS = 2
144146
// DefaultDiskSize is the default disk image size, in megabytes
145147
DefaultDiskSize = "20000mb"
146148
// MinimumDiskSize is the minimum disk image size, in megabytes

0 commit comments

Comments
 (0)