Skip to content

Commit

Permalink
Merge pull request kubernetes#27832 from jupblb/job-queue-0
Browse files Browse the repository at this point in the history
Change behavior of setting job queue concurrency to 0
  • Loading branch information
k8s-ci-robot authored Nov 23, 2022
2 parents 4dbc4ac + a18f3f5 commit 4b1eb2a
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 7 deletions.
7 changes: 4 additions & 3 deletions prow/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -673,9 +673,10 @@ type Plank struct {

// JobQueueConcurrencies is an optional field used to define job queue max concurrency.
// Each job can be assigned to a specific queue which has its own max concurrency,
// independent from the job's name. An example use case would be easier
// scheduling of jobs using boskos resources. This mechanism is separate from
// ProwJob's MaxConcurrency setting.
// independent from the job's name. Setting the concurrency to 0 will block any job
// from being triggered. Setting the concurrency to a negative value will remove the
// limit. An example use case would be easier scheduling of jobs using boskos resources.
// This mechanism is separate from ProwJob's MaxConcurrency setting.
JobQueueConcurrencies map[string]int `json:"job_queue_capacities,omitempty"`
}

Expand Down
7 changes: 4 additions & 3 deletions prow/config/prow-config-documented.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1035,9 +1035,10 @@ plank:

# JobQueueConcurrencies is an optional field used to define job queue max concurrency.
# Each job can be assigned to a specific queue which has its own max concurrency,
# independent from the job's name. An example use case would be easier
# scheduling of jobs using boskos resources. This mechanism is separate from
# ProwJob's MaxConcurrency setting.
# independent from the job's name. Setting the concurrency to 0 will block any job
# from being triggered. Setting the concurrency to a negative value will remove the
# limit. An example use case would be easier scheduling of jobs using boskos resources.
# This mechanism is separate from ProwJob's MaxConcurrency setting.
job_queue_capacities:
"": 0

Expand Down
8 changes: 7 additions & 1 deletion prow/plank/controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2001,9 +2001,15 @@ func TestMaxConcurency(t *testing.T) {
ExpectedResult: true,
},
{
Name: "Job queue concurency 0 always runs",
Name: "Job queue concurency 0 never runs",
ProwJob: prowapi.ProwJob{Spec: prowapi.ProwJobSpec{JobQueueName: "queue"}},
JobQueueConcurrencies: map[string]int{"queue": 0},
ExpectedResult: false,
},
{
Name: "Job queue concurency -1 always runs",
ProwJob: prowapi.ProwJob{Spec: prowapi.ProwJobSpec{JobQueueName: "queue"}},
JobQueueConcurrencies: map[string]int{"queue": -1},
ExpectedResult: true,
},
{
Expand Down
3 changes: 3 additions & 0 deletions prow/plank/reconciler.go
Original file line number Diff line number Diff line change
Expand Up @@ -815,6 +815,9 @@ func (r *reconciler) canExecuteConcurrentlyPerQueue(ctx context.Context, pj *pro
return false, fmt.Errorf("failed to match queue name '%s' with Plank configuration", queueName)
}
if queueConcurrency == 0 {
return false, nil
}
if queueConcurrency < 0 {
return true, nil
}

Expand Down

0 comments on commit 4b1eb2a

Please sign in to comment.