Skip to content

Fix Vpc Network#5385

Draft
LAVEEN wants to merge 9 commits intoGoogleCloudPlatform:developfrom
LAVEEN:fixvpcnetwork
Draft

Fix Vpc Network#5385
LAVEEN wants to merge 9 commits intoGoogleCloudPlatform:developfrom
LAVEEN:fixvpcnetwork

Conversation

@LAVEEN
Copy link
Copy Markdown
Contributor

@LAVEEN LAVEEN commented Mar 23, 2026

Setting the VPC name to test name.

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 enhances the daily testing infrastructure by introducing a mechanism to dynamically name VPC networks. This change aims to prevent naming collisions and improve the isolation of test environments by ensuring each VPC module receives a unique, test-specific name during the build process. The core of this update is a new Python script that modifies blueprint YAML files, integrated into the existing build steps.

Highlights

  • New VPC Modification Script: A new Python script, tools/modify_vpc.py, has been introduced to dynamically assign unique network names to VPC modules within YAML blueprints. This script iterates through deployment groups, identifies VPC modules, and sets their network_name based on a test_name variable and a sequential counter.
  • Integration into Daily Build Process: The daily build process for h4d-vm.yaml now includes a step to execute the tools/modify_vpc.py script. This ensures that VPC network names are modified dynamically before the blueprint is further processed, preventing potential naming conflicts.
  • Test Configuration Update: The h4d-vm.yml test configuration has been updated to include test_name in its cli_deployment_vars, providing the necessary variable for the new VPC modification script to generate unique network names.
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.

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

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 Python script to programmatically assign unique network names to VPC modules in test blueprints, aiming to fix network name collisions. The change also updates the test configuration to pass the necessary variables to the blueprint.

While the new script is a good approach, I've found a critical issue where its changes are immediately overwritten by an existing sed command in the build script, nullifying the fix.

Additionally, I've suggested a couple of improvements to the new Python script to make it more robust and user-friendly by adding better error handling and argument parsing. Please see the detailed comments.

REGION="$${ZONE%-*}"
BUILD_ID_SHORT=$${BUILD_ID:0:6}
BLUEPRINT="/workspace/examples/h4d-vm.yaml"
python3 tools/modify_vpc.py "$${BLUEPRINT}"
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.

critical

The changes made by your new script tools/modify_vpc.py are being overwritten by a later sed command on line 87. Your script correctly assigns unique network names (e.g., $(vars.test_name)-0, $(vars.test_name)-1) to the VPC modules. However, the sed command on line 87 then resets the network_name for both VPC modules to the same value, $(vars.base_network_name), which will likely cause a resource name collision. You should probably remove the sed command on line 87 to allow your script's changes to persist.

LAVEEN and others added 7 commits March 26, 2026 08:36
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
- Revert 'Fix the network name (GoogleCloudPlatform#5315)'
- Apply python logic and fixes from GoogleCloudPlatform#5385
- Apply modify_vpc.py across all filestore integration tests
- Revert 'Fix the network name (GoogleCloudPlatform#5315)'
- Apply python logic and fixes from GoogleCloudPlatform#5385
- Apply modify_vpc.py across all filestore integration tests
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant