Skip to content

Commit

Permalink
fix: require connected and approved nodes for scheduling
Browse files Browse the repository at this point in the history
- fixes #3784
  • Loading branch information
frrist committed Apr 25, 2024
1 parent 3a4c578 commit cc27cf9
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 6 deletions.
5 changes: 2 additions & 3 deletions pkg/orchestrator/scheduler/batch_service_job.go
Original file line number Diff line number Diff line change
Expand Up @@ -155,14 +155,13 @@ func (b *BatchServiceJobScheduler) createMissingExecs(
// placeExecs places the executions
func (b *BatchServiceJobScheduler) placeExecs(ctx context.Context, execs execSet, job *models.Job) error {
if len(execs) > 0 {
// TODO: Remove the options once we are ready to enforce that only connected/approved nodes can be used
selectedNodes, err := b.nodeSelector.TopMatchingNodes(
ctx,
job,
len(execs),
&orchestrator.NodeSelectionConstraints{
RequireApproval: false,
RequireConnected: false,
RequireApproval: true,
RequireConnected: true,
},
)
if err != nil {
Expand Down
4 changes: 2 additions & 2 deletions pkg/orchestrator/scheduler/daemon_job.go
Original file line number Diff line number Diff line change
Expand Up @@ -86,11 +86,11 @@ func (b *DaemonJobScheduler) createMissingExecs(
ctx context.Context, job *models.Job, plan *models.Plan, existingExecs execSet) (execSet, error) {
newExecs := execSet{}

// Require approval when selecting nodes, but do not require them to be connected.
// Require nodes to be approved and connected to schedule work.
nodes, err := b.nodeSelector.AllMatchingNodes(
ctx,
job,
&orchestrator.NodeSelectionConstraints{RequireApproval: true, RequireConnected: false},
&orchestrator.NodeSelectionConstraints{RequireApproval: true, RequireConnected: true},
)
if err != nil {
return newExecs, err
Expand Down
2 changes: 1 addition & 1 deletion pkg/orchestrator/scheduler/ops_job.go
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ func (b *OpsJobScheduler) createMissingExecs(
ctx,
job, &orchestrator.NodeSelectionConstraints{
RequireApproval: true,
RequireConnected: false,
RequireConnected: true,
})
if err != nil {
return newExecs, err
Expand Down

0 comments on commit cc27cf9

Please sign in to comment.