Skip to content

[2.3] fixes an issue where unhealthy endpoints for service entries are not removed from routing#14262

Merged
andy-fong merged 2 commits into
v2.3.xfrom
bp-14222
Jun 18, 2026
Merged

[2.3] fixes an issue where unhealthy endpoints for service entries are not removed from routing#14262
andy-fong merged 2 commits into
v2.3.xfrom
bp-14222

Conversation

@davidjumani

Copy link
Copy Markdown
Contributor

backport of #14222

Description

ServiceEntry clusters that select pod endpoints via workloadSelector now respect pod readiness: pod-backed endpoints whose Kubernetes Ready condition is not True are excluded from the cluster's EDS, mirroring the EndpointSlice-based Service path. This lets locality failover promote endpoints in a peer cluster when all local pods for a selected workload go NotReady (e.g. during graceful termination, where kubelet flips the pod's Ready condition to False).

Scope:

  • Only ServiceEntries with workloadSelector-backed pod endpoints are affected.
  • WorkloadEntry and inline ServiceEntry endpoints are treated as always Ready and are never filtered, since pod readiness does not apply to them (their health is managed by the remote/owning system).

Change Type

/kind fix

Changelog

ServiceEntry clusters with workloadSelector-backed pod endpoints now respect pod readiness: NotReady pods are excluded from routing, matching the EndpointSlice-based Service behavior and enabling locality failover when all locally selected pods are NotReady. WorkloadEntry and inline ServiceEntry endpoints are unaffected.

Copilot AI review requested due to automatic review settings June 16, 2026 13:08
@gateway-bot gateway-bot added kind/fix Categorizes issue or PR as related to a bug. release-note labels Jun 16, 2026
…removed from routing (#14222)

Signed-off-by: Nick Nellis <[email protected]>
Signed-off-by: David Jumani <[email protected]>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR backports a fix to ensure ServiceEntry clusters that select pod endpoints via workloadSelector respect Kubernetes pod readiness by excluding NotReady pods from generated EDS, aligning behavior with the EndpointSlice/Service path and enabling locality failover when local pods go NotReady.

Changes:

  • Add a Ready field to krtcollections.LocalityPod, include it in equality, and populate it from the pod’s Ready condition.
  • Filter NotReady pod-backed workloads in ServiceEntry endpoint generation, while explicitly treating WorkloadEntry/inline endpoints as always ready.
  • Add/adjust tests and test fixtures to include pod readiness conditions.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
pkg/krtcollections/pods.go Tracks pod readiness on LocalityPod and includes it in change detection.
pkg/kgateway/setup/testdata/setup_yaml/pods.yaml Updates pod test fixtures to include a Ready=True condition.
pkg/kgateway/extensions2/plugins/serviceentry/endpoints.go Skips NotReady pod-backed workloads when building ServiceEntry endpoints.
pkg/kgateway/extensions2/plugins/serviceentry/endpoints_test.go Adds a unit test covering skipping NotReady pods (currently has a compile-breaking call signature).
pkg/kgateway/extensions2/plugins/serviceentry/collections.go Marks WorkloadEntry/inline workloads as Ready=true so they are not filtered.

Comment on lines +48 to +53
weWorkload := selectedWorkloadFromEntry(
"cross-cluster", "server",
nil, nil, nil,
&networking.WorkloadEntry{Address: "10.0.0.3"},
nil,
)
@andy-fong
andy-fong added this pull request to the merge queue Jun 18, 2026
Merged via the queue into v2.3.x with commit f51cdf6 Jun 18, 2026
31 checks passed
@andy-fong
andy-fong deleted the bp-14222 branch June 18, 2026 14:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

kind/fix Categorizes issue or PR as related to a bug. release-note

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants