Skip to content

Ensure fully qualified URLs for reservation subblocks#5452

Merged
SwarnaBharathiMantena merged 1 commit into
GoogleCloudPlatform:developfrom
scaliby:subblock-reservations
May 6, 2026
Merged

Ensure fully qualified URLs for reservation subblocks#5452
SwarnaBharathiMantena merged 1 commit into
GoogleCloudPlatform:developfrom
scaliby:subblock-reservations

Conversation

@scaliby

@scaliby scaliby commented Apr 3, 2026

Copy link
Copy Markdown
Contributor

Fixes URI formatting when targeting reservation blocks/subblocks in the gke-node-pool module.

When users provide a suffix in the specific_reservations[0].name field (e.g., my-res/reservationBlocks/my-block), the module previously dropped the suffix for inactive reservations, and failed to include the required zone in the URI for active ones.

This PR updates active_reservation_values and default_reservation_values to properly construct the fully qualified projects/{project}/zones/{zone}/reservations/{name}/reservationBlocks/{block} URI whenever a suffix is detected.

@scaliby scaliby requested review from a team and samskillman as code owners April 3, 2026 13:30
@github-actions github-actions Bot added the external PR from external contributor label Apr 3, 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 resolves critical URI formatting issues within the gke-node-pool module, specifically concerning Google Cloud reservation blocks and subblocks. Previously, the module would either drop reservation suffixes for inactive reservations or fail to include the necessary zone information for active ones. The changes ensure that both active and default reservation values are consistently constructed as fully qualified URIs, correctly incorporating project, zone, reservation name, and any specified reservation block suffix, thereby preventing misconfigurations and improving the reliability of reservation targeting.

Highlights

  • Reservation URI Formatting: Corrected URI formatting for reservation blocks and subblocks within the gke-node-pool module, addressing issues where suffixes were dropped or zones were omitted.
  • active_reservation_values: Modified the active_reservation_values local to ensure it constructs fully qualified URIs including projects/{project}/zones/{zone}/reservations/{name}/reservationBlocks/{block} when a suffix is present.
  • default_reservation_values: Updated the default_reservation_values local to correctly build fully qualified URIs for default reservations, incorporating the project, zone, reservation name, and any provided block suffix.
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 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 counter productive. 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.

@scaliby scaliby mentioned this pull request Apr 3, 2026
@scaliby

scaliby commented Apr 3, 2026

Copy link
Copy Markdown
Contributor Author

@jamOne- PTAL

@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 reservation logic in the GKE node pool module to support fully qualified resource URLs. The review identified a critical issue where the use of a loop index for suffixes causes index out-of-range errors in multi-zonal deployments, and a high-severity issue where the use of try(var.zones[0], "") can result in invalid resource URIs. The reviewer provided specific code suggestions to resolve these issues by correctly mapping suffixes and ensuring valid zone references.

Comment thread modules/compute/gke-node-pool/reservation_definitions.tf
Comment thread modules/compute/gke-node-pool/reservation_definitions.tf Outdated
@scaliby scaliby force-pushed the subblock-reservations branch 4 times, most recently from 1a3f770 to 34d24a0 Compare April 3, 2026 15:21
@SwarnaBharathiMantena SwarnaBharathiMantena added the release-module-improvements Added to release notes under the "Module Improvements" heading. label Apr 8, 2026
@SwarnaBharathiMantena

Copy link
Copy Markdown
Contributor

/gcbrun

@jamOne- jamOne- 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.

Did you test it?

Comment thread modules/compute/gke-node-pool/reservation_definitions.tf
@jamOne-

jamOne- commented Apr 8, 2026

Copy link
Copy Markdown
Contributor

pre-commits are failing

@scaliby scaliby force-pushed the subblock-reservations branch from 34d24a0 to c03dc61 Compare May 4, 2026 10:00
@scaliby

scaliby commented May 4, 2026

Copy link
Copy Markdown
Contributor Author

Did you test it?

I did and it seems to be working.

@SwarnaBharathiMantena

Copy link
Copy Markdown
Contributor

/gcbrun

1 similar comment
@Neelabh94

Copy link
Copy Markdown
Contributor

/gcbrun

@SwarnaBharathiMantena SwarnaBharathiMantena 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.

LGTM!

The failing tests are not related. Two of the failing tests are spot consumption tests which are not related. One of them is due to expired reservation and two others failed due to nodepool getting created in ERROR state.

@SwarnaBharathiMantena SwarnaBharathiMantena enabled auto-merge (squash) May 6, 2026 05:20
@SwarnaBharathiMantena SwarnaBharathiMantena merged commit c682840 into GoogleCloudPlatform:develop May 6, 2026
27 of 79 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

external PR from external contributor release-module-improvements Added to release notes under the "Module Improvements" heading.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants