TPT-4126: Add support for NB Front-End IP in VPC-MTC + 40Gbps NB-MTC - #978
TPT-4126: Add support for NB Front-End IP in VPC-MTC + 40Gbps NB-MTC#978mawilk90 wants to merge 14 commits into
Conversation
* Added support for NB Frontend VPC IP * Address CoPilot suggestions * Removed unnecessary omitempty
* Use dynamic capabilities in createVPCWithSubnet * Modify TestNodeBalancer_Create_with_vpc to cover NB Front-End IP * Add tests for frontend VPCs in single stack * Update capabilities in createVPCWithSubnet and createVPCWithDualStackSubnet * Add func getIntersection * Add tests for premium40gb and different VPCs * Create func createVPCWithDualStackSubnetInRegion * Rename fixture in TestNodeBalancer_Create_WithBackendVPCOnly * Extract setup functions for premium NBs * Clean-up * Refactor TestNodeBalancer_Create_WthFrontendVPC to use setupNodeBalancerWithFrontendVPC * Generate fixtures with make * Rename expected to fail tests * Comment out expected to fail tests * Add two more checks to TestNodeBalancer_Create_WithFrontendVPCOnly * Solve PR remarks * Solve PR remarks * Update setupInstanceWithDualStackVPCAndNAT11 to fix failing TestVPC_List*IPv6Addresses * Add recordStopper and fixtures to expected-to-fail tests * Add t.Skip in getValidRegion in case there is no valid regions * PR review remarks: replace assert.Emtpy with assert.Nil * Linter fix
* TPT-4329 Deprecate vpcs in favor of backend_vpcs * TPT-4329 Create specific type for NB Backend VPC
…eate (#926) * TPT-4329 Deprecate vpcs in favor of backend_vpcs * TPT-4329 Create specific type for NB Backend VPC * Replace VPCs with BackendVPCs to be passed to POST /nodebalancers * Refactor tests to use newly added type for NB Backend VPC * Copilot remarks fixes --------- Co-authored-by: Dawid Dzhafarov <ddzhafar@akamai.com>
There was a problem hiding this comment.
Pull request overview
This PR extends linodego’s NodeBalancer support to cover (1) Premium 40Gbps plans and (2) NodeBalancer front-end IPs in VPC, including new VPC config list/get endpoints and corresponding unit/integration fixtures/tests.
Changes:
- Add NodeBalancer fields and create options for
frontend_vpcs,backend_vpcs(plus deprecatedvpcs) and the newpremium_40gbplan type. - Add NodeBalancer VPC config purpose support and client methods to list/get configs from
/vpcs,/backend_vpcs, and/frontend_vpcs. - Expand unit/integration test coverage and fixtures for the new NodeBalancer/VPC behaviors.
Reviewed changes
Copilot reviewed 24 out of 24 changed files in this pull request and generated 12 comments.
Show a summary per file
| File | Description |
|---|---|
nodebalancer.go |
Adds NodeBalancer front-end VPC fields, new plan type constant, and create options for frontend/backend VPCs. |
nodebalancer_config_vpc.go |
Adds VPC config purpose plus new list endpoints for backend/frontend configs. |
test/unit/nodebalancer_test.go |
Updates unit tests/fixtures assertions for the new NB fields/type and adds create tests for VPC options. |
test/unit/nodebalancer_config_vpc_test.go |
Adds unit tests for NodeBalancer VPC config list/get endpoints. |
test/unit/fixtures/nodebalancers_list.json |
Updates list fixture to include type and front-end VPC fields. |
test/unit/fixtures/nodebalancer_get.json |
Updates get fixture to include type and front-end VPC fields. |
test/unit/fixtures/nodebalancer_create_with_vpcs.json |
Adds create fixture for NB with backend/frontend VPCs. |
test/unit/fixtures/nodebalancer_vpc_config_*.json |
Adds fixtures for VPC config list/get endpoints. |
test/integration/nodebalancers_test.go |
Adds integration tests for frontend/backend VPC scenarios and premium_40gb. |
test/integration/vpc_subnet_test.go |
Ensures VPC setup selects regions with NodeBalancer capability. |
test/integration/instance_config_test.go |
Updates region selection to use capability filtering (no hardcoded region). |
test/integration/util_test.go |
Adds generic getIntersection helper used for region selection. |
test/integration/fixtures/TestNodeBalancer_*.yaml |
Adds recorded fixtures for new integration test scenarios. |
Comments suppressed due to low confidence (1)
test/unit/nodebalancer_test.go:99
- This test’s expectations depend on the position of the test case in
tests(viaidx), making it brittle if the table ordering changes. Prefer branching on a stable attribute (e.g.,tt.fixture) or adding explicit expected fields to the table.
for idx, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
fixtureData, err := fixtures.GetFixture(tt.fixture)
assert.NoError(t, err)
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| } | ||
|
|
||
| type NodeBalancerBackendVPCOptions struct { | ||
| IPv4Range string `json:"ipv4_range,omitzero"` |
There was a problem hiding this comment.
Should this be a pointer?
|
|
||
| type NodeBalancerBackendVPCOptions struct { | ||
| IPv4Range string `json:"ipv4_range,omitzero"` | ||
| IPv6Range string `json:"ipv6_range,omitzero"` |
| IPv4Range string `json:"ipv4_range,omitzero"` | ||
| IPv6Range string `json:"ipv6_range,omitzero"` | ||
| SubnetID int `json:"subnet_id"` | ||
| IPv4RangeAutoAssign bool `json:"ipv4_range_auto_assign,omitzero"` |
| } | ||
|
|
||
| type NodeBalancerFrontendVPCOptions struct { | ||
| IPv4Range string `json:"ipv4_range,omitzero"` |
|
|
||
| type NodeBalancerFrontendVPCOptions struct { | ||
| IPv4Range string `json:"ipv4_range,omitzero"` | ||
| IPv6Range string `json:"ipv6_range,omitzero"` |
There was a problem hiding this comment.
Hi @ezilber-akamai, all the fields you mentioned above (IPv4Range, IPv6Range, IPv4RangeAutoAssign) seems to be optional and can be skipped in the API request. Does it mean that they need to be a pointers for omitzero anyway? In the current implementation, aren't both "" and lack of these fields treated the same?
📝 Description
This PR merges support for NB Front-End IP + 40Gbps features into the main branch for release.
NOTE:
✔️ How to Test
make test-unitmake test-int TEST_ARGS="-run TestNodeBalancer_Create_With"