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.
This commit is contained in:
k8s-merge-robot 2016-08-02 03:11:10 -07:00 committed by GitHub
commit 6a61a1b4bd

View File

@ -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 {