Skip to content

fix: Per-route load balancing algorithm not reverting to platform default on removal#552

Open
hoffmaen wants to merge 3 commits intocloudfoundry:developfrom
sap-contributions:fix-pool-lb-algorithm-reset
Open

fix: Per-route load balancing algorithm not reverting to platform default on removal#552
hoffmaen wants to merge 3 commits intocloudfoundry:developfrom
sap-contributions:fix-pool-lb-algorithm-reset

Conversation

@hoffmaen
Copy link
Copy Markdown
Contributor

@hoffmaen hoffmaen commented Apr 9, 2026

Summary

Fixes the bug where removing a per-route load balancing algorithm (e.g., via cf update-route -r loadbalancing) left the pool using the old algorithm instead of reverting to the platform default. Fixes #551

Changes

  • Use *string for LoadBalancingAlgorithm in the NATS message struct to distinguish absent fields from explicitly empty values
  • Default the endpoint's load balancing algorithm to the global platform algorithm (config.LoadBalance) in mbus/subscriber.go; only override when the NATS message contains a non-empty value
  • Clean up hash-based routing state (HashLookupTable, HashRoutingProperties) in EndpointPool.setPoolLoadBalancingAlgorithm when switching away from hash-based routing

Requires [companion CC change|https://github.com/cloudfoundry/cloud_controller_ng/pull/5010] to preserve nil option values as empty strings instead of dropping them.

Backward Compatibility

Breaking Change? No

…-route algorithm is removed

When a per-route load balancing algorithm (e.g. hash-based) was removed,
the pool retained the old algorithm because setPoolLoadBalancingAlgorithm
ignored empty values. This fix distinguishes between "field absent" (no
change) and "field explicitly empty" (reset to default) by using a
*string in the NATS message struct and a sentinel value LOAD_BALANCE_DEFAULT.
hoffmaen and others added 2 commits April 10, 2026 14:05
Co-authored-by: Tamara Boehm <tamara.boehm@sap.com>
@hoffmaen hoffmaen marked this pull request as ready for review April 10, 2026 13:09
@hoffmaen hoffmaen requested a review from a team as a code owner April 10, 2026 13:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Development

Successfully merging this pull request may close these issues.

Per-route load balancing algorithm is not reset to platform default when removed from a route

1 participant