Skip to content

fix: check node pool locations during capacity checks#5855

Draft
Neelabh94 wants to merge 2 commits into
GoogleCloudPlatform:developfrom
Neelabh94:ubench_gaps
Draft

fix: check node pool locations during capacity checks#5855
Neelabh94 wants to merge 2 commits into
GoogleCloudPlatform:developfrom
Neelabh94:ubench_gaps

Conversation

@Neelabh94

@Neelabh94 Neelabh94 commented Jun 25, 2026

Copy link
Copy Markdown
Contributor

This pull request improves the resource resolution logic for GKE clusters by ensuring that machine capacity checks are aware of the specific locations defined in node pools. By incorporating node pool location data, the orchestrator can more accurately determine where a machine type is available, preventing incorrect capacity assumptions.

Submission Checklist

NOTE: Community submissions can take up to 2 weeks to be reviewed.

Please take the following actions before submitting this pull request.

  • Fork your PR branch from the Toolkit "develop" branch (not main)
  • Test all changes with pre-commit in a local branch #
  • Confirm that "make tests" passes all tests
  • Add or modify unit tests to cover code changes
  • Ensure that unit test coverage remains above 80%
  • Update all applicable documentation
  • Follow Cluster Toolkit Contribution guidelines #

@Neelabh94 Neelabh94 added the release-bugfix Added to release notes under the "Bug fixes" heading. label Jun 25, 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 the resource resolution logic for GKE clusters by ensuring that machine capacity checks are aware of the specific locations defined in node pools. By incorporating node pool location data, the orchestrator can more accurately determine where a machine type is available, preventing incorrect capacity assumptions. Additionally, the changes introduce robust handling for cases where no matching node pool exists, leveraging Node Auto-Provisioning settings to decide whether to fail or fall back to cluster-wide zones.

Highlights

  • Node Pool Location Awareness: Updated the GKE orchestrator to respect specific node pool locations when checking machine capacity, rather than relying solely on cluster-wide zones.
  • Autoscaling Fallback Logic: Implemented a fallback mechanism that checks for GKE Node Auto-Provisioning (NAP) status when no matching node pool is found, ensuring proper error handling or cluster-wide zone usage.
  • Testing Enhancements: Added comprehensive unit tests, including a mock client to simulate zone-specific machine type availability and verify NAP-enabled/disabled scenarios.
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 a mechanism to resolve GKE machine capabilities by checking node pool specific zones when querying a region. It adds a helper function getZonesForMachineType to extract zones from node pools matching the requested machine type, updates FetchMachineCapabilities to prioritize these zones, and includes comprehensive unit tests. The review feedback highlights a potential issue where an empty Locations field in a matching node pool could cause false-positive errors when Node Auto-Provisioning is disabled; it suggests falling back to the cluster's zones in this scenario. Additionally, the feedback advises using case-sensitive comparisons for machine types to align with GCP/GKE specifications.

Comment thread pkg/orchestrator/gke/resource_resolver.go
@Neelabh94 Neelabh94 force-pushed the ubench_gaps branch 4 times, most recently from 542aba4 to 53c59bc Compare June 25, 2026 15:15
@Neelabh94

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 enhances GKE machine capability resolution by restricting zone queries to those where the target machine type is deployed in the cluster's node pools. It introduces the getZonesForMachineType helper, adds a Locations field to gkeJobNodePool, and implements fallback logic for GKE Node Auto-Provisioning. Comprehensive unit tests have been added to cover these scenarios. I have no feedback to provide as the changes are well-implemented and fully tested.

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.

2 participants