Skip to content

fix(job): use hostname exclusive-topology for single-node slices - #6526

Merged
Neelabh94 merged 1 commit into
GoogleCloudPlatform:developfrom
Neelabh94:fix/job-single-node-exclusive-topology
Oct 20, 2026
Merged

Neelabh94 merged 1 commit into
GoogleCloudPlatform:developfrom
Neelabh94:fix/job-single-node-exclusive-topology

Conversation

@Neelabh94

Copy link
Copy Markdown
Contributor

Summary

When generating GKE JobSet manifests without dynamic or static sub-slicing (!opts.IsDynamicSlicing && !opts.IsStaticSlicing), prepareJobSetTemplateData previously set alpha.jobset.sigs.k8s.io/exclusive-topology: cloud.google.com/gke-nodepool unconditionally, and pathways_jobset.tmpl hardcoded alpha.jobset.sigs.k8s.io/exclusive-topology: cloud.google.com/gke-nodepool on the worker replicatedJob.

For single-host slice topologies (NodesPerSlice <= 1, such as TPU 2x2x1, 1x1, or single-node GPU/CPU jobs), each slice replica consists of a single pod on a single host. On clusters where multiple independent single-host nodes are grouped into a shared multi-node GKE node pool, setting exclusive-topology: cloud.google.com/gke-nodepool causes the JobSet controller to inject pod anti-affinity across the entire cloud.google.com/gke-nodepool domain—blocking concurrent single-node jobs or multi-slice NodesPerSlice == 1 jobs from scheduling onto the remaining free hosts in that node pool.

Changes

  • pkg/orchestrator/gke/manifest_generator.go (prepareJobSetTemplateData):
    • Emit alpha.jobset.sigs.k8s.io/exclusive-topology: kubernetes.io/hostname when opts.NodesPerSlice <= 1 (and neither dynamic nor static sub-slicing is active).
    • Preserve alpha.jobset.sigs.k8s.io/exclusive-topology: cloud.google.com/gke-nodepool when opts.NodesPerSlice > 1.
  • pkg/orchestrator/gke/templates/pathways_jobset.tmpl:
    • Replace the hardcoded alpha.jobset.sigs.k8s.io/exclusive-topology: cloud.google.com/gke-nodepool annotation on the worker replicatedJob with {{.ExclusiveTopologyAnnotation}} (guarded by {{- if .ExclusiveTopologyAnnotation }}).
  • pkg/orchestrator/gke/manifest_generator_test.go:
    • Add table-driven unit tests (TestGenerateGKEManifest_ExclusiveTopology and TestGeneratePathwaysManifest_ExclusiveTopology) verifying exclusive-topology behavior for single-node slices (NodesPerSlice <= 1), multi-node slices (NodesPerSlice > 1), dynamic slicing, and static slicing.

@Neelabh94 Neelabh94 added the release-bugfix Added to release notes under the "Bug fixes" heading. label Oct 19, 2026
@Neelabh94 Neelabh94 self-assigned this Oct 19, 2026
@gemini-code-assist

Copy link
Copy Markdown
Contributor

Summary of Changes

Hello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request improves GKE JobSet scheduling by refining how exclusive-topology annotations are applied. By switching to 'kubernetes.io/hostname' for single-node jobs, it prevents unnecessary pod anti-affinity across entire node pools, thereby improving resource utilization and scheduling flexibility for single-node workloads.

Highlights

  • Exclusive Topology Logic: Updated the GKE orchestrator to dynamically set the exclusive-topology annotation to 'kubernetes.io/hostname' for single-node slices (NodesPerSlice <= 1), while retaining 'cloud.google.com/gke-nodepool' for multi-node slices.
  • Template Refactoring: Modified the pathways_jobset.tmpl to use a dynamic annotation field, allowing for flexible configuration of the exclusive-topology based on the slice topology.
  • Testing: Added comprehensive table-driven unit tests to verify correct annotation behavior across various scenarios, including single-node, multi-node, dynamic, and static slicing.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize the Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counterproductive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution. ↩

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request updates the GKE manifest generation logic to dynamically set the 'exclusive-topology' annotation based on the number of nodes per slice. Specifically, it uses 'kubernetes.io/hostname' for single-node slices and 'cloud.google.com/gke-nodepool' for multi-node slices, while omitting the annotation entirely for dynamic or static slicing. The changes include updates to the manifest generator, the corresponding template, and comprehensive unit tests to verify the annotation logic across various configurations. I have no feedback to provide as the implementation is clear and well-tested.

@Neelabh94
Neelabh94 marked this pull request as ready for review October 19, 2026 16:18
@Neelabh94
Neelabh94 requested a review from a team as a code owner October 19, 2026 16:18
@Neelabh94
Neelabh94 requested review from SwarnaBharathiMantena and agrawalkhushi18 and removed request for ishitachail and vikramvs-gg October 19, 2026 16:19
Comment thread pkg/orchestrator/gke/manifest_generator_test.go
@agrawalkhushi18

Copy link
Copy Markdown
Contributor

LGTM , one nit comment.

@Neelabh94
Neelabh94 force-pushed the fix/job-single-node-exclusive-topology branch from 083bd3b to 89fa4e9 Compare October 20, 2026 01:49
@Neelabh94
Neelabh94 enabled auto-merge (squash) October 20, 2026 01:50
@Neelabh94
Neelabh94 merged commit 0365d22 into GoogleCloudPlatform:develop Oct 20, 2026
24 of 83 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

release-bugfix Added to release notes under the "Bug fixes" heading.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants