fix(gke-cluster): Respect release channel when selecting GKE version by prefix#5729
Conversation
Summary of ChangesHello, 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 addresses a bug in how GKE cluster versions are resolved within the scheduler module. By introducing conditional logic for release channels, the module now accurately fetches the appropriate version based on the user's configuration. Additionally, minor formatting improvements were applied to the module's documentation. Highlights
Using Gemini Code AssistThe 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
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 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
|
There was a problem hiding this comment.
Code Review
This pull request updates the GKE cluster module to dynamically determine the master version based on the configured release channel when it is not set to 'UNSPECIFIED'. It also formats markdown tables in the module's README. A review comment correctly identifies a potential Terraform evaluation error when performing a direct map lookup on release_channel_latest_version if the key is missing, and suggests using the lookup() function with a fallback to prevent failures.
d409352
into
GoogleCloudPlatform:develop
This PR fixes an issue where the GKE cluster version selection logic was ignoring the specified release channel when a
version_prefixwas provided.The Bug:
Previously, if
min_master_versionwas not set, the module relied on thegoogle_container_engine_versionsdata source and automatically selectedlatest_master_version. Because this data source queries versions without specifying a channel, it fetched the highest available patch version matching the given prefix across all channels. For example, if a user configured theREGULARrelease channel, but the absolute latest matching version was currently only available inRAPID, Terraform would attempt to deploy a version that had not yet rolled out toREGULAR, which could result in an API error during cluster creation.The Fix:
This PR updates the internal logic for setting the GKE version to factor in the release channel. It replaces the hardcoded
latest_master_versionfallback with the following conditional logic:release_channelis configured (i.e., not"UNSPECIFIED"), it now uses the data source'srelease_channel_latest_versionattribute to retrieve the latest version specific to that channel.latest_master_versionif the release channel is left as"UNSPECIFIED".