-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
✨ support disable deepcopy on list funcion #2076
✨ support disable deepcopy on list funcion #2076
Conversation
|
Welcome @qiankunli! |
Hi @qiankunli. Thanks for your PR. I'm waiting for a kubernetes-sigs member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. 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/test-infra repository. |
36d84ae
to
4595915
Compare
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.
/ok-to-test
pkg/client/options.go
Outdated
// disableDeepCopy indicates not to deep copy objects during list objects. | ||
// Be very careful with this, when enabled you must DeepCopy any object before mutating it, | ||
// otherwise you will mutate the object in the cache. | ||
DisableDeepCopy bool |
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.
DisableDeepCopy bool | |
UnsafeDisableDeepCopy bool |
pkg/cache/internal/cache_reader.go
Outdated
@@ -161,7 +161,7 @@ func (c *CacheReader) List(_ context.Context, out client.ObjectList, opts ...cli | |||
} | |||
|
|||
var outObj runtime.Object | |||
if c.disableDeepCopy { | |||
if c.disableDeepCopy || listOpts.DisableDeepCopy { |
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 a test for this, maybe by checking that the pointer for the obj is the same as for the one in the cache
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 a test for this, maybe by checking that the pointer for the obj is the same as for the one in the cache
done
4595915
to
40ec9b7
Compare
d04e5a6
to
ffdccf5
Compare
Signed-off-by: qiankunli <[email protected]>
ffdccf5
to
59682cb
Compare
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.
/lgtm
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: qiankunli, vincepri The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
related issue: #1274
If the all object of a specific GVK supports DisableDeepCopy option, the risk is too great. it may be a better way to specify DisableDeepCopy option every time list function is called
example code