Skip to content

Conversation

mhofstetter
Copy link
Member

The current loadbalancer controlplane always initializes new BackendParams
with its default value Unhealthy=false. This leads to potential issues that
backendselection for a given service doesn't respect the circumstance that there might be
service health check implementations that should report the backend health
state before exposing that service backend via statedb frontend to other modules.

Therefore, this commit introduces a new hook SetIsServiceHealthCheckedFunc to the
loadbalancer Writer. Service health checking modules can use this hook to
mark that a given service is health checked. Backendselection for a service will use
that hook and only include a backend to a health-checked service frontend if the
health state for the backend has already been reported once. This prevents prematurely
exposing unhealthy backends (or their incorrect health status) to other modules.

The current loadbalancer controlplane always initializes new `BackendParams`
with its default value `Unhealthy=false`. This leads to potential issues that
backendselection for a given service doesn't respect the circumstance that there might be
service health check implementations that should report the backend health
state before exposing that service backend via statedb `frontend` to other modules.

Therefore, this commit introduces a new hook `SetIsServiceHealthCheckedFunc` to the
loadbalancer `Writer`. Service health checking modules can use this hook to
mark that a given service is health checked. Backendselection for a service will use
that hook and only include a backend to a health-checked service frontend if the
health state for the backend has already been reported once. This prevents prematurely
exposing unhealthy backends (or their incorrect health status) to other modules.

Signed-off-by: Marco Hofstetter <marco.hofstetter@isovalent.com>
@mhofstetter mhofstetter added kind/bug This is a bug in the Cilium logic. release-note/bug This PR fixes an issue in a previous release of Cilium. area/loadbalancing Impacts load-balancing and Kubernetes service implementations needs-backport/1.18 This PR / issue needs backporting to the v1.18 branch labels Aug 12, 2025
@mhofstetter
Copy link
Member Author

/test

@mhofstetter mhofstetter requested a review from joamaki August 12, 2025 15:56
@mhofstetter mhofstetter marked this pull request as ready for review August 12, 2025 15:56
@mhofstetter mhofstetter requested a review from a team as a code owner August 12, 2025 15:56
Copy link
Contributor

@joamaki joamaki left a comment

Choose a reason for hiding this comment

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

LGTM thanks!

@maintainer-s-little-helper maintainer-s-little-helper bot added the ready-to-merge This PR has passed all tests and received consensus from code owners to merge. label Aug 13, 2025
@borkmann borkmann merged commit 114cacd into cilium:main Aug 14, 2025
74 checks passed
@mhofstetter mhofstetter deleted the pr/mhofstetter/lb-isservicehealthchecked branch August 14, 2025 07:12
joamaki added a commit to joamaki/cilium that referenced this pull request Aug 18, 2025
Since cilium#41092 now marks backends
unhealthy until they've been health checked there's no need to restore
the quarantined state of backends on restart since they'll anyway start
out unhealthy until they've been health checked again.

Signed-off-by: Jussi Maki <jussi@isovalent.com>
@joamaki joamaki added backport-pending/1.18 The backport for Cilium 1.18.x for this PR is in progress. and removed needs-backport/1.18 This PR / issue needs backporting to the v1.18 branch labels Aug 19, 2025
@github-actions github-actions bot added backport-done/1.18 The backport for Cilium 1.18.x for this PR is done. and removed backport-pending/1.18 The backport for Cilium 1.18.x for this PR is in progress. labels Aug 21, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/loadbalancing Impacts load-balancing and Kubernetes service implementations backport-done/1.18 The backport for Cilium 1.18.x for this PR is done. kind/bug This is a bug in the Cilium logic. ready-to-merge This PR has passed all tests and received consensus from code owners to merge. release-note/bug This PR fixes an issue in a previous release of Cilium.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants