Commit 6a61a1b4 authored by k8s-merge-robot's avatar k8s-merge-robot Committed by GitHub

Merge pull request #29775 from ZTE-PaaS/zhangke-patch-012

Automatic merge from submit-queue pods which can not be admitted should return directly if the pod can not be admitted, the code runPod(pod, retryDelay) should not be run.
parents ad0a44ea e48f9959
...@@ -73,18 +73,20 @@ func (kl *Kubelet) runOnce(pods []*api.Pod, retryDelay time.Duration) (results [ ...@@ -73,18 +73,20 @@ func (kl *Kubelet) runOnce(pods []*api.Pod, retryDelay time.Duration) (results [
// Check if we can admit the pod. // Check if we can admit the pod.
if ok, reason, message := kl.canAdmitPod(admitted, pod); !ok { if ok, reason, message := kl.canAdmitPod(admitted, pod); !ok {
kl.rejectPod(pod, reason, message) kl.rejectPod(pod, reason, message)
} else { results = append(results, RunPodResult{pod, nil})
admitted = append(admitted, pod) continue
} }
admitted = append(admitted, pod)
go func(pod *api.Pod) { go func(pod *api.Pod) {
err := kl.runPod(pod, retryDelay) err := kl.runPod(pod, retryDelay)
ch <- RunPodResult{pod, err} ch <- RunPodResult{pod, err}
}(pod) }(pod)
} }
glog.Infof("waiting for %d pods", len(pods)) glog.Infof("Waiting for %d pods", len(admitted))
failedPods := []string{} failedPods := []string{}
for i := 0; i < len(pods); i++ { for i := 0; i < len(admitted); i++ {
res := <-ch res := <-ch
results = append(results, res) results = append(results, res)
if res.Err != nil { if res.Err != nil {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment