Skip to content

fix (gke): comment out authorized_cidr in GKE blueprints and validate authorised_cidr - #6149

Open
saumyasharma03 wants to merge 3 commits into
GoogleCloudPlatform:developfrom
saumyasharma03:cidr-fix
Open

fix (gke): comment out authorized_cidr in GKE blueprints and validate authorised_cidr#6149
saumyasharma03 wants to merge 3 commits into
GoogleCloudPlatform:developfrom
saumyasharma03:cidr-fix

Conversation

@saumyasharma03

Copy link
Copy Markdown
Contributor

comment out authorized_cidr in GKE blueprints and validate authorised_cidr

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 #

@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 security and reliability of GKE blueprint deployments by preventing the use of placeholder CIDR values. It introduces a formal validation mechanism for CIDR inputs and updates existing example configurations to require explicit user configuration, reducing the risk of misconfigured network access controls.

Highlights

  • GKE Blueprint Updates: Commented out the 'authorized_cidr' variable in various GKE example blueprints to prevent accidental deployment with placeholder values.
  • New CIDR Validator: Implemented a new 'cidr' validator in the toolkit to ensure that 'master_authorized_networks' entries are correctly formatted as valid CIDR blocks.
  • Validation Integration: Updated the GKE cluster module metadata and Terraform variables to enforce CIDR validation, ensuring robust configuration checks.
  • Testing and Tooling: Added comprehensive unit tests for the new validator and updated the configuration validation script to handle the commented-out CIDR variables during testing.
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.

@saumyasharma03 saumyasharma03 added the release-bugfix Added to release notes under the "Bug fixes" heading. label Aug 14, 2026
@saumyasharma03 saumyasharma03 self-assigned this Aug 14, 2026

@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 CIDR validator (CIDRValidator) in Go to validate CIDR blocks in blueprints, registers it, and adds corresponding unit tests. It also adds a Terraform-level validation block to the master_authorized_networks variable in the GKE cluster module, comments out placeholder CIDR values in several example blueprints, and updates the configuration validation script to handle these placeholders. The review feedback highlights several improvement opportunities: ensuring that non-string types, missing object keys, and missing map keys in the CIDR validator return explicit errors rather than silently succeeding, and refining the grep pattern in the validation script to avoid matching commented-out lines.

Comment thread pkg/validators/metadata_validators.go
Comment thread pkg/validators/metadata_validators.go
Comment thread pkg/validators/metadata_validators.go
Comment thread tools/validate_configs/validate_configs.sh Outdated
@saumyasharma03

Copy link
Copy Markdown
Contributor Author

/gemini review

@saumyasharma03
saumyasharma03 marked this pull request as ready for review August 16, 2026 15:47
@saumyasharma03
saumyasharma03 requested a review from a team as a code owner August 16, 2026 15:47
@saumyasharma03
saumyasharma03 requested review from Neelabh94, agrawalkhushi18 and arpit974 and removed request for agrawalkhushi18 and arpit974 August 16, 2026 15:47

@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 CIDR validator to verify IP CIDR blocks in module metadata and variables. It implements the CIDRValidator in Go, registers it, adds corresponding unit tests, and updates the configuration validation script to handle the authorized_cidr variable. Additionally, it comments out the placeholder <your-ip-address>/32 in several GKE example blueprints and adds a Terraform validation block to the master_authorized_networks variable in the GKE cluster module. Feedback was provided to explicitly handle null values in the Terraform variable validation to prevent potential evaluation failures.

Comment thread modules/scheduler/gke-cluster/variables.tf
Comment thread modules/scheduler/gke-cluster/variables.tf Outdated
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