Skip to content

Add support for VPC direct connect#1823

Open
inlined wants to merge 6 commits intomasterfrom
inlined.vpc-dc
Open

Add support for VPC direct connect#1823
inlined wants to merge 6 commits intomasterfrom
inlined.vpc-dc

Conversation

@inlined
Copy link
Member

@inlined inlined commented Mar 6, 2026

Part 1 of 2 (will require CLI changes).

This adds the VPC direct connect settings (network interfaces) to the Global Options object. It also updates the way we create the "manifest" (proprietary IaC YAML) to emit this. This feature will only light up with a new version of the CLI that recognizes this YAML format and supports it.

@gemini-code-assist
Copy link
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 lays the groundwork for supporting VPC direct connect by extending the GlobalOptions object with new properties for network interfaces and updating the internal manifest generation. This change enables the system to configure direct VPC connections, offering more granular control over network settings, and is the first part of a two-part feature that will be completed with subsequent CLI changes.

Highlights

  • New VPC Direct Connect Options: Introduced a new NetworkInterface type and added networkInterface and vpcEgress properties to the GlobalOptions interface to support direct VPC network connections.
  • Manifest Structure Update: Modified the ManifestEndpoint interface to include networkInterfaces within the vpc object, allowing the manifest to represent direct VPC connections.
  • Option Conversion Logic: Refactored the optionsToEndpoint function to correctly process the new VPC direct connect settings, including mutual exclusivity checks between vpcConnector and networkInterface, and handling of RESET_VALUE.

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Changelog
  • spec/v2/options.spec.ts
    • Imported optionsToEndpoint and RESET_VALUE for testing.
    • Added a new test suite for optionsToEndpoint to validate VPC direct connect configurations, including mutual exclusivity checks and reset scenarios.
  • src/runtime/manifest.ts
    • Modified the vpc property within the ManifestEndpoint interface to make connector optional and added a new networkInterfaces property to support direct VPC connections.
  • src/v2/options.ts
    • Defined the NetworkInterface interface to specify details for direct VPC network connections.
    • Added a JSDoc comment to vpcConnector to clarify its mutual exclusivity with networkInterface.
    • Introduced vpcEgress as an alias for vpcConnectorEgressSettings and added the networkInterface property to the GlobalOptions interface.
    • Adjusted optionsToTriggerAnnotations to correctly handle the new vpcEgress alias.
    • Refactored the optionsToEndpoint function to process vpcConnector, vpcEgress, and networkInterface properties, incorporating logic for mutual exclusivity and RESET_VALUE handling.
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.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

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
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 adds support for VPC direct connect by introducing a networkInterface option. The changes are mostly in v2/options.ts to handle the new configuration and translate it to the manifest format. I've identified a few areas for improvement, including a high-severity type issue hidden by an as any cast which could lead to runtime problems, an unnecessary type cast, and a missing validation for the new networkInterface option. My review comments include suggestions to fix these issues.

@inlined
Copy link
Member Author

inlined commented Mar 6, 2026

/gemini review

Copy link
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 adds support for VPC direct connect by updating the Global Options, manifest definition, and related processing logic. The changes are generally well-structured and include corresponding tests. However, I've identified a couple of issues in the optionsToEndpoint function that could lead to incorrect manifest generation under certain conditions. My review comments provide specific suggestions to address these issues and improve the robustness of the VPC configuration handling.

/**
* Network Interface to use with VPC Direct Connect
*/
networkInterface?: NetworkInterface | ResetValue;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I noticed that in manifest.ts, we support an array of network interfaces. But here we only expose a singular object. Is it something that was intentional or do we plan on something like networkInterfaces?: NetworkInterface | NetworkInterface[] in the future?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great question, and yes. The Google API is a plural but only supports arrays of size one. To support ergonomics, we will currently only accept a singular in our API and eventually support a plural if GCF ever supports one, but our wire format will always be plural to avoid mistakes.

This is part of the predictability principle that you should be forgiving in what you accept (e.g. singular or plural) but strict in what you produce (plural)

convertIfPresent(endpoint, opts, "serviceAccountEmail", "serviceAccount");
if (opts.vpcConnector !== undefined) {
if (opts.vpcConnector === null || opts.vpcConnector instanceof ResetValue) {
const vpcEgress = opts.vpcEgress ?? opts.vpcConnectorEgressSettings;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

iiuc, it looks like we are silently prioritizing vpcEgress if both that and vpcConnectorEgressSettings are provided. Was curious if we want to log a warning if a user accidentally supplies both, or is the alias behavior intended to be a silent override?

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.

3 participants