Fix stylistic isues with #5547. Closes #4910.

This commit is contained in:
David Oppenheimer
2015-05-18 15:32:32 -07:00
parent ce95c4920d
commit 44b1e1ca0c
9 changed files with 33 additions and 34 deletions

View File

@@ -142,13 +142,13 @@ func (r *ResourceFit) PodFitsResources(pod *api.Pod, existingPods []*api.Pod, no
return false, err
}
if podRequest.milliCPU == 0 && podRequest.memory == 0 {
return int64(len(existingPods)) < info.Status.Capacity.MaxPods().Value(), nil
return int64(len(existingPods)) < info.Status.Capacity.Pods().Value(), nil
}
pods := []*api.Pod{}
copy(pods, existingPods)
pods = append(existingPods, pod)
_, exceeding := CheckPodsExceedingCapacity(pods, info.Status.Capacity)
if len(exceeding) > 0 || int64(len(pods)) > info.Status.Capacity.MaxPods().Value() {
if len(exceeding) > 0 || int64(len(pods)) > info.Status.Capacity.Pods().Value() {
return false, nil
}
return true, nil

View File

@@ -44,12 +44,12 @@ func (nodes FakeNodeListInfo) GetNodeInfo(nodeName string) (*api.Node, error) {
return nil, fmt.Errorf("Unable to find node: %s", nodeName)
}
func makeResources(milliCPU int64, memory int64, maxPods int64) api.NodeResources {
func makeResources(milliCPU int64, memory int64, pods int64) api.NodeResources {
return api.NodeResources{
Capacity: api.ResourceList{
"cpu": *resource.NewMilliQuantity(milliCPU, resource.DecimalSI),
"memory": *resource.NewQuantity(memory, resource.BinarySI),
"maxpods": *resource.NewQuantity(maxPods, resource.DecimalSI),
api.ResourceCPU: *resource.NewMilliQuantity(milliCPU, resource.DecimalSI),
api.ResourceMemory: *resource.NewQuantity(memory, resource.BinarySI),
api.ResourcePods: *resource.NewQuantity(pods, resource.DecimalSI),
},
}
}
@@ -60,8 +60,8 @@ func newResourcePod(usage ...resourceRequest) *api.Pod {
containers = append(containers, api.Container{
Resources: api.ResourceRequirements{
Limits: api.ResourceList{
"cpu": *resource.NewMilliQuantity(req.milliCPU, resource.DecimalSI),
"memory": *resource.NewQuantity(req.memory, resource.BinarySI),
api.ResourceCPU: *resource.NewMilliQuantity(req.milliCPU, resource.DecimalSI),
api.ResourceMemory: *resource.NewQuantity(req.memory, resource.BinarySI),
},
},
})