diff --git a/.changelog/11565.txt b/.changelog/11565.txt new file mode 100644 index 000000000..182f51663 --- /dev/null +++ b/.changelog/11565.txt @@ -0,0 +1,3 @@ +```release-note:bug +scheduler: Fix panic when system jobs are filtered by node class +``` diff --git a/scheduler/scheduler_system.go b/scheduler/scheduler_system.go index 5d0278eae..325e7ae00 100644 --- a/scheduler/scheduler_system.go +++ b/scheduler/scheduler_system.go @@ -287,9 +287,16 @@ func mergeNodeFiltered(acc, curr *structs.AllocMetric) *structs.AllocMetric { acc.NodesEvaluated += curr.NodesEvaluated acc.NodesFiltered += curr.NodesFiltered + + if acc.ClassFiltered == nil { + acc.ClassFiltered = make(map[string]int) + } for k, v := range curr.ClassFiltered { acc.ClassFiltered[k] += v } + if acc.ConstraintFiltered == nil { + acc.ConstraintFiltered = make(map[string]int) + } for k, v := range curr.ConstraintFiltered { acc.ConstraintFiltered[k] += v }