-
Notifications
You must be signed in to change notification settings - Fork 40k
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
NVIDIA GPU support #24836
NVIDIA GPU support #24836
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2464,6 +2464,7 @@ func validateBasicResource(quantity resource.Quantity, fldPath *field.Path) fiel | |
func ValidateResourceRequirements(requirements *api.ResourceRequirements, fldPath *field.Path) field.ErrorList { | ||
allErrs := field.ErrorList{} | ||
limPath := fldPath.Child("limits") | ||
reqPath := fldPath.Child("requests") | ||
for resourceName, quantity := range requirements.Limits { | ||
fldPath := limPath.Key(string(resourceName)) | ||
// Validate resource name. | ||
|
@@ -2474,12 +2475,14 @@ func ValidateResourceRequirements(requirements *api.ResourceRequirements, fldPat | |
// Check that request <= limit. | ||
requestQuantity, exists := requirements.Requests[resourceName] | ||
if exists { | ||
if quantity.Cmp(requestQuantity) < 0 { | ||
// For GPUs, require that no request be set. | ||
if resourceName == api.ResourceNvidiaGPU { | ||
allErrs = append(allErrs, field.Invalid(reqPath, requestQuantity.String(), "cannot be set")) | ||
} else if quantity.Cmp(requestQuantity) < 0 { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. should we also add There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't think this is necessary. We would not, for example, validate that your ram is smaller than the largest ram machine. |
||
allErrs = append(allErrs, field.Invalid(fldPath, quantity.String(), "must be greater than or equal to request")) | ||
} | ||
} | ||
} | ||
reqPath := fldPath.Child("requests") | ||
for resourceName, quantity := range requirements.Requests { | ||
fldPath := reqPath.Key(string(resourceName)) | ||
// Validate resource name. | ||
|
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.
I didn't understand this comment. The resource is integer GPUs, not milliGPUs, so how can you specify fractional?