Add support for VPC direct connect in GCF 2nd gen#10033
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 introduces comprehensive support for VPC direct connect functionality for Google Cloud Functions 2nd generation. This feature allows users to define specific network interfaces for their functions, enabling direct and secure communication within their Google Cloud VPC without relying solely on VPC connectors. The changes involve significant updates to internal data models, parameter resolution, and the translation layer that interfaces with the Cloud Functions v2 API, ensuring seamless integration and deployment of functions with direct VPC connectivity. Highlights
🧠 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
Activity
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 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 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
|
There was a problem hiding this comment.
Code Review
This pull request adds support for VPC direct connect in GCF 2nd gen functions. The changes include updating data structures across the deployment pipeline to accommodate the new networkInterfaces configuration and modifying the translation logic between internal representations and the GCFv2 API. New validation and tests have been added to ensure correctness. The implementation is solid, and I have one minor suggestion to improve code conciseness.
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
| networkInterfaces: "array?", | ||
| }); | ||
| requireKeys(prefix + ".vpc", ep.vpc, "connector"); | ||
| if (!ep.vpc.connector && !ep.vpc.networkInterfaces) { |
There was a problem hiding this comment.
Based on the logic here, it looks like its checking if at least one if present but it also looks like it allows both connector and networkInterfaces to be present (and iiuc, then silently prioritize connector and drop networkInterfaces if both are present)? Do we want to allow clients to provide both or should we log a warning or error if they do?
There was a problem hiding this comment.
Great check. Throwing an error.
src/gcp/cloudfunctionsv2.ts
Outdated
| ); | ||
| } else if (gcfFunction.serviceConfig.directVpcNetworkInterface) { | ||
| endpoint.vpc = { networkInterfaces: gcfFunction.serviceConfig.directVpcNetworkInterface }; | ||
| if ( |
There was a problem hiding this comment.
optional nit: wondering if it makes sense to use string replacement or mapping dictionary here to safeguard against any future additions that might not start with "VPC_EGRESS_"?
There was a problem hiding this comment.
Yeah doesn't hurt. You're definitely going to hold me to a higher standard for validation it seems 😊
Companion PR to firebase/firebase-functions#1823.
Successfully tested e2e with
