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

Fix Deep Copy issue in getting controller reference #124116

Merged
merged 1 commit into from
Apr 18, 2024

Conversation

HiranmoyChowdhury
Copy link
Contributor

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

Fix Deep Copy issue in getting controller reference

@k8s-ci-robot k8s-ci-robot added release-note Denotes a PR that will be considered when it comes time to generate release notes. size/S Denotes a PR that changes 10-29 lines, ignoring generated files. kind/bug Categorizes issue or PR as related to a bug. labels Mar 30, 2024
Copy link

linux-foundation-easycla bot commented Mar 30, 2024

CLA Signed

The committers listed above are authorized under a signed CLA.

  • ✅ login: HiranmoyChowdhury / name: Hiranmoy Das Chowdhury (0cd2588)

@k8s-ci-robot
Copy link
Contributor

Please note that we're already in Test Freeze for the release-1.30 branch. This means every merged PR will be automatically fast-forwarded via the periodic ci-fast-forward job to the release branch of the upcoming v1.30.0 release.

Fast forwards are scheduled to happen every 6 hours, whereas the most recent run was: Sat Mar 30 08:14:50 UTC 2024.

@k8s-ci-robot k8s-ci-robot added cncf-cla: no Indicates the PR's author has not signed the CNCF CLA. do-not-merge/needs-sig Indicates an issue or PR lacks a `sig/foo` label and requires one. needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. labels Mar 30, 2024
@k8s-ci-robot
Copy link
Contributor

Welcome @HiranmoyChowdhury!

It looks like this is your first PR to kubernetes/kubernetes 🎉. Please refer to our pull request process documentation to help your PR have a smooth ride to approval.

You will be prompted by a bot to use commands during the review process. Do not be afraid to follow the prompts! It is okay to experiment. Here is the bot commands documentation.

You can also check if kubernetes/kubernetes has its own contribution guidelines.

You may want to refer to our testing guide if you run into trouble with your tests not passing.

If you are having difficulty getting your pull request seen, please follow the recommended escalation practices. Also, for tips and tricks in the contribution process you may want to read the Kubernetes contributor cheat sheet. We want to make sure your contribution gets all the attention it needs!

Thank you, and welcome to Kubernetes. 😃

@k8s-ci-robot
Copy link
Contributor

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 /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

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.

@k8s-ci-robot k8s-ci-robot added needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. needs-priority Indicates a PR lacks a `priority/foo` label and requires one. labels Mar 30, 2024
@k8s-ci-robot k8s-ci-robot added kind/api-change Categorizes issue or PR as related to adding, removing, or otherwise changing an API cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. and removed cncf-cla: no Indicates the PR's author has not signed the CNCF CLA. labels Mar 30, 2024
@HiranmoyChowdhury
Copy link
Contributor Author

/easycla

@k8s-triage-robot
Copy link

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.

@justinsb
Copy link
Member

justinsb commented Apr 1, 2024

/sig apimachinery

@k8s-ci-robot
Copy link
Contributor

@justinsb: The label(s) sig/apimachinery cannot be applied, because the repository doesn't have them.

In response to this:

/sig apimachinery

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.

@justinsb
Copy link
Member

justinsb commented Apr 1, 2024

/sig api-machinery

@k8s-ci-robot k8s-ci-robot added sig/api-machinery Categorizes an issue or PR as relevant to SIG API Machinery. and removed do-not-merge/needs-sig Indicates an issue or PR lacks a `sig/foo` label and requires one. labels Apr 1, 2024
@HiranmoyChowdhury
Copy link
Contributor Author

These changes do not affect previously written code or projects but will benefit future projects

@cici37
Copy link
Contributor

cici37 commented Apr 4, 2024

/ok-to-test
/remove-sig api-machinery

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!

@k8s-ci-robot k8s-ci-robot added ok-to-test Indicates a non-member PR verified by an org member that is safe to test. needs-sig Indicates an issue or PR lacks a `sig/foo` label and requires one. and removed needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. sig/api-machinery Categorizes an issue or PR as relevant to SIG API Machinery. labels Apr 4, 2024
@k8s-ci-robot k8s-ci-robot removed the do-not-merge/needs-sig Indicates an issue or PR lacks a `sig/foo` label and requires one. label Apr 5, 2024
// test deepCopy
if (c.Controller == controllerRef.Controller) ||
(c.BlockOwnerDeletion != nil && c.BlockOwnerDeletion == controllerRef.BlockOwnerDeletion) {
t.Errorf("deepCopy failed of GetControllerOf: %v", c)
Copy link
Contributor

Choose a reason for hiding this comment

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

nit:

Suggested change
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
Copy link
Contributor

@sttts sttts Apr 7, 2024

Choose a reason for hiding this comment

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

nit:

Suggested change
// test deepCopy
// test that all pointers are also deep copied

@sttts
Copy link
Contributor

sttts commented Apr 7, 2024

Looks right.

Nit: the release note is not really necessary as this is not a (non-developer) user-facing change.

@sttts sttts added the priority/important-soon Must be staffed and worked on either currently, or very soon, ideally in time for the next release. label Apr 7, 2024
@k8s-ci-robot k8s-ci-robot removed the needs-priority Indicates a PR lacks a `priority/foo` label and requires one. label Apr 7, 2024
@sttts
Copy link
Contributor

sttts commented Apr 7, 2024

/assign @kubernetes/api-reviewers

@k8s-ci-robot k8s-ci-robot added area/release-eng Issues or PRs related to the Release Engineering subproject sig/release Categorizes an issue or PR as relevant to SIG Release. labels Apr 9, 2024
@sttts
Copy link
Contributor

sttts commented Apr 9, 2024

/lgtm
/approve

Needs an api reviewer approval.

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Apr 9, 2024
@k8s-ci-robot
Copy link
Contributor

LGTM label has been added.

Git tree hash: 99b0fa39a3c5c69a43904f3fbd1a9ab8146f4675

@alexzielenski
Copy link
Contributor

/triage accepted
/cc deads2k jpbetz

@k8s-ci-robot k8s-ci-robot requested review from deads2k and jpbetz April 9, 2024 19:18
@k8s-ci-robot k8s-ci-robot added triage/accepted Indicates an issue or PR is ready to be actively worked on. and removed needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. labels Apr 9, 2024
@liggitt
Copy link
Member

liggitt commented Apr 9, 2024

/approve
/milestone v1.31

@k8s-ci-robot k8s-ci-robot added this to the v1.31 milestone Apr 9, 2024
@k8s-ci-robot
Copy link
Contributor

[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 /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Apr 9, 2024
@liggitt liggitt self-assigned this Apr 11, 2024
@k8s-ci-robot k8s-ci-robot merged commit 3261821 into kubernetes:master Apr 18, 2024
15 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api-review Categorizes an issue or PR as actively needing an API review. approved Indicates a PR has been approved by an approver from all required OWNERS files. area/release-eng Issues or PRs related to the Release Engineering subproject cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. kind/api-change Categorizes issue or PR as related to adding, removing, or otherwise changing an API kind/bug Categorizes issue or PR as related to a bug. lgtm "Looks good to me", indicates that a PR is ready to be merged. needs-sig Indicates an issue or PR lacks a `sig/foo` label and requires one. ok-to-test Indicates a non-member PR verified by an org member that is safe to test. priority/important-soon Must be staffed and worked on either currently, or very soon, ideally in time for the next release. release-note Denotes a PR that will be considered when it comes time to generate release notes. sig/api-machinery Categorizes an issue or PR as relevant to SIG API Machinery. sig/release Categorizes an issue or PR as relevant to SIG Release. size/S Denotes a PR that changes 10-29 lines, ignoring generated files. triage/accepted Indicates an issue or PR is ready to be actively worked on.
Projects
Status: API review completed, 1.31
Development

Successfully merging this pull request may close these issues.

9 participants