Skip to content

refactor: Introduce internal semver compare module#5411

Merged
SwarnaBharathiMantena merged 12 commits into
GoogleCloudPlatform:developfrom
jamOne-:semver-compare
Apr 1, 2026
Merged

refactor: Introduce internal semver compare module#5411
SwarnaBharathiMantena merged 12 commits into
GoogleCloudPlatform:developfrom
jamOne-:semver-compare

Conversation

@jamOne-

@jamOne- jamOne- commented Mar 26, 2026

Copy link
Copy Markdown
Contributor

Description

Introduce internal semver compare module to make version checks more readable and maintainable. We'll need it for super-slicing in at least two places: enable_slice_controller gke version check and then later for checking the Kueue version.

This change also changes the required gke version of enable_slice_controller to a more specific version than just 1.35.

Tests

Tested manually.

@github-actions github-actions Bot added the external PR from external contributor label Mar 26, 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 introduces a dedicated internal module for robust semantic version comparison within Terraform configurations. This refactoring aims to centralize and standardize version validation logic, making it more readable and easier to maintain across various features. The initial application of this module is to enhance the GKE version check for the slice controller, with plans for future use in other areas like Kueue version checks.

Highlights

  • New Semantic Version Comparison Module: An internal Terraform module, semver_compare, has been introduced to provide a standardized and maintainable way to compare semantic versions (major.minor.patch) including optional GKE build numbers. This module includes a 'fail-open' validation logic, ensuring that non-standard version strings (like branch names or commit SHAs) do not inadvertently block advanced users.
  • Refactored GKE Version Check: The existing GKE version check for the enable_slice_controller feature has been refactored to utilize the new semver_compare module, improving readability and maintainability. This change replaces a manual string parsing and comparison with a dedicated module.
  • Updated GKE Version Requirement: The minimum required GKE version for the enable_slice_controller has been updated from a general 1.35 to a more specific 1.35.0-gke.274500.
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.

@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 new internal Terraform module, semver_compare, designed to securely perform semantic version comparisons, including an optional GKE build number. This module replaces a manual version check in modules/scheduler/gke-cluster/main.tf for the GKE Slice Controller, ensuring the GKE version meets a minimum requirement. Feedback indicates that the new semver_compare module needs to be added to the modules/README.md index as per the repository's style guide. Additionally, the parsing logic for patch and GKE version components within the semver_compare module's main.tf can be simplified for improved readability and maintainability by removing redundant try() calls.

Comment thread modules/internal/semver_compare/README.md
Comment thread modules/internal/semver_compare/main.tf Outdated
Comment thread modules/internal/semver_compare/main.tf Outdated
@jamOne- jamOne- marked this pull request as ready for review March 26, 2026 13:13
@jamOne- jamOne- requested review from a team and samskillman as code owners March 26, 2026 13:13
@Neelabh94 Neelabh94 added release-new-modules Added to release notes under the "New Modules" heading. labels Mar 26, 2026
@jamOne- jamOne- marked this pull request as draft March 26, 2026 17:02

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

<!-- BEGINNING OF PRE-COMMIT-TERRAFORM DOCS HOOK -->

<!-- END OF PRE-COMMIT-TERRAFORM DOCS HOOK -->

@jamOne- jamOne- force-pushed the semver-compare branch 2 times, most recently from e1877b1 to 8c83c7c Compare March 27, 2026 16:03
@jamOne- jamOne- marked this pull request as ready for review March 27, 2026 16:03
@SwarnaBharathiMantena

Copy link
Copy Markdown
Contributor

/gcbrun

@SwarnaBharathiMantena SwarnaBharathiMantena added the release-module-improvements Added to release notes under the "Module Improvements" heading. label Mar 28, 2026
@SwarnaBharathiMantena

Copy link
Copy Markdown
Contributor

/gcbrun

@jamOne- jamOne- marked this pull request as draft March 30, 2026 08:17
@jamOne- jamOne- marked this pull request as ready for review March 30, 2026 09:52
@SwarnaBharathiMantena

Copy link
Copy Markdown
Contributor

/gcbrun

@jamOne-

jamOne- commented Mar 30, 2026

Copy link
Copy Markdown
Contributor Author

@SwarnaBharathiMantena please re run the tests once again

@SwarnaBharathiMantena

Copy link
Copy Markdown
Contributor

/gcbrun

@SwarnaBharathiMantena

Copy link
Copy Markdown
Contributor

/gcbrun

@SwarnaBharathiMantena

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!

@SwarnaBharathiMantena SwarnaBharathiMantena enabled auto-merge (squash) April 1, 2026 10:54
auto-merge was automatically disabled April 1, 2026 10:55

Repository rule violations found

@SwarnaBharathiMantena SwarnaBharathiMantena merged commit 908e7f9 into GoogleCloudPlatform:develop Apr 1, 2026
31 of 71 checks passed
simrankaurb pushed a commit to simrankaurb/cluster-toolkit that referenced this pull request Apr 7, 2026
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. release-new-modules Added to release notes under the "New Modules" heading.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants