Skip to content

Fix(gke): Support shared reservations in job submission#5826

Draft
SwarnaBharathiMantena wants to merge 2 commits into
GoogleCloudPlatform:developfrom
SwarnaBharathiMantena:swarnabm/job-submit-shared-reservation-update
Draft

Fix(gke): Support shared reservations in job submission#5826
SwarnaBharathiMantena wants to merge 2 commits into
GoogleCloudPlatform:developfrom
SwarnaBharathiMantena:swarnabm/job-submit-shared-reservation-update

Conversation

@SwarnaBharathiMantena

Copy link
Copy Markdown
Contributor

Extract and inject the reservation owner project when submitting a job with a shared reservation.

GKE requires 'cloud.google.com/reservation-owner-project' to be specified in the nodeSelector to correctly consume shared reservations owned by a different project. This CL extracts the owner project from the reservation URI (if provided) and injects it into the generated manifest's nodeSelector.

@SwarnaBharathiMantena SwarnaBharathiMantena requested a review from a team as a code owner June 22, 2026 09:47
@SwarnaBharathiMantena SwarnaBharathiMantena added the release-improvements Added to release notes under the "Improvements" heading. label Jun 22, 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 enables support for GKE shared reservations by ensuring the correct reservation owner project is identified and included in job manifests. By extracting the project ID from the reservation URI and injecting it into the nodeSelector, the orchestrator ensures that jobs can correctly consume reservations owned by different projects.

Highlights

  • Reservation Owner Project Extraction: Added a utility function to extract the project ID from GKE reservation resource URIs.
  • Manifest Injection: Updated the GKE job orchestrator to inject the 'cloud.google.com/reservation-owner-project' label into the nodeSelector when a shared reservation is used.
  • Testing: Added comprehensive unit tests for the new extraction logic and verified the manifest generation process for shared reservations.
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 introduces support for shared GKE reservations by extracting the reservation owner project from the reservation resource URI and adding it as a node selector label (cloud.google.com/reservation-owner-project) in the generated GKE manifest. It includes the helper function extractReservationOwnerProject in nap.go, along with comprehensive unit tests in nap_test.go and gke_job_orchestrator_test.go to verify the extraction logic and manifest generation. I have no feedback to provide.

@SwarnaBharathiMantena SwarnaBharathiMantena force-pushed the swarnabm/job-submit-shared-reservation-update branch from 76fe006 to 7752889 Compare June 23, 2026 06:24
@SwarnaBharathiMantena SwarnaBharathiMantena marked this pull request as draft June 23, 2026 06:24
@SwarnaBharathiMantena

Copy link
Copy Markdown
Contributor Author

/gemini review

@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 introduces support for extracting and configuring shared reservation owner projects and subblocks in GKE node selectors, complete with comprehensive unit tests. The feedback highlights a critical correction: the GKE node selector label key for the owner project of a shared reservation must be updated from 'cloud.google.com/reservation-project' to 'cloud.google.com/reservation-owner-project' in both the orchestrator implementation and the corresponding unit tests to ensure GKE correctly identifies and consumes the shared reservation.

Comment thread pkg/orchestrator/gke/gke_job_orchestrator.go
Comment thread pkg/orchestrator/gke/gke_job_orchestrator_test.go
Comment thread pkg/orchestrator/gke/gke_job_orchestrator_test.go
Extract and inject the reservation owner project when submitting a job with a shared reservation.

GKE requires 'cloud.google.com/reservation-owner-project' to be specified in the nodeSelector to correctly consume shared reservations owned by a different project. This CL extracts the owner project from the reservation URI (if provided) and injects it into the generated manifest's nodeSelector.
@SwarnaBharathiMantena SwarnaBharathiMantena force-pushed the swarnabm/job-submit-shared-reservation-update branch from 7752889 to 94755ac Compare June 30, 2026 09:40
@SwarnaBharathiMantena SwarnaBharathiMantena force-pushed the swarnabm/job-submit-shared-reservation-update branch from 94755ac to e630bbd Compare June 30, 2026 09:51
@SwarnaBharathiMantena

Copy link
Copy Markdown
Contributor Author

/gemini review

@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 refactors reservation URI parsing to extract and inject GKE reservation labels (such as reservation name, owner project, blocks, and subblocks) into the node selector of GKE jobs, accompanied by new unit tests. The reviewer identified that the label key used for the reservation owner project is incorrect and should be updated from cloud.google.com/reservation-project to cloud.google.com/reservation-owner-project in both the implementation and the corresponding tests to prevent scheduling failures.

Comment thread pkg/orchestrator/gke/gke_job_orchestrator.go
Comment thread pkg/orchestrator/gke/gke_job_orchestrator_test.go
Comment thread pkg/orchestrator/gke/gke_job_orchestrator_test.go
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

release-improvements Added to release notes under the "Improvements" heading.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants