Skip to content

[Multi-SLB] lb selection logic upgrade #10051

@nilo19

Description

@nilo19

What would you like to be added:

In multi-SLB mode, an existing load balancer that does not have any Service placed on it should be treated the same as a non-existent load balancer during default LB selection.

Today, getMostEligibleLBForService() treats any matching LB object as "existing" and therefore skips it in the "pick the first eligible LB that does not exist yet" step. This causes surprising placement when an
external LB already exists for cluster plumbing but has no Service using it.

Example:

  • multipleStandardLoadBalancerConfigurations = [kubernetes, lb-2]
  • kubernetes external LB object already exists
  • kubernetes has no Service rules / no Service using it. e.g., only contains external rules to host outbound traffic.
  • lb-2 does not exist yet

Current behavior:

  • first internal Service picks kubernetes-internal
  • first external Service picks lb-2

Requested behavior:

  • the empty existing kubernetes LB should be treated as "not exist" for placement purposes
  • the first Service should pick kubernetes regardless of whether it is internal or external
  • lb-2 should only be preferred once kubernetes is actually in use by Service traffic, or based on the normal fewest-rules balancing after both are meaningfully in service

In other words, "LB object exists but has no Service in it" should not change the default placement outcome.

Why is this needed:

The current behavior is inconsistent and surprising:

  • internal and external Services can land on different default LB configs even with the same config order
  • the result depends on whether an empty external LB object already exists, not on actual Service usage
  • this makes default placement less deterministic and harder for operators to reason about

Treating an empty LB as equivalent to "not exist yet" would make the behavior more intuitive:

  • config order remains authoritative for the first Service placement
  • internal and external placement become consistent
  • cluster-created but unused LB objects do not skew Service placement unexpectedly

If useful, I can also turn this into a concrete proposal with acceptance criteria and test scenarios.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions