mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-23 03:41:45 +00:00
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:
commit
6a61a1b4bd
@ -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 {
|
||||||
|
Loading…
Reference in New Issue
Block a user