Skip to content

Commit

Permalink
koord-scheduler: ElasticQuota skips reserve pod in PostFilter phase (#…
Browse files Browse the repository at this point in the history
…1125)

Signed-off-by: Joseph <joseph.t.lee@outlook.com>
  • Loading branch information
eahydra committed Mar 21, 2023
1 parent c89fc3b commit 2146ad5
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions pkg/scheduler/plugins/elasticquota/plugin.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ import (
"github.com/koordinator-sh/koordinator/pkg/scheduler/frameworkext"
frameworkexthelper "github.com/koordinator-sh/koordinator/pkg/scheduler/frameworkext/helper"
"github.com/koordinator-sh/koordinator/pkg/scheduler/plugins/elasticquota/core"
reservationutil "github.com/koordinator-sh/koordinator/pkg/util/reservation"
)

const (
Expand Down Expand Up @@ -192,8 +193,11 @@ func (g *Plugin) PreFilterExtensions() framework.PreFilterExtensions {

// AddPod is called by the framework while trying to evaluate the impact
// of adding podToAdd to the node while scheduling podToSchedule.
func (g *Plugin) AddPod(ctx context.Context, state *framework.CycleState, podToSchedule *corev1.Pod,
podInfoToAdd *framework.PodInfo, nodeInfo *framework.NodeInfo) *framework.Status {
func (g *Plugin) AddPod(ctx context.Context, state *framework.CycleState, podToSchedule *corev1.Pod, podInfoToAdd *framework.PodInfo, nodeInfo *framework.NodeInfo) *framework.Status {
if reservationutil.IsReservePod(podInfoToAdd.Pod) {
return nil
}

postFilterState, err := getPostFilterState(state)
if err != nil {
klog.ErrorS(err, "Failed to read postFilterState from cycleState", "elasticQuotaSnapshotKey", postFilterState)
Expand All @@ -211,8 +215,11 @@ func (g *Plugin) AddPod(ctx context.Context, state *framework.CycleState, podToS

// RemovePod is called by the framework while trying to evaluate the impact
// of removing podToRemove from the node while scheduling podToSchedule.
func (g *Plugin) RemovePod(ctx context.Context, state *framework.CycleState, podToSchedule *corev1.Pod,
podInfoToRemove *framework.PodInfo, nodeInfo *framework.NodeInfo) *framework.Status {
func (g *Plugin) RemovePod(ctx context.Context, state *framework.CycleState, podToSchedule *corev1.Pod, podInfoToRemove *framework.PodInfo, nodeInfo *framework.NodeInfo) *framework.Status {
if reservationutil.IsReservePod(podInfoToRemove.Pod) {
return nil
}

postFilterState, err := getPostFilterState(state)
if err != nil {
klog.ErrorS(err, "Failed to read postFilterState from cycleState", "elasticQuotaSnapshotKey", postFilterState)
Expand Down

0 comments on commit 2146ad5

Please sign in to comment.