-
Notifications
You must be signed in to change notification settings - Fork 4.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Minimum CPUs check #5086
Minimum CPUs check #5086
Conversation
Welcome @MaxKam! |
Hi @MaxKam. Thanks for your PR. I'm waiting for a kubernetes member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: MaxKam The full list of commands accepted by this bot can be found here.
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
Can one of the admins verify this patch? |
@minikube-bot OK to test |
@@ -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}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This check looks great, but to fully resolve the issue, there is an additional complication: The none
driver doesn't respect the value of --cpus
, as it is not possible to programatically add a CPU to a physical machine.
This check will need an extra step, something like:
import "github.com/shirou/gopsutil/cpu"
if viper.GetString(vmDriver) == constants.DriverNone {
ci, err := cpu.Info()
if err == nil {
glog.Warningf("Unable to get CPU info: %v", err)
} else {
cpuCount = ci.Cores
}
For what it's worth, the memory check suffers the same issue, but I'm not sure what the appropriate API is to solve it, so I won't ask you to do so =)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
constants.MinimumCPUS
This should probably tie in with the Bootstrapper
somehow ?
Since the requirement comes from kubeadm
rather than k8s
https://github.com/kubernetes/kubernetes/blob/v1.15.2/cmd/kubeadm/app/constants/constants.go#L353
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@tstromberg Hows this? 1217054
@afbjorklund sorry I'm not quite sure what you want me to change.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
afbjorklund was remarking that our minimum memory and CPU core requirements may change in the future depending on the bootstrapper used. For instance, k3s won't require two cores.
I'm OK with deferring per-bootstrapper requirements until we have two with different requirements.
@minikube-bot OK to test |
|
Travis tests have failedHey @MaxKam, 1st Buildmake test
TravisBuddy Request Identifier: 56b8c8d0-c510-11e9-8712-75d78f9b457f |
is less than the minimum required.
Gopsutil packae doesn't automatically return a count of CPU cores, have to use the Counts function.
6cde7c1
to
4831b48
Compare
@tstromberg |
Closes #5010
Checks to make sure the number of cpus on host is not less than minimum required. Exits app and outputs error message if number is less than the minimum required.
@tstromberg