Project: Add support for NB Front-End IP in VPC-MTC + 40Gbps NB-MTC#699
Project: Add support for NB Front-End IP in VPC-MTC + 40Gbps NB-MTC#699mawilk90 wants to merge 4 commits into
Conversation
* Add support for NB frontend VPC IP and NB plan type * Fix test fixture and doc link * Fix NodeBalancerVPCConfig struct and address copilot suggestions * Fix doc links
* Create integration tests for NodeBalancer Front-End IP & 40Gbps * Update TODO message * Linter fixes * Copilot remarks refactor * Remove redundant variables (PR remarks) * Modify tests to filter out invalid regions for premium NBs * Modify test names to indicate that test is expected to fail * Add DevCloud region to PREMIUM_REGIONS * Linter fix * Add note about no DevCloud region in PREMIUM_40GB_REGIONS list
…eate (#676) * Replace vpcs with backend_vpcs to be passed to POST /nodebalancers * Add test for deprecated VPCs attribute
There was a problem hiding this comment.
Pull request overview
Adds SDK support for two new NodeBalancer features: VPC front-end IP (configurable via frontend_vpcs/backend_vpcs on create) and the new premium_40gb NodeBalancer type. Exposes a NodeBalancerVPCConfig derived object plus vpcs(), vpc(id), backend_vpcs(), and frontend_vpcs() accessors on NodeBalancer, along with new read-only attributes type, frontend_address_type, and frontend_vpc_subnet_id. Adds unit and integration test coverage (including new VPC/region fixtures), with some integration assertions for backend_vpcs/frontend_vpcs left commented as TODO pending the corresponding API endpoints.
Changes:
- New
NodeBalancerVPCConfigDerivedBase + four nested-endpoint accessors and three new read-onlyNodeBalancerproperties. - New integration test scenarios covering backend-only VPC, IPv4-only single-stack VPC frontends, premium/
premium_40gbtypes, mixed front/backend VPCs, and deprecatedvpcsattribute; supported by a newvalid_regionsfilter inget_regionand new VPC fixtures. - New/updated unit fixtures and tests for list/get NodeBalancers and VPC config endpoints.
Reviewed changes
Copilot reviewed 10 out of 10 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| linode_api4/objects/nodebalancer.py | Adds NodeBalancerVPCConfig, new model fields, and vpcs/vpc/backend_vpcs/frontend_vpcs methods. |
| test/integration/conftest.py | Adds valid_regions filter to get_region and new VPC session/function fixtures including premium region variant. |
| test/integration/models/nodebalancer/test_nodebalancer.py | Adds premium region constants and integration tests for VPC frontend/backend scenarios and premium_40gb type. |
| test/unit/objects/nodebalancers_test.py | Adds unit tests for list/get NodeBalancer and the new VPC accessor methods. |
| test/fixtures/nodebalancers.json | Adds type, frontend_address_type, frontend_vpc_subnet_id fields to the two NodeBalancer entries. |
| test/fixtures/nodebalancers_123456.json | Adds the same three new fields to the single-NB fixture. |
| test/fixtures/nodebalancers_12345_vpcs.json | New fixture for the VPC config list endpoint. |
| test/fixtures/nodebalancers_12345_vpcs_99.json | New fixture for the single VPC config endpoint. |
| test/fixtures/nodebalancers_12345_frontend__vpcs.json | New fixture for the frontend_vpcs endpoint. |
| test/fixtures/nodebalancers_12345_backend__vpcs.json | New fixture for the backend_vpcs endpoint. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| API Documentation: TODO | ||
|
|
||
| :returns: A List of NodeBalancerVPCConfig of the Linode NodeBalancer. | ||
| :rtype: List[NodeBalancerVPCConfig] | ||
| """ | ||
| result = self._client.get( | ||
| "{}/backend_vpcs".format(NodeBalancer.api_endpoint), model=self | ||
| ) | ||
|
|
||
| return [ | ||
| NodeBalancerVPCConfig(self._client, vpc["id"], self.id, json=vpc) | ||
| for vpc in result["data"] | ||
| ] | ||
|
|
||
| def frontend_vpcs(self): | ||
| """ | ||
| View VPC information for frontend VPCs associated with this NodeBalancer. | ||
|
|
||
| API Documentation: TODO |
| PREMIUM_REGIONS = [ | ||
| "nl-ams", | ||
| "jp-tyo-3", | ||
| "sg-sin-2", | ||
| "de-fra-2", | ||
| "in-bom-2", | ||
| "gb-lon", | ||
| "us-lax", | ||
| "id-cgk", | ||
| "us-mia", | ||
| "it-mil", | ||
| "jp-osa", | ||
| "in-maa", | ||
| "se-sto", | ||
| "br-gru", | ||
| "us-sea", | ||
| "fr-par", | ||
| "us-iad", | ||
| "pl-labkrk-2", # DevCloud | ||
| ] | ||
| PREMIUM_40GB_REGIONS = ["us-iad"] # No DevCloud region for premium_40gb type |
| regions = get_regions(client, capabilities, site_type) | ||
|
|
||
| # To filter out regions that cannot be used for the Linode resource | ||
| if valid_regions: | ||
| regions = [reg for reg in regions if reg.id in valid_regions] | ||
|
|
||
| return random.choice(regions) |
📝 Description
This PR merges support for NB Front-End IP + 40Gbps features into the dev branch for release.
✔️ How to Test
make test-unitmake test-int TEST_SUITE=nodebalancer TEST_ARGS="-k test_nb_with"