Move extract resources to its pkg

Move ExtractContainerResourceValue
This commit is contained in:
Harry Zhang
2017-02-07 22:19:49 +08:00
parent 81545c2922
commit efb10b1821
11 changed files with 252 additions and 262 deletions

View File

@@ -23,7 +23,6 @@ import (
"k8s.io/kubernetes/pkg/api"
"k8s.io/kubernetes/pkg/api/v1"
"k8s.io/kubernetes/pkg/fieldpath"
)
// defaultPodLimitsForDownwardApi copies the input pod, and optional container,
@@ -53,7 +52,7 @@ func (kl *Kubelet) defaultPodLimitsForDownwardApi(pod *v1.Pod, container *v1.Con
return nil, nil, fmt.Errorf("unexpected type returned from deep copy of pod object")
}
for idx := range outputPod.Spec.Containers {
fieldpath.MergeContainerResourceLimits(&outputPod.Spec.Containers[idx], allocatable)
v1.MergeContainerResourceLimits(&outputPod.Spec.Containers[idx], allocatable)
}
var outputContainer *v1.Container
@@ -66,7 +65,7 @@ func (kl *Kubelet) defaultPodLimitsForDownwardApi(pod *v1.Pod, container *v1.Con
if !ok {
return nil, nil, fmt.Errorf("unexpected type returned from deep copy of container object")
}
fieldpath.MergeContainerResourceLimits(outputContainer, allocatable)
v1.MergeContainerResourceLimits(outputContainer, allocatable)
}
return outputPod, outputContainer, nil
}