-
Notifications
You must be signed in to change notification settings - Fork 1.2k
✨ 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
base: main
Are you sure you want to change the base?
✨ Add UnsafeDisableDeepCopy to GetOptions #3227
Conversation
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: jonathan-innis 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 |
@@ -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) { |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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
b25daf9
to
8bf5c64
Compare
8bf5c64
to
fcc5bec
Compare
fcc5bec
to
f719e3b
Compare
@jonathan-innis: The following test failed, say
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() { |
There was a problem hiding this comment.
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:
controller-runtime/pkg/cache/cache_test.go
Line 2465 in 71f7db5
Describe("use UnsafeDisableDeepCopy list options", func() { |
Fixes #3226
This change adds the same
UnsafeDisableDeepCopy
toGetOptions
in the same way that we addUnsafeDisableDeepCopy
toListOptions