Skip to content

Conversation

@komer3
Copy link
Contributor

@komer3 komer3 commented Dec 8, 2025

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

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

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
@github-actions github-actions bot added the new-feature for new features in the changelog. label Dec 8, 2025
@codecov
Copy link

codecov bot commented Dec 10, 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 (9966fd8) to head (c0cf59d).
⚠️ Report is 6 commits behind head on main.

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     #501      +/-   ##
==========================================
- 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.

@komer3 komer3 marked this pull request as ready for review December 15, 2025 20:58
)

replace (
github.com/linode/linodego => github.com/komer3/linodego v0.0.0-20251201202808-852faf57b6e0
Copy link
Contributor

Choose a reason for hiding this comment

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

Are we blocked on a new linodego release?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah. I have a PR open for this here: linode/linodego#857.

Once this feature goes GA, they'll merge that, I think, hopefully.

- 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
SubnetID: intfVPCIP.SubnetID,
IPv4: &linodego.VPCInterfaceIPv4CreateOptions{Ranges: linodeInterfaceRoutes},
VPC: &linodego.VPCInterfaceUpdateOptions{
IPv4: &linodego.VPCInterfaceIPv4CreateOptions{Ranges: &linodeInterfaceRoutes},
Copy link
Contributor

Choose a reason for hiding this comment

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

Just for clarification, are we removing this because we're changing how we determine the subnet ID?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

noo. So there was a change in linodego for VPCInterfaceUpdateOptions which removed the requirement for subnetID. But I'm honestly not entirely sure about it. The linode api docs still say it is required but the linodego team removed it. Need to verify this change

Linode API doc: https://techdocs.akamai.com/linode-api/reference/put-linode-interface
LinodeGo change: https://github.com/linode/linodego/pull/825/changes#diff-b7b79f1ac09ee75185e8a967df69488f9fe9597d89aaa80d50296d9c028ee7d9R125

…et-name annotations. Change annotation check from OR to AND logic for vpc-name and subnet-name
@AshleyDumaine
Copy link
Contributor

Changes look good to me though I'd like to wait for your change to land in linodego first so we don't need to use a fork

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

new-feature for new features in the changelog.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants