-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Description
Support node_pool at the Task Group level in jobs
Summary
Allow jobs to specify node_pool at the task group level (in addition to the existing job-level setting) so that different groups within the same job can target different node pools.
Background / Problem Statement
Today, node_pool can be defined at the job level, but placement is ultimately decided per allocation, and allocations map to task groups. This creates a practical limitation: a single job cannot schedule multiple groups into different node pools.
As a result, users must split what is logically one application/job into multiple Nomad jobs just to target different node pools. This becomes painful when groups need coordinated rollout via deployments, because Nomad does not provide a mechanism to coordinate deployment dependencies across separate jobs the way it can within a single job.
Goals
- Enable specifying
node_poolat the group level so a single job can contain multiple groups targeting different node pools. - Preserve existing behavior for jobs that only specify
node_poolat the job level. - Make placement intent clearer by aligning configuration with the allocation/task-group boundary.
Proposed Behavior
- Add
node_pool(or equivalent) configuration at the task group stanza. - If
group.node_poolis set, it takes precedence for allocations created from that group. - If
group.node_poolis not set, fall back tojob.node_pool(existing behavior). - If neither is set, behavior remains unchanged (default scheduling rules).
Acceptance Criteria
-
Group-level targeting works
-
Given a job with two task groups
groupAandgroupB:groupAconfigured withnode_pool = "pool-a"groupBconfigured withnode_pool = "pool-b"
-
Allocations for
groupAare only placed on nodes inpool-a, and allocations forgroupBare only placed on nodes inpool-b.
-
-
Backwards compatibility
- A job that specifies
node_poolonly at the job level behaves exactly as it does today. - Existing job specs continue to validate and run without modification.
- A job that specifies
-
Precedence rules
- When both job-level and group-level
node_poolare present, the group-level value is used for that group’s allocations. - This precedence is documented and covered by tests.
- When both job-level and group-level
-
User feedback on invalid configuration
- If a group references a node pool that does not exist (or is not available), the job fails validation or produces a clear, actionable scheduler/plan error (whichever is consistent with existing Nomad behavior for node pool validation).
-
Documentation
- Job specification docs are updated to describe group-level
node_pool, including examples and precedence with job-levelnode_pool.
- Job specification docs are updated to describe group-level
Example Use Case
A single application job defines:
apigroup that must run in a “services” node poolworkergroup that must run in a “batch” node pool
Today this requires two separate Nomad jobs, making coordinated changes harder. Group-level node_pool enables this to remain one cohesive job.