Skip to content

Commit

Permalink
scheduler: set job on system stack for CSI feasibility check (#15372) (
Browse files Browse the repository at this point in the history
…#15376) (#15376)

When the scheduler checks feasibility of each node, it creates a "stack" which
carries attributes of the job and task group it needs to check feasibility
for. The `system` and `sysbatch` scheduler use a different stack than `service`
and `batch` jobs. This stack was missing the call to set the job ID and
namespace for the CSI check. This prevents CSI volumes from being scheduled for
system jobs whenever the volume is in a non-default namespace.

Set the job ID and namespace to match the generic scheduler.

Co-authored-by: Tim Gross <tgross@hashicorp.com>
  • Loading branch information
hc-github-team-nomad-core and tgross committed Nov 23, 2022
1 parent e852fff commit a861c83
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .changelog/15372.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:bug
csi: Fixed a bug where volumes in non-default namespaces could not be scheduled for system or sysbatch jobs
```
2 changes: 2 additions & 0 deletions scheduler/stack.go
Original file line number Diff line number Diff line change
Expand Up @@ -299,6 +299,8 @@ func (s *SystemStack) SetJob(job *structs.Job) {
s.distinctPropertyConstraint.SetJob(job)
s.binPack.SetJob(job)
s.ctx.Eligibility().SetJob(job)
s.taskGroupCSIVolumes.SetNamespace(job.Namespace)
s.taskGroupCSIVolumes.SetJobID(job.ID)

if contextual, ok := s.quota.(ContextualIterator); ok {
contextual.SetJob(job)
Expand Down

0 comments on commit a861c83

Please sign in to comment.