-
Notifications
You must be signed in to change notification settings - Fork 40.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
Fix Deep Copy issue in getting controller reference #124116
Conversation
|
Please note that we're already in Test Freeze for the Fast forwards are scheduled to happen every 6 hours, whereas the most recent run was: Sat Mar 30 08:14:50 UTC 2024. |
Welcome @HiranmoyChowdhury! |
Hi @HiranmoyChowdhury. Thanks for your PR. I'm waiting for a kubernetes 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. |
/easycla |
This PR may require API review. If so, when the changes are ready, complete the pre-review checklist and request an API review. Status of requested reviews is tracked in the API Review project. |
/sig apimachinery |
@justinsb: The label(s) In response to this:
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. |
/sig api-machinery |
These changes do not affect previously written code or projects but will benefit future projects |
/ok-to-test This is a API change PR. Please follow the process here: https://github.com/kubernetes/community/blob/master/sig-architecture/api-review-process.md#mechanics . Thanks! |
f1a5391
to
6fc550d
Compare
// test deepCopy | ||
if (c.Controller == controllerRef.Controller) || | ||
(c.BlockOwnerDeletion != nil && c.BlockOwnerDeletion == controllerRef.BlockOwnerDeletion) { | ||
t.Errorf("deepCopy failed of GetControllerOf: %v", c) |
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.
nit:
t.Errorf("deepCopy failed of GetControllerOf: %v", c) | |
t.Errorf("GetControllerOf did not return deep copy: %v", c) |
@@ -95,6 +96,11 @@ func TestGetControllerOf(t *testing.T) { | |||
if c.Name != controllerRef.Name || c.UID != controllerRef.UID { | |||
t.Errorf("Incorrect result of GetControllerOf: %v", c) | |||
} | |||
// test deepCopy |
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.
nit:
// test deepCopy | |
// test that all pointers are also deep copied |
Looks right. Nit: the release note is not really necessary as this is not a (non-developer) user-facing change. |
/assign @kubernetes/api-reviewers |
946d848
to
0cd2588
Compare
/lgtm Needs an api reviewer approval. |
LGTM label has been added. Git tree hash: 99b0fa39a3c5c69a43904f3fbd1a9ab8146f4675
|
/triage accepted |
/approve |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: HiranmoyChowdhury, liggitt, sttts 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 |
What type of PR is this?
/kind bug
What this PR does / why we need it:
This PR is to fix the Deep Copy issue in this func. As in the same directory a function named "GetControllerOfNoCopy" present which is supposed to return the original controller reference and the function named "GetControllerOf" is supposed to return the controller reference after making Deep Copy. But, It just returns the copy reference of the controller which doesn't make deep copy of "Controller" and "BlockOwnerDeletion" field inside of "Owner Reference" struct. After making changes in copied controller reference(such as, *copiedControllerRef.BlockOwnerDeletion = false), the original value also changes.
Does this PR introduce a user-facing change?
NONE