Skip to content

fix: preserve localityLbSetting.enabled=false in Istio destination rules - #1964

Open
kei-gnu wants to merge 1 commit into
fluxcd:mainfrom
kei-gnu:fix-locality-lb-enabled-false
Open

fix: preserve localityLbSetting.enabled=false in Istio destination rules#1964
kei-gnu wants to merge 1 commit into
fluxcd:mainfrom
kei-gnu:fix-locality-lb-enabled-false

Conversation

@kei-gnu

@kei-gnu kei-gnu commented Aug 25, 2026

Copy link
Copy Markdown
Contributor

Related #1719

Summary

LocalityLbSetting.Enabled is a plain bool with omitempty, so an explicit enabled: false in trafficPolicy.loadBalancer.localityLbSetting is dropped from the generated DestinationRules (localityLbSetting: {}).

Istio treats an unset enabled as the mesh-wide default (enabled), and locality failover is activated whenever outlierDetection is set. Users who set enabled: false to keep traffic evenly distributed across zones silently end up with zone-prioritized routing.

Changes

  • Changed LocalityLbSetting.Enabled from bool to *bool so that false round-trips into the DestinationRule (regenerated deepcopy)
  • Added a regression test (TestIstioRouter_LocalityLbSettingEnabledFalse)
  • No CRD change: enabled is already declared as boolean

Testing

Verified locally against kind (Kubernetes 1.35.1) with Istio 1.29.2, using a Flagger image built from this branch.
A Canary with:

trafficPolicy:
  loadBalancer:
    simple: RANDOM
    localityLbSetting:
      enabled: false
  outlierDetection:
    consecutive5xxErrors: 5
    interval: 10s
    baseEjectionTime: 10s

With v1.44.0 the generated podinfo-primary / podinfo-canary DestinationRules lose the flag:

  trafficPolicy:
    loadBalancer:
      localityLbSetting: {}
      simple: RANDOM

With this branch both DestinationRules keep it:

  trafficPolicy:
    loadBalancer:
      localityLbSetting:
        enabled: false
      simple: RANDOM
    outlierDetection:
      baseEjectionTime: 10s
      consecutive5xxErrors: 5
      interval: 10s

Also confirmed on the client sidecar (pilot-agent request GET clusters, two zone-labelled nodes) that the endpoints are no longer split into priority: 0/1 by zone once the flag reaches Istio.

Signed-off-by: kei-gnu <61653118+kei-gnu@users.noreply.github.com>
@kei-gnu
kei-gnu force-pushed the fix-locality-lb-enabled-false branch from ab8ff8a to 9116043 Compare August 25, 2026 08:02
@kei-gnu
kei-gnu marked this pull request as ready for review August 25, 2026 08:12
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.

1 participant