Skip to content

feat: add LoadBalancerSourceRanges and LoadBalancerClass#7433

Open
MayorFaj wants to merge 1 commit intoprojectcontour:mainfrom
MayorFaj:feat/7334-support-lbclass
Open

feat: add LoadBalancerSourceRanges and LoadBalancerClass#7433
MayorFaj wants to merge 1 commit intoprojectcontour:mainfrom
MayorFaj:feat/7334-support-lbclass

Conversation

@MayorFaj
Copy link

Fixes #7334

What this PR does / why we need it

The Contour Gateway Provisioner had no way to configure two standard
Kubernetes Service fields on the provisioned Envoy Service:

  • spec.loadBalancerSourceRanges — restricts inbound traffic to specific
    client CIDRs at the load balancer level
  • spec.loadBalancerClass — selects a specific load balancer implementation

This PR exposes both fields through ContourDeployment.spec.envoy.networkPublishing,
following the same pattern used by existing fields (externalTrafficPolicy,
ipFamilyPolicy, serviceAnnotations).

Changes

API

  • Added loadBalancerSourceRanges []string and loadBalancerClass *string
    to the NetworkPublishing struct in ContourDeployment
  • Regenerated deep copy and CRD YAML

Provisioner

  • Added both fields to EnvoyNetworkPublishing in the internal model
  • Gateway controller maps the new params → model fields
  • DesiredEnvoyService applies both fields, guarded inside the
    LoadBalancerService case only (they have no meaning for NodePort or ClusterIP)
  • LoadBalancerServiceChanged tracks drift for both fields

Tests

  • TestDesiredEnvoyService — asserts fields are set for LoadBalancerService
    and absent for NodePortService
  • TestLoadBalancerServiceChanged — three new cases covering changed source
    ranges, unchanged (equal non-empty) source ranges, and changed class
  • Gateway controller integration test — full path from ContourDeployment
    params to Service spec

Docs

  • Added a YAML example and immutability note for loadBalancerClass to
    site/content/docs/main/config/gateway-api.md

…blishing

Signed-off-by: MayorFaj <mayorfaj@gmail.com>
@MayorFaj MayorFaj requested a review from a team as a code owner February 22, 2026 23:50
@MayorFaj MayorFaj requested review from sunjayBhatia and tsaarni and removed request for a team February 22, 2026 23:50
@sunjayBhatia sunjayBhatia requested review from a team, clayton-gonsalves and izturn and removed request for a team February 22, 2026 23:50
@github-actions
Copy link

Hi @MayorFaj! Welcome to our community and thank you for opening your first Pull Request. Someone will review it soon. Thank you for committing to making Contour better. You can also join us on our mailing list and in our channel in the Kubernetes Slack Workspace

@MayorFaj
Copy link
Author

@tsaarni , when ever you get the chance

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.

Support configuring Envoy Service loadBalancerSourceRanges/loadBalancerClass via ContourDeployment

1 participant