mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-27 05:27:21 +00:00
skip schedule deleting pod
Signed-off-by: forrestchen <forrestchen@tencent.com> skip schedule deleting pod Signed-off-by: forrestchen <forrestchen@tencent.com>
This commit is contained in:
parent
5356a16f01
commit
e2a465ae68
@ -123,6 +123,11 @@ func (s *Scheduler) Run() {
|
|||||||
|
|
||||||
func (s *Scheduler) scheduleOne() {
|
func (s *Scheduler) scheduleOne() {
|
||||||
pod := s.config.NextPod()
|
pod := s.config.NextPod()
|
||||||
|
if pod.DeletionTimestamp != nil {
|
||||||
|
s.config.Recorder.Eventf(pod, v1.EventTypeWarning, "FailedScheduling", "skip schedule deleting pod: %v/%v", pod.Namespace, pod.Name)
|
||||||
|
glog.V(3).Infof("Skip schedule deleting pod: %v/%v", pod.Namespace, pod.Name)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
glog.V(3).Infof("Attempting to schedule pod: %v/%v", pod.Namespace, pod.Name)
|
glog.V(3).Infof("Attempting to schedule pod: %v/%v", pod.Namespace, pod.Name)
|
||||||
start := time.Now()
|
start := time.Now()
|
||||||
|
@ -59,6 +59,16 @@ func podWithID(id, desiredHost string) *v1.Pod {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func deletingPod(id string) *v1.Pod {
|
||||||
|
deletionTimestamp := metav1.Now()
|
||||||
|
return &v1.Pod{
|
||||||
|
ObjectMeta: metav1.ObjectMeta{Name: id, SelfLink: testapi.Default.SelfLink("pods", id), DeletionTimestamp: &deletionTimestamp},
|
||||||
|
Spec: v1.PodSpec{
|
||||||
|
NodeName: "",
|
||||||
|
},
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
func podWithPort(id, desiredHost string, port int) *v1.Pod {
|
func podWithPort(id, desiredHost string, port int) *v1.Pod {
|
||||||
pod := podWithID(id, desiredHost)
|
pod := podWithID(id, desiredHost)
|
||||||
pod.Spec.Containers = []v1.Container{
|
pod.Spec.Containers = []v1.Container{
|
||||||
@ -122,6 +132,10 @@ func TestScheduler(t *testing.T) {
|
|||||||
expectError: errB,
|
expectError: errB,
|
||||||
expectErrorPod: podWithID("foo", ""),
|
expectErrorPod: podWithID("foo", ""),
|
||||||
eventReason: "FailedScheduling",
|
eventReason: "FailedScheduling",
|
||||||
|
}, {
|
||||||
|
sendPod: deletingPod("foo"),
|
||||||
|
algo: mockScheduler{"", nil},
|
||||||
|
eventReason: "FailedScheduling",
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user