Skip to content

Commit 78d2e52

Browse files
authored
Merge pull request kubernetes#84859 from denkensk/move-volumebind-behind-permit
Move pod bindVolumes behind RunPermitPlugins
2 parents 979688b + c9fda7a commit 78d2e52

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

pkg/scheduler/scheduler.go

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -690,18 +690,6 @@ func (sched *Scheduler) scheduleOne(ctx context.Context) {
690690
metrics.SchedulerGoroutines.WithLabelValues("binding").Inc()
691691
defer metrics.SchedulerGoroutines.WithLabelValues("binding").Dec()
692692

693-
// Bind volumes first before Pod
694-
if !allBound {
695-
err := sched.bindVolumes(assumedPod)
696-
if err != nil {
697-
sched.recordSchedulingFailure(assumedPodInfo, err, "VolumeBindingFailed", err.Error())
698-
metrics.PodScheduleErrors.Inc()
699-
// trigger un-reserve plugins to clean up state associated with the reserved Pod
700-
fwk.RunUnreservePlugins(bindingCycleCtx, state, assumedPod, scheduleResult.SuggestedHost)
701-
return
702-
}
703-
}
704-
705693
// Run "permit" plugins.
706694
permitStatus := fwk.RunPermitPlugins(bindingCycleCtx, state, assumedPod, scheduleResult.SuggestedHost)
707695
if !permitStatus.IsSuccess() {
@@ -722,6 +710,18 @@ func (sched *Scheduler) scheduleOne(ctx context.Context) {
722710
return
723711
}
724712

713+
// Bind volumes first before Pod
714+
if !allBound {
715+
err := sched.bindVolumes(assumedPod)
716+
if err != nil {
717+
sched.recordSchedulingFailure(assumedPodInfo, err, "VolumeBindingFailed", err.Error())
718+
metrics.PodScheduleErrors.Inc()
719+
// trigger un-reserve plugins to clean up state associated with the reserved Pod
720+
fwk.RunUnreservePlugins(bindingCycleCtx, state, assumedPod, scheduleResult.SuggestedHost)
721+
return
722+
}
723+
}
724+
725725
// Run "prebind" plugins.
726726
preBindStatus := fwk.RunPreBindPlugins(bindingCycleCtx, state, assumedPod, scheduleResult.SuggestedHost)
727727
if !preBindStatus.IsSuccess() {

0 commit comments

Comments
 (0)