Merge pull request #12035 from AnanyaKumar/requests
Add support for request
This commit is contained in:
@@ -171,6 +171,19 @@ func addDefaultingFuncs() {
|
||||
obj.APIVersion = "v1"
|
||||
}
|
||||
},
|
||||
func(obj *ResourceRequirements) {
|
||||
// Set requests to limits if requests are not specified (but limits are).
|
||||
if obj.Limits != nil {
|
||||
if obj.Requests == nil {
|
||||
obj.Requests = make(ResourceList)
|
||||
}
|
||||
for key, value := range obj.Limits {
|
||||
if _, exists := obj.Requests[key]; !exists {
|
||||
obj.Requests[key] = *(value.Copy())
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
)
|
||||
}
|
||||
|
||||
|
@@ -656,13 +656,12 @@ type Capabilities struct {
|
||||
|
||||
// ResourceRequirements describes the compute resource requirements.
|
||||
type ResourceRequirements struct {
|
||||
// Limits describes the maximum amount of compute resources required.
|
||||
// Limits describes the maximum amount of compute resources allowed.
|
||||
Limits ResourceList `json:"limits,omitempty" description:"Maximum amount of compute resources allowed; see http://releases.k8s.io/HEAD/docs/design/resources.md#resource-specifications"`
|
||||
// Requests describes the minimum amount of compute resources required.
|
||||
// Note: 'Requests' are honored only for Persistent Volumes as of now.
|
||||
// TODO: Update the scheduler to use 'Requests' in addition to 'Limits'. If Request is omitted for a container,
|
||||
// it defaults to Limits if that is explicitly specified, otherwise to an implementation-defined value
|
||||
Requests ResourceList `json:"requests,omitempty" description:"Minimum amount of resources requested; requests are honored only for persistent volumes as of now; see http://releases.k8s.io/HEAD/docs/design/resources.md#resource-specifications"`
|
||||
// If Requests is omitted for a container, it defaults to Limits if that is explicitly specified,
|
||||
// otherwise to an implementation-defined value.
|
||||
Requests ResourceList `json:"requests,omitempty" description:"Minimum amount of resources requested; if Requests is omitted for a container, it defaults to Limits if that is explicitly specified, otherwise to an implementation-defined value; see http://releases.k8s.io/HEAD/docs/design/resources.md#resource-specifications"`
|
||||
}
|
||||
|
||||
const (
|
||||
|
Reference in New Issue
Block a user