Repository navigation
Conversation
Contributor
Author
|
/test |
joamaki
force-pushed
the
pr/joamaki/lb-graceful-termination-of-not-serving
branch
6 times, most recently
from
August 6, 2025 16:45
4ab9dc9 to
3a56eac
Compare
joamaki
force-pushed
the
pr/joamaki/lb-graceful-termination-of-not-serving
branch
from
August 8, 2025 10:04
3a56eac to
5fe283a
Compare
Contributor
Author
|
/test |
joamaki
force-pushed
the
pr/joamaki/lb-graceful-termination-of-not-serving
branch
from
August 8, 2025 12:37
5fe283a to
42fd2c8
Compare
Contributor
Author
|
/test |
joamaki
marked this pull request as ready for review
August 11, 2025 09:30
joamaki
enabled auto-merge
August 11, 2025 09:31
borkmann
reviewed
Aug 11, 2025
borkmann
reviewed
Aug 11, 2025
aanm
approved these changes
Aug 12, 2025
A terminating pod that no longer signals readiness will be seen as an
endpoint with {ready: false, serving: false, terminating: true}. These
were skipped leading to the backend being removed from the backends map
which causes connection disruptions.
Fix this by keeping the non-serving terminating backends in the backends BPF
map, but not using it as a fallback backend if only terminating backends exists.
This is implemented by:
- Including all conditions in [k8s.Backend], not just Terminating.
- Adding a new backend state (TerminatingNotServing) used with Terminating&!Serving conditions.
- Not considering TerminatingNotServing backends when selecting the backends.
Signed-off-by: Jussi Maki <[email protected]>
joamaki
force-pushed
the
pr/joamaki/lb-graceful-termination-of-not-serving
branch
from
August 15, 2025 09:31
803742a to
1059edd
Compare
Contributor
Author
|
/test |
Member
|
Dropped the needs-backport label for the moment, given #41199 |
Contributor
Author
|
Will need to look at #41244 first and then it’ll make sense to backport. Will try to get to this next week. |
Contributor
This was referenced Jul 20, 2026
This was referenced Sep 14, 2026
ankitaojha123
added a commit
to ankitaojha123/cilium
that referenced
this pull request
Sep 16, 2026
In Cilium 1.18, commit c09922f (PR cilium#40969) retained terminating backends in BPF maps to allow graceful TCP connection draining. However, because connectionless UDP datagrams do not contain TCP SYN flags, subsequent UDP packets from client sockets with existing Conntrack entries evaluated `!state->syn` as true. This trapped UDP traffic on terminating pods for the duration of the termination grace period (20–45s), causing packet loss during rolling updates and pod deletions. This change adds `tuple->nexthdr != IPPROTO_UDP` to the connection draining check in both `lb4_local()` and `lb6_local()`. As a result: 1. TCP connections continue to gracefully drain to terminating backends. 2. UDP packets immediately bypass draining, select an active healthy backend, and update the Conntrack entry. 3. Fallback to terminating backends when no active backends exist (KEP-1669) remains fully preserved when `svc->count == 0`. Additionally, extends `tc_nodeport_lb_terminating_backend.c` to verify that subsequent UDP datagrams redirect to active backends when active backends are present. Fixes cilium#48714 Signed-off-by: Ankita Ojha <[email protected]>
ankitaojha123
added a commit
to ankitaojha123/cilium
that referenced
this pull request
Sep 17, 2026
In Cilium 1.18, commit c09922f (PR cilium#40969) retained terminating backends in BPF maps to allow graceful TCP connection draining. However, because connectionless UDP datagrams do not contain TCP SYN flags, subsequent UDP packets from client sockets with existing Conntrack entries evaluated `!state->syn` as true. This trapped UDP traffic on terminating pods for the duration of the termination grace period (20–45s), causing packet loss during rolling updates and pod deletions. This change adds `tuple->nexthdr != IPPROTO_UDP` to the connection draining check in both `lb4_local()` and `lb6_local()`. As a result: 1. TCP connections continue to gracefully drain to terminating backends. 2. UDP packets immediately bypass draining, select an active healthy backend, and update the Conntrack entry. 3. Fallback to terminating backends when no active backends exist (KEP-1669) remains fully preserved when `svc->count == 0`. Tests: - Updated `tc_nodeport_lb_terminating_backend.c` to use TCP, verifying that existing TCP connections continue draining to terminating backends. - Added `tc_nodeport_lb_terminating_backend_udp.c` to verify that UDP datagrams immediately redirect to active backends when available, and fall back when no active backends remain. Fixes cilium#48714 Signed-off-by: Ankita Ojha <[email protected]>
ankitaojha123
added a commit
to ankitaojha123/cilium
that referenced
this pull request
Sep 18, 2026
In Cilium 1.18, commit c09922f (PR cilium#40969) retained terminating backends in BPF maps to allow graceful TCP connection draining. However, because connectionless UDP datagrams do not contain TCP SYN flags, subsequent UDP packets from client sockets with existing Conntrack entries evaluated `!state->syn` as true. This trapped UDP traffic on terminating pods for the duration of the termination grace period (20–45s), causing packet loss during rolling updates and pod deletions. This change adds `tuple->nexthdr != IPPROTO_UDP` to the connection draining check in both `lb4_local()` and `lb6_local()`. As a result: 1. TCP connections continue to gracefully drain to terminating backends. 2. UDP packets immediately bypass draining, select an active healthy backend, and update the Conntrack entry. 3. Fallback to terminating backends when no active backends exist (KEP-1669) remains fully preserved when `svc->count == 0`. Tests: - Updated `tc_nodeport_lb_terminating_backend.c` to use TCP, verifying that existing TCP connections continue draining to terminating backends. - Added `tc_nodeport_lb_terminating_backend_udp.c` to verify that UDP datagrams immediately redirect to active backends when available, and fall back when no active backends remain. Fixes cilium#48714 Signed-off-by: Ankita Ojha <[email protected]>
ankitaojha123
added a commit
to ankitaojha123/cilium
that referenced
this pull request
Sep 18, 2026
In Cilium 1.18, PR cilium#40969 retained terminating backends in BPF maps to allow graceful TCP connection draining. However, because connectionless UDP datagrams do not contain TCP SYN flags, subsequent UDP packets from client sockets with existing Conntrack entries evaluated `!state->syn` as true. This trapped UDP traffic on terminating pods for the duration of the termination grace period (20–45s), causing packet loss during rolling updates and pod deletions. This change adds `tuple->nexthdr != IPPROTO_UDP` to the connection draining check in both `lb4_local()` and `lb6_local()`. As a result: 1. TCP connections continue to gracefully drain to terminating backends. 2. UDP packets immediately bypass draining, select an active healthy backend, and update the Conntrack entry. 3. Fallback to terminating backends when no active backends exist (KEP-1669) remains fully preserved when `svc->count == 0`. Tests: - Updated `tc_nodeport_lb_terminating_backend.c` to use TCP, verifying that existing TCP connections continue draining to terminating backends. - Added `tc_nodeport_lb_terminating_backend_udp.c` to verify that UDP datagrams immediately redirect to active backends when available, and fall back when no active backends remain. Fixes cilium#48714 Signed-off-by: Ankita Ojha <[email protected]>
ankitaojha123
added a commit
to ankitaojha123/cilium
that referenced
this pull request
Sep 21, 2026
In Cilium 1.18, PR cilium#40969 retained terminating backends in BPF maps to allow graceful TCP connection draining. However, because connectionless UDP datagrams do not contain TCP SYN flags, subsequent UDP packets from client sockets with existing Conntrack entries evaluated `!state->syn` as true. This trapped UDP traffic on terminating pods for the duration of the termination grace period (20–45s), causing packet loss during rolling updates and pod deletions. This change adds `tuple->nexthdr != IPPROTO_UDP` to the connection draining check in both `lb4_local()` and `lb6_local()`. As a result: 1. TCP connections continue to gracefully drain to terminating backends. 2. UDP packets immediately bypass draining, select an active healthy backend, and update the Conntrack entry. 3. Fallback to terminating backends when no active backends exist (KEP-1669) remains fully preserved when `svc->count == 0`. Tests: - Updated `tc_nodeport_lb_terminating_backend.c` to use TCP, verifying that existing TCP connections continue draining to terminating backends. - Added `tc_nodeport_lb_terminating_backend_udp.c` to verify that UDP datagrams immediately redirect to active backends when available, and fall back when no active backends remain. Fixes cilium#48714 Signed-off-by: Ankita Ojha <[email protected]>
ankitaojha123
added a commit
to ankitaojha123/cilium
that referenced
this pull request
Sep 21, 2026
In Cilium 1.18, PR cilium#40969 retained terminating backends in BPF maps to allow graceful TCP connection draining. However, because connectionless UDP datagrams do not contain TCP SYN flags, subsequent UDP packets from client sockets with existing Conntrack entries evaluated `!state->syn` as true. This trapped UDP traffic on terminating pods for the duration of the termination grace period (20–45s), causing packet loss during rolling updates and pod deletions. This change adds `tuple->nexthdr != IPPROTO_UDP` to the connection draining check in both `lb4_local()` and `lb6_local()`. As a result: 1. TCP connections continue to gracefully drain to terminating backends. 2. UDP packets immediately bypass draining, select an active healthy backend, and update the Conntrack entry. 3. Fallback to terminating backends when no active backends exist (KEP-1669) remains fully preserved when `svc->count == 0`. Tests: - Updated `tc_nodeport_lb_terminating_backend.c` to use TCP, verifying that existing TCP connections continue draining to terminating backends. - Added `tc_nodeport_lb_terminating_backend_udp.c` to verify that UDP datagrams immediately redirect to active backends when available, and fall back when no active backends remain. Fixes cilium#48714 Signed-off-by: Ankita Ojha <[email protected]>
ankitaojha123
added a commit
to ankitaojha123/cilium
that referenced
this pull request
Sep 22, 2026
In Cilium 1.18, PR cilium#40969 retained terminating backends in BPF maps to allow graceful TCP connection draining. However, because connectionless UDP datagrams do not contain TCP SYN flags, subsequent UDP packets from client sockets with existing Conntrack entries evaluated `!state->syn` as true. This trapped UDP traffic on terminating pods for the duration of the termination grace period (20–45s), causing packet loss during rolling updates and pod deletions. This change adds `tuple->nexthdr != IPPROTO_UDP` to the connection draining check in both `lb4_local()` and `lb6_local()`. As a result: 1. TCP connections continue to gracefully drain to terminating backends. 2. UDP packets immediately bypass draining, select an active healthy backend, and update the Conntrack entry. 3. Fallback to terminating backends when no active backends exist (KEP-1669) remains fully preserved when `svc->count == 0`. Tests: - Updated `tc_nodeport_lb_terminating_backend.c` to use TCP, verifying that existing TCP connections continue draining to terminating backends. - Added `tc_nodeport_lb_terminating_backend_udp.c` to verify that UDP datagrams immediately redirect to active backends when available, and fall back when no active backends remain. Fixes cilium#48714 Signed-off-by: Ankita Ojha <[email protected]>
pull Bot
pushed a commit
to TKaxv-7S/cilium
that referenced
this pull request
Sep 24, 2026
In Cilium 1.18, PR cilium#40969 retained terminating backends in BPF maps to allow graceful TCP connection draining. However, because connectionless UDP datagrams do not contain TCP SYN flags, subsequent UDP packets from client sockets with existing Conntrack entries evaluated `!state->syn` as true. This trapped UDP traffic on terminating pods for the duration of the termination grace period (20–45s), causing packet loss during rolling updates and pod deletions. This change adds `tuple->nexthdr != IPPROTO_UDP` to the connection draining check in both `lb4_local()` and `lb6_local()`. As a result: 1. TCP connections continue to gracefully drain to terminating backends. 2. UDP packets immediately bypass draining, select an active healthy backend, and update the Conntrack entry. 3. Fallback to terminating backends when no active backends exist (KEP-1669) remains fully preserved when `svc->count == 0`. Tests: - Updated `tc_nodeport_lb_terminating_backend.c` to use TCP, verifying that existing TCP connections continue draining to terminating backends. - Added `tc_nodeport_lb_terminating_backend_udp.c` to verify that UDP datagrams immediately redirect to active backends when available, and fall back when no active backends remain. Fixes cilium#48714 Signed-off-by: Ankita Ojha <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This fixes handling of terminating endpoints that are marked as not serving. These were skipped by
ParseEndpointSliceV1which lead to them being removed from the backend BPF maps and disrupting connections too early when a terminating pod stopped signalling readiness (conditions became{ready: false, serving: false, terminating: true}.To fix this we:
BackendStateTerminatingNotServingfor terminating backends that are to be kept in BPF maps, but not load-balanced to.ParseEndpointSliceV1. In case the conditions are the unexpected{ready: false, serving: false, terminating: false}the backend is simply quarantined.