Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pkg/service: Backends leak follow ups with revised fixes, debugging improvements and unit tests #24770

Merged

Conversation

aditighag
Copy link
Member

@aditighag aditighag commented Apr 5, 2023

This is a follow-up PR with revised fixes along with debugging improvements, and test coverage for fixes merged in - #24681.

pkg/service: Extend logic to handle leaked backends

This commit revises the logic to handle all the leaked backend scenarios in one place.
Consider the following leaked backend scenarios where (1) and
(2a) were previously handled:
(1) Backend entries leaked, no duplicates: previously, such
      backends would be deleted as orphan backends after sync with
      kubernetes api server.
(2) Backend entries leaked with duplicates:
    (a) backend with overlapping L3nL4Addr hash is associated with service(s)
          Sequence of events:
          Backends were leaked prior to agent restart, but there was at least
          one service that the backend by hash is associated with.
          s.backendByHash will have a non-zero reference count for the
          overlapping L3nL4Addr hash.
    (b) none of the backends are associated with services
          Sequence of events:
          All the services these backends were associated with were deleted
          prior to agent restart.
          s.backendByHash will not have an entry for the backends hash.

pkg/service: Fix premature release of backend ID

(See commit description)
Fixes: 51b62f5684

pkg/service: Log skipped backends count during restore
pkg/service: Log orphan backends count

Debugging improvements

pkg/service: Unit test for handling of leaked backends in various scenarios described above

docs: Document backends leak issue

Document the issue along with affected Cilium versions.

Relates: #23551

Signed-off-by: Aditi Ghag aditi@cilium.io

@aditighag aditighag added the release-note/misc This PR makes changes that have no direct user impact. label Apr 5, 2023
@aditighag aditighag requested review from a team as code owners April 5, 2023 17:37
@aditighag aditighag requested review from aspsk and asauber April 5, 2023 17:37
@aditighag
Copy link
Member Author

ConformanceKind hit - #22217.

@aditighag
Copy link
Member Author

I'll piggyback on the PR to add documentation changes.

@aditighag aditighag marked this pull request as draft April 5, 2023 18:56
@aditighag aditighag force-pushed the pr/aditighag/leaked-backends-fix-follow-ups branch 2 times, most recently from 430fd35 to b49fa61 Compare April 13, 2023 23:56
@aditighag aditighag changed the title pkg/service: Debugging improvements and unit tests pkg/service: Backends leak follow ups with debugging improvements, unit tests Apr 13, 2023
@aditighag aditighag added needs-backport/1.11 needs-backport/1.13 This PR / issue needs backporting to the v1.13 branch labels Apr 14, 2023
@maintainer-s-little-helper maintainer-s-little-helper bot added this to Needs backport from master in 1.13.2 Apr 14, 2023
@maintainer-s-little-helper maintainer-s-little-helper bot added this to Needs backport from master in 1.11.16 Apr 14, 2023
@aditighag aditighag requested review from borkmann and removed request for aspsk April 14, 2023 00:17
@aditighag aditighag force-pushed the pr/aditighag/leaked-backends-fix-follow-ups branch from b49fa61 to 7db1f0c Compare April 14, 2023 00:24
@michi-covalent michi-covalent added this to Needs backport from master in 1.11.17 Apr 14, 2023
@michi-covalent michi-covalent removed this from Needs backport from master in 1.11.16 Apr 14, 2023
@aditighag aditighag marked this pull request as ready for review April 14, 2023 01:09
@aditighag aditighag requested a review from a team as a code owner April 14, 2023 01:09
@gentoo-root gentoo-root added this to Needs backport from master in 1.13.3 Apr 14, 2023
@gentoo-root gentoo-root removed this from Needs backport from master in 1.13.2 Apr 14, 2023
Copy link
Contributor

@zacharysarah zacharysarah left a comment

Choose a reason for hiding this comment

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

@aditighag 👋🏻 Thanks for this update. I left some edits for clarity, otherwise LGTM from a docs perspective.

Documentation/network/kubernetes/kubeproxy-free.rst Outdated Show resolved Hide resolved
Documentation/network/kubernetes/kubeproxy-free.rst Outdated Show resolved Hide resolved
@aditighag
Copy link
Member Author

Thanks for the docs review @zacharysarah.
@brb Ping... You had mentioned that you would take a look earlier this week. You are the original author for most of the code, so you have the most context.

pkg/service/id.go Show resolved Hide resolved
pkg/service/service.go Show resolved Hide resolved
pkg/service/service.go Show resolved Hide resolved
Documentation/network/kubernetes/kubeproxy-free.rst Outdated Show resolved Hide resolved
Copy link
Member

@brb brb left a comment

Choose a reason for hiding this comment

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

You are the original author for most of the code, so you have the most context.

It's no longer the case, as I stopped tracking changes the package long time ago.

@joamaki joamaki mentioned this pull request May 3, 2023
8 tasks
@maintainer-s-little-helper maintainer-s-little-helper bot moved this from Needs backport from main to Backport pending to v1.11 in 1.11.17 May 3, 2023
@julianwiedmann julianwiedmann added backport-done/1.13 The backport for Cilium 1.13.x for this PR is done. and removed backport-pending/1.13 The backport for Cilium 1.13.x for this PR is in progress. labels May 9, 2023
@maintainer-s-little-helper maintainer-s-little-helper bot moved this from Backport pending to v1.13 to Backport done to v1.13 in 1.13.3 May 9, 2023
@jrajahalme jrajahalme added backport-done/1.11 The backport for Cilium 1.11.x for this PR is done. and removed backport-pending/1.11 labels May 12, 2023
@maintainer-s-little-helper maintainer-s-little-helper bot moved this from Backport pending to v1.11 to Backport done to v1.11 in 1.11.17 May 12, 2023
@jrajahalme jrajahalme added needs-backport/1.11 and removed backport-done/1.11 The backport for Cilium 1.11.x for this PR is done. labels May 12, 2023
@maintainer-s-little-helper maintainer-s-little-helper bot moved this from Backport done to v1.11 to Needs backport from main in 1.11.17 May 12, 2023
@maintainer-s-little-helper maintainer-s-little-helper bot moved this from Backport done to v1.11 to Needs backport from main in 1.11.17 May 12, 2023
@aditighag aditighag added the backport/author The backport will be carried out by the author of the PR. label May 12, 2023
@jrajahalme jrajahalme added this to Needs backport from main in 1.11.18 May 12, 2023
@jrajahalme jrajahalme removed this from Needs backport from main in 1.11.17 May 12, 2023
@michi-covalent michi-covalent added this to Needs backport from main in 1.11.19 Jun 14, 2023
@michi-covalent michi-covalent removed this from Needs backport from main in 1.11.18 Jun 14, 2023
@gentoo-root gentoo-root added this to Needs backport from main in 1.11.20 Jul 26, 2023
@gentoo-root gentoo-root removed this from Needs backport from main in 1.11.19 Jul 26, 2023
@julianwiedmann julianwiedmann added backport-done/1.12 The backport for Cilium 1.12.x for this PR is done. and removed backport-pending/1.12 labels Jul 31, 2023
@maintainer-s-little-helper maintainer-s-little-helper bot moved this from Backport pending to v1.12 to Backport done to v1.12 in 1.12.10 Jul 31, 2023
@nebril nebril added this to Needs backport from main in 1.11.21 Aug 10, 2023
@nebril nebril removed this from Needs backport from main in 1.11.20 Aug 10, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport/author The backport will be carried out by the author of the PR. backport-done/1.12 The backport for Cilium 1.12.x for this PR is done. backport-done/1.13 The backport for Cilium 1.13.x for this PR is done. ready-to-merge This PR has passed all tests and received consensus from code owners to merge. release-note/misc This PR makes changes that have no direct user impact.
Projects
No open projects
1.11.21
Needs backport from main
1.12.10
Backport done to v1.12
1.13.3
Backport done to v1.13
Development

Successfully merging this pull request may close these issues.

None yet

8 participants