mirror of https://github.com/k3s-io/k3s
Merge pull request #47327 from xingzhou/remove-error
Automatic merge from submit-queue (batch tested with PRs 47327, 48194) Remove useless error While doing https://github.com/kubernetes/kubernetes/pull/44898, found an useless return error. **Release note**: ``` None ```pull/6/head
commit
67da2da32f
|
@ -27,7 +27,7 @@ import (
|
|||
|
||||
// PodRequestsAndLimits returns a dictionary of all defined resources summed up for all
|
||||
// containers of the pod.
|
||||
func PodRequestsAndLimits(pod *v1.Pod) (reqs map[v1.ResourceName]resource.Quantity, limits map[v1.ResourceName]resource.Quantity, err error) {
|
||||
func PodRequestsAndLimits(pod *v1.Pod) (reqs map[v1.ResourceName]resource.Quantity, limits map[v1.ResourceName]resource.Quantity) {
|
||||
reqs, limits = map[v1.ResourceName]resource.Quantity{}, map[v1.ResourceName]resource.Quantity{}
|
||||
for _, container := range pod.Spec.Containers {
|
||||
for name, quantity := range container.Resources.Requests {
|
||||
|
|
|
@ -86,10 +86,7 @@ func MilliCPUToShares(milliCPU int64) int64 {
|
|||
// ResourceConfigForPod takes the input pod and outputs the cgroup resource config.
|
||||
func ResourceConfigForPod(pod *v1.Pod) *ResourceConfig {
|
||||
// sum requests and limits.
|
||||
reqs, limits, err := resource.PodRequestsAndLimits(pod)
|
||||
if err != nil {
|
||||
return &ResourceConfig{}
|
||||
}
|
||||
reqs, limits := resource.PodRequestsAndLimits(pod)
|
||||
|
||||
cpuRequests := int64(0)
|
||||
cpuLimits := int64(0)
|
||||
|
|
|
@ -148,10 +148,7 @@ func (m *qosContainerManagerImpl) setCPUCgroupConfig(configs map[v1.PodQOSClass]
|
|||
// we only care about the burstable qos tier
|
||||
continue
|
||||
}
|
||||
req, _, err := resource.PodRequestsAndLimits(pod)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
req, _ := resource.PodRequestsAndLimits(pod)
|
||||
if request, found := req[v1.ResourceCPU]; found {
|
||||
burstablePodCPURequest += request.MilliValue()
|
||||
}
|
||||
|
@ -188,11 +185,7 @@ func (m *qosContainerManagerImpl) setMemoryReserve(configs map[v1.PodQOSClass]*C
|
|||
// limits are not set for Best Effort pods
|
||||
continue
|
||||
}
|
||||
req, _, err := resource.PodRequestsAndLimits(pod)
|
||||
if err != nil {
|
||||
glog.V(2).Infof("[Container Manager] Pod resource requests/limits could not be determined. Not setting QOS memory limts.")
|
||||
return
|
||||
}
|
||||
req, _ := resource.PodRequestsAndLimits(pod)
|
||||
if request, found := req[v1.ResourceMemory]; found {
|
||||
podMemoryRequest += request.Value()
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue