Skip to content

Conversation

@komer3
Copy link
Contributor

@komer3 komer3 commented Dec 16, 2025

General:

  • Have you removed all sensitive information, including but not limited to access keys and passwords?
  • Have you checked to ensure there aren't other open or closed Pull Requests for the same bug/feature/question?

Pull Request Guidelines:

  1. Does your submission pass tests?
  2. Have you added tests?
  3. Are you addressing a single feature in this PR?
  4. Are your commits atomic, addressing one change per commit?
  5. Are you following the conventions of the language?
  6. Have you saved your large formatting changes for a different PR, so we can focus on your work?
  7. Have you explained your rationale for why this feature is needed?
  8. Have you linked your PR to an open issue

komer3 and others added 9 commits December 8, 2025 14:16
Add support for configuring NodeBalancer frontend VPC placement via
service annotations. This enables NodeBalancers to be deployed with
private frontend addresses within a VPC.

New annotations:
- linode-loadbalancer-frontend-ipv4-range: Explicit IPv4 CIDR
- linode-loadbalancer-frontend-ipv6-range: Explicit IPv6 CIDR
- linode-loadbalancer-frontend-vpc-name: VPC name for resolution
- linode-loadbalancer-frontend-subnet-name: Subnet name for resolution
- linode-loadbalancer-frontend-subnet-id: Direct subnet ID

Resolution precedence:
1. IPv4/IPv6 Range annotations (explicit CIDR)
2. VPC/Subnet name annotations (name-based resolution)
3. Subnet ID annotation (direct ID)

Key behavioral difference from backend VPC implementation:
- Frontend VPC is opt-in: returns nil when no annotations are present,
  resulting in no frontend VPC configuration
- Backend VPC is always configured: falls through precedence levels and
  always returns VPC options using the service's default subnet ID

This design allows frontend VPC to remain an optional feature while
backend VPC continues to be mandatory for NodeBalancer operation.

Includes:
- CIDR validation for IPv4 and IPv6 ranges
- Name-to-ID resolution requiring both vpc-name and subnet-name
- Unit tests for validation, status generation, and option building
- Debug logging for frontend VPC NodeBalancers
- Change annotation precedence order: subnet-id first, then vpc-name/subnet-name, then optional IP ranges
- Consolidate IPv4/IPv6 validation into single validateNodeBalancerFrontendIPRange function
- Simplify getFrontendVPCCreateOptions to reduce code duplication and improve readability
- Make IP range annotations optional when subnet is specified
- Add error when IP ranges are provided without subnet selector
- Update tests to cover more senarios
- Document new frontend VPC annotations: frontend-subnet-id, frontend-vpc-name, frontend-subnet-name, frontend-ipv4-range, frontend-ipv6-range
- Document backend-subnet-id annotation
- Add detailed frontend VPC configuration section explaining annotation precedence and usage
- Update backend VPC annotation examples to use correct backend-vpc-name and backend-subnet-name prefixes
- Add reference to vpc-frontend-example.yaml in examples
@codecov
Copy link

codecov bot commented Dec 16, 2025

Codecov Report

❌ Patch coverage is 73.58491% with 14 lines in your changes missing coverage. Please review.
✅ Project coverage is 73.69%. Comparing base (ab91991) to head (e9c21d8).

Files with missing lines Patch % Lines
cloud/linode/loadbalancers.go 72.54% 7 Missing and 7 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #506      +/-   ##
==========================================
- Coverage   73.72%   73.69%   -0.03%     
==========================================
  Files          19       19              
  Lines        2835     2885      +50     
==========================================
+ Hits         2090     2126      +36     
- Misses        504      511       +7     
- Partials      241      248       +7     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

…et-name annotations. Change annotation check from OR to AND logic for vpc-name and subnet-name
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.

2 participants