Skip to content

✨ Add UnsafeDisableDeepCopy to GetOptions #3227

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

jonathan-innis
Copy link
Member

Fixes #3226

This change adds the same UnsafeDisableDeepCopy to GetOptions in the same way that we add UnsafeDisableDeepCopy to ListOptions

@k8s-ci-robot k8s-ci-robot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label May 20, 2025
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: jonathan-innis
Once this PR has been reviewed and has the lgtm label, please assign fillzpp for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found here.

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot requested review from inteon and troy0820 May 20, 2025 17:34
@k8s-ci-robot k8s-ci-robot added the size/S Denotes a PR that changes 10-29 lines, ignoring generated files. label May 20, 2025
@@ -81,7 +84,7 @@ func (c *CacheReader) Get(_ context.Context, key client.ObjectKey, out client.Ob
return fmt.Errorf("cache contained %T, which is not an Object", obj)
}

if c.disableDeepCopy {
if c.disableDeepCopy || (getOpts.UnsafeDisableDeepCopy != nil && *getOpts.UnsafeDisableDeepCopy) {
Copy link
Member

Choose a reason for hiding this comment

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

Please add tests for this

Copy link
Member Author

Choose a reason for hiding this comment

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

Done -- doesn't look like there were test in place for the ListOptions so I added those as well

@jonathan-innis jonathan-innis force-pushed the add-unsafe-disable-get-options branch from b25daf9 to 8bf5c64 Compare May 21, 2025 15:53
@k8s-ci-robot k8s-ci-robot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed size/S Denotes a PR that changes 10-29 lines, ignoring generated files. labels May 21, 2025
@jonathan-innis jonathan-innis force-pushed the add-unsafe-disable-get-options branch from 8bf5c64 to fcc5bec Compare May 21, 2025 17:03
@jonathan-innis jonathan-innis force-pushed the add-unsafe-disable-get-options branch from fcc5bec to f719e3b Compare May 21, 2025 17:20
@k8s-ci-robot
Copy link
Contributor

@jonathan-innis: The following test failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
pull-controller-runtime-test f719e3b link true /test pull-controller-runtime-test

Full PR test history. Your PR dashboard. Please help us cut down on flakes by linking to an open issue when you hit one in your PR.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. I understand the commands that are listed here.

@@ -2647,6 +2671,33 @@ U5wwSivyi7vmegHKmblOzNVKA5qPO8zWzqBC
Expect(deps.Items[1].Name).To(Equal(dep4.Name))
})

It("should not deep copy results when UnsafeDisableDeepCopy is set", func() {
Copy link
Member

Choose a reason for hiding this comment

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

This is already tested, no need to add another:

Describe("use UnsafeDisableDeepCopy list options", func() {

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support UnsafeDisableDeepCopy for GetOption
3 participants