diff --git a/internal/scheduler/jobdb/job.go b/internal/scheduler/jobdb/job.go index 92886be10d3..d6882c47e0e 100644 --- a/internal/scheduler/jobdb/job.go +++ b/internal/scheduler/jobdb/job.go @@ -233,22 +233,6 @@ func (job *Job) WithRequestedPriority(priority uint32) *Job { return j } -// WithNodeSelectorTerm returns a copy of the job with a node selector term added to it. -func (job *Job) WithNodeSelectorTerm(key, value string) *Job { - copiedSchedulingInfo := proto.Clone(job.JobSchedulingInfo()).(*schedulerobjects.JobSchedulingInfo) - j := job.WithJobSchedulingInfo(copiedSchedulingInfo) - for _, oreq := range j.jobSchedulingInfo.ObjectRequirements { - if preq := oreq.GetPodRequirements(); preq != nil { - if preq.NodeSelector == nil { - preq.NodeSelector = map[string]string{key: value} - } else { - preq.NodeSelector[key] = value - } - } - } - return j -} - // JobSchedulingInfo returns the scheduling requirements associated with the job func (job *Job) JobSchedulingInfo() *schedulerobjects.JobSchedulingInfo { return job.jobSchedulingInfo diff --git a/internal/scheduler/nodedb/nodedb.go b/internal/scheduler/nodedb/nodedb.go index 72655047534..9afe7c63ce0 100644 --- a/internal/scheduler/nodedb/nodedb.go +++ b/internal/scheduler/nodedb/nodedb.go @@ -1042,7 +1042,7 @@ func (nodeDb *NodeDb) NodeTypesMatchingPod(req *schedulerobjects.PodRequirements selectedNodeTypes := make([]*schedulerobjects.NodeType, 0) numExcludedNodesByReason := make(map[string]int) for _, nodeType := range nodeDb.nodeTypes { - matches, reason, err := nodeType.PodRequirementsMet(req) + matches, reason, err := schedulerobjects.NodeTypePodRequirementsMet(nodeType, req) if err != nil { return nil, nil, err } diff --git a/internal/scheduler/schedulerobjects/nodematching.go b/internal/scheduler/schedulerobjects/nodematching.go index 7223d3ec024..2abda4fa867 100644 --- a/internal/scheduler/schedulerobjects/nodematching.go +++ b/internal/scheduler/schedulerobjects/nodematching.go @@ -109,10 +109,10 @@ func (err *InsufficientResources) String() string { err.Available.String() + " is available" } -// PodRequirementsMet determines whether a pod can be scheduled on nodes of this NodeType. +// NodeTypePodRequirementsMet determines whether a pod can be scheduled on nodes of this NodeType. // If the requirements are not met, it returns the reason for why. // If the requirements can't be parsed, an error is returned. -func (nodeType *NodeType) PodRequirementsMet(req *PodRequirements) (bool, PodRequirementsNotMetReason, error) { +func NodeTypePodRequirementsMet(nodeType *NodeType, req *PodRequirements) (bool, PodRequirementsNotMetReason, error) { matches, reason, err := podTolerationRequirementsMet(nodeType.GetTaints(), req) if !matches || err != nil { return matches, reason, err @@ -134,12 +134,6 @@ func PodRequirementsMet(taints []v1.Taint, labels map[string]string, totalResour return DynamicPodRequirementsMet(allocatableResources, req) } -// StaticJobRequirementsMet checks if a pod can be scheduled onto this node, -// accounting for taints, node selectors, node affinity, and total resources available on the node. -func StaticJobRequirementsMet(taints []v1.Taint, labels map[string]string, totalResources ResourceList, jctx *schedulercontext.JobSchedulingContext) (bool, PodRequirementsNotMetReason, error) { - -} - // StaticPodRequirementsMet checks if a pod can be scheduled onto this node, // accounting for taints, node selectors, node affinity, and total resources available on the node. func StaticPodRequirementsMet(taints []v1.Taint, labels map[string]string, totalResources ResourceList, req *PodRequirements) (bool, PodRequirementsNotMetReason, error) { diff --git a/internal/scheduler/schedulerobjects/nodematching_test.go b/internal/scheduler/schedulerobjects/nodematching_test.go index 6e2d836fbec..37ac767b5ad 100644 --- a/internal/scheduler/schedulerobjects/nodematching_test.go +++ b/internal/scheduler/schedulerobjects/nodematching_test.go @@ -520,7 +520,7 @@ func TestNodeTypeSchedulingRequirementsMet(t *testing.T) { tc.IndexedTaints, tc.IndexedLabels, ) - matches, reason, err := nodeType.PodRequirementsMet(tc.Req) + matches, reason, err := NodeTypePodRequirementsMet(nodeType, tc.Req) assert.NoError(t, err) if tc.ExpectSuccess { assert.True(t, matches)