Skip to content

Backport: serviceentry: drain Terminating pods from ServiceEntry-derived endpoints#14334

Merged
davidjumani merged 1 commit into
kgateway-dev:v2.2.xfrom
nmnellis:backport/se-terminating-2.2
Jul 1, 2026
Merged

Backport: serviceentry: drain Terminating pods from ServiceEntry-derived endpoints#14334
davidjumani merged 1 commit into
kgateway-dev:v2.2.xfrom
nmnellis:backport/se-terminating-2.2

Conversation

@nmnellis

Copy link
Copy Markdown
Contributor

Description

Backport of #14332

Change Type

/kind fix

Changelog

Fixed north-south traffic to a global service continuing to route to a local pod for the duration of its termination grace period. kgateway now drains a terminating pod (deletionTimestamp set) from ServiceEntry-derived endpoints and fails over to a healthy peer-cluster endpoint, consistent with the east-west (ztunnel) path and the Kubernetes Service backend path.

Copilot AI review requested due to automatic review settings June 30, 2026 18:18
@gateway-bot gateway-bot added kind/fix Categorizes issue or PR as related to a bug. release-note labels Jun 30, 2026

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

Backports the ServiceEntry endpoint selection fix to drain pods that are terminating (deletionTimestamp set) from ServiceEntry-derived EDS, so north-south traffic can fail over to healthy peer-cluster endpoints instead of sticking to a locally terminating pod during its grace period.

Changes:

  • Extend LocalityPod with Ready and Terminating signals derived from Pod status/deletionTimestamp.
  • Filter ServiceEntry-derived endpoints to exclude NotReady and Terminating pod-backed workloads (while keeping WorkloadEntry/inline endpoints).
  • Add unit coverage for both NotReady and Terminating filtering, and update envtest pod fixtures to mark pods Ready.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated no comments.

Show a summary per file
File Description
pkg/krtcollections/pods.go Add Ready/Terminating to LocalityPod, include in Equals, and populate from Pod status/deletionTimestamp.
pkg/kgateway/setup/testdata/setup_yaml/pods.yaml Mark shared envtest pods as Ready so readiness-based selection behaves predictably in setup tests.
pkg/kgateway/extensions2/plugins/serviceentry/endpoints.go Skip NotReady or Terminating pod-backed workloads when building ServiceEntry-derived endpoints.
pkg/kgateway/extensions2/plugins/serviceentry/endpoints_test.go Add unit tests ensuring NotReady and Terminating pod-backed workloads are excluded while WorkloadEntry endpoints remain included.
pkg/kgateway/extensions2/plugins/serviceentry/collections.go Ensure WorkloadEntry/inline endpoints are treated as Ready: true (and implicitly non-terminating) so they aren’t filtered by local pod state.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@davidjumani
davidjumani enabled auto-merge June 30, 2026 23:35
@davidjumani
davidjumani added this pull request to the merge queue Jun 30, 2026
Merged via the queue into kgateway-dev:v2.2.x with commit 2b2e8b3 Jul 1, 2026
39 of 40 checks passed
@nmnellis
nmnellis deleted the backport/se-terminating-2.2 branch July 1, 2026 11:07
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.

4 participants