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

Avoid clearing objects in conversion funcs #24241

Merged
merged 1 commit into from
Mar 13, 2023

Conversation

odinuge
Copy link
Member

@odinuge odinuge commented Mar 8, 2023

This removes the behavior of mutating the objects received from the client-go library. To begin with there isn't really any benefit from doing so, given we don't store the object afterwards, and it will be ready for gc when it leaves the scope inside client-go. client-go can possibly return the same pointer twice here, to trigger eg. both an object update delta and then a DeletedFinalStateUnknown delta with the same pointer.

For more info, see the issue 115658 in the kubernetes/kubernetes repo on github. (avoiding to link directly since it spamms the original issue).

Please ensure your pull request adheres to the following guidelines:

  • For first time contributors, read Submitting a pull request
  • All code is covered by unit and/or runtime tests where feasible.
  • All commits contain a well written commit description including a title,
    description and a Fixes: #XXX line if the commit addresses a particular
    GitHub issue.
  • If your commit description contains a Fixes: <commit-id> tag, then
    please add the commit author[s] as reviewer[s] to this issue.
  • All commits are signed off. See the section Developer’s Certificate of Origin
  • Provide a title or release-note blurb suitable for the release notes.
  • Are you a user of Cilium? Please add yourself to the Users doc
  • Thanks for contributing!

@odinuge odinuge requested a review from a team as a code owner March 8, 2023 11:39
@odinuge odinuge requested a review from christarazi March 8, 2023 11:39
@maintainer-s-little-helper maintainer-s-little-helper bot added the dont-merge/needs-release-note-label The author needs to describe the release impact of these changes. label Mar 8, 2023
@github-actions github-actions bot added the kind/community-contribution This was a contribution made by a community member. label Mar 8, 2023
@odinuge
Copy link
Member Author

odinuge commented Mar 8, 2023

Functionally a noop, so I don't think we need a changelog entry here. Tested on our biggest clusters as well, and we see no change.

cc @aanm

@christarazi christarazi added kind/enhancement This would improve or streamline existing functionality. sig/k8s Impacts the kubernetes API, or kubernetes -> cilium internals translation layers. release-note/misc This PR makes changes that have no direct user impact. labels Mar 8, 2023
@maintainer-s-little-helper maintainer-s-little-helper bot removed dont-merge/needs-release-note-label The author needs to describe the release impact of these changes. labels Mar 8, 2023
Copy link
Member

@christarazi christarazi left a comment

Choose a reason for hiding this comment

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

LGTM. I checked our other conversion functions and they are not doing the clearing either, so this seems sane to me.

cc @aanm

@aojea
Copy link
Contributor

aojea commented Mar 10, 2023

cc: @marseel , you'll be interested on this kubernetes/kubernetes#115658

This removes the behavior of mutating the objects received from the
client-go library. To begin with there isn't really any benefit from
doing so, given we don't store the object afterwards, and it will be
ready for gc when it leaves the scope inside client-go. client-go can
possibly return the same pointer twice here, to trigger eg. both an
object update delta and then a DeletedFinalStateUnknown delta with the
same pointer.

For more info, see the issue 115658 in the kubernetes/kubernetes repo on
github.

Signed-off-by: Odin Ugedal <ougedal@palantir.com>
Signed-off-by: Odin Ugedal <odin@uged.al>
@christarazi
Copy link
Member

Rebasing and running tests

@christarazi
Copy link
Member

/test

@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 Mar 10, 2023
@borkmann borkmann merged commit 74307f1 into cilium:master Mar 13, 2023
@aanm aanm added needs-backport/1.11 needs-backport/1.13 This PR / issue needs backporting to the v1.13 branch labels Apr 17, 2023
@aanm aanm mentioned this pull request Apr 17, 2023
2 tasks
@aanm aanm added backport-pending/1.13 The backport for Cilium 1.13.x for this PR is in progress. and removed needs-backport/1.13 This PR / issue needs backporting to the v1.13 branch labels Apr 17, 2023
@aanm aanm mentioned this pull request Apr 17, 2023
2 tasks
@aanm aanm mentioned this pull request Apr 17, 2023
2 tasks
@aanm aanm added backport-done/1.13 The backport for Cilium 1.13.x for this PR is done. backport-done/1.12 The backport for Cilium 1.12.x for this PR is done. and removed needs-backport/1.11 backport-pending/1.13 The backport for Cilium 1.13.x for this PR is in progress. labels Apr 17, 2023
@julianwiedmann
Copy link
Member

Sure looks like this also landed in v1.11 by now.

@julianwiedmann julianwiedmann 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 9, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport-done/1.11 The backport for Cilium 1.11.x for this PR is done. 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. kind/community-contribution This was a contribution made by a community member. kind/enhancement This would improve or streamline existing functionality. 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. sig/k8s Impacts the kubernetes API, or kubernetes -> cilium internals translation layers.
Projects
No open projects
Status: Released
Development

Successfully merging this pull request may close these issues.

None yet

6 participants