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

🐛 Add OwnerRef to clusterResourceSetBinding on each reconcile #6989

Conversation

killianmuldoon
Copy link
Contributor

Signed-off-by: killianmuldoon [email protected]

Fix an issue where OwnerReferences were only added to a ClusterResourceSetBinding on Create. This fix will ensure the references are set each time the ClusterResourceSet the Binding is created from from is reconciled.

Fixes #6007

@k8s-ci-robot k8s-ci-robot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label Jul 28, 2022
@killianmuldoon killianmuldoon changed the title Add OwnerRef to clusterResourceSetBinding on each reconcile 🐛 Add OwnerRef to clusterResourceSetBinding on each reconcile Jul 28, 2022
@k8s-ci-robot k8s-ci-robot added the size/S Denotes a PR that changes 10-29 lines, ignoring generated files. label Jul 28, 2022
@@ -264,6 +264,9 @@ func (r *ClusterResourceSetReconciler) ApplyClusterResourceSet(ctx context.Conte
}
}()

// Ensure that the owner references are set on the ClusterResourceSetBinding.
clusterResourceSetBinding.OwnerReferences = ensureOwnerRefs(clusterResourceSetBinding, clusterResourceSet, cluster)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Note this is done in the ClusterResourceSet reconcile rather than the ClusterResourceSetBinding reconcile. This may cause some slight drift in setting the owner references.

The main case we care about is backup -> restore -> deletion so the drift of a couple of minutes should be acceptable. In the normal case we'd expect these owner references to be applied on the first reconcile of the ClusterResourceSet i.e. right after restore + unpause.

@killianmuldoon
Copy link
Contributor Author

/kind bug
/kind cleanup

@k8s-ci-robot k8s-ci-robot added kind/bug Categorizes issue or PR as related to a bug. kind/cleanup Categorizes issue or PR as related to cleaning up code, process, or technical debt. labels Jul 28, 2022
@killianmuldoon killianmuldoon changed the title 🐛 Add OwnerRef to clusterResourceSetBinding on each reconcile 🐛 [WIP] Add OwnerRef to clusterResourceSetBinding on each reconcile Jul 28, 2022
@killianmuldoon killianmuldoon force-pushed the fix/clusterresourcesetbinding-ownerref branch from 4f4e23d to 73cacfd Compare July 28, 2022 12:31
@k8s-ci-robot k8s-ci-robot added size/M Denotes a PR that changes 30-99 lines, ignoring generated files. and removed size/S Denotes a PR that changes 10-29 lines, ignoring generated files. labels Jul 28, 2022
@killianmuldoon killianmuldoon changed the title 🐛 [WIP] Add OwnerRef to clusterResourceSetBinding on each reconcile 🐛 Add OwnerRef to clusterResourceSetBinding on each reconcile Jul 28, 2022
@@ -100,6 +100,14 @@ func (c *ClusterResourceSetBinding) DeleteBinding(clusterResourceSet *ClusterRes
break
}
}
// Remove the ClusterResourceSet from the ClusterResourceSetBinding OwnerReferences.
for i, ownerRef := range c.OwnerReferences {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Previously we weren't updating ownerReferences at all after creation so the initial ClusterResourceSet was always an owner even if it had been deleted.

@fabriziopandini
Copy link
Member

overall lgtm, thanks for tackling this

@killianmuldoon killianmuldoon force-pushed the fix/clusterresourcesetbinding-ownerref branch from 73cacfd to 8737a55 Compare August 1, 2022 11:15
@vincepri
Copy link
Member

vincepri commented Aug 1, 2022

/cherry-pick release-1.2

@k8s-infra-cherrypick-robot

@vincepri: once the present PR merges, I will cherry-pick it on top of release-1.2 in a new PR and assign it to you.

In response to this:

/cherry-pick release-1.2

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.

@killianmuldoon killianmuldoon force-pushed the fix/clusterresourcesetbinding-ownerref branch from 8737a55 to 96c71f5 Compare August 1, 2022 14:12
Copy link
Member

@vincepri vincepri left a comment

Choose a reason for hiding this comment

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

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Aug 1, 2022
@killianmuldoon killianmuldoon force-pushed the fix/clusterresourcesetbinding-ownerref branch from 96c71f5 to f152444 Compare August 2, 2022 15:14
@k8s-ci-robot k8s-ci-robot removed the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Aug 2, 2022
@killianmuldoon killianmuldoon force-pushed the fix/clusterresourcesetbinding-ownerref branch from f152444 to daf21c0 Compare August 4, 2022 13:11
Copy link
Member

@fabriziopandini fabriziopandini left a comment

Choose a reason for hiding this comment

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

/lgtm
/approve

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

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: fabriziopandini

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 Aug 4, 2022
@k8s-ci-robot k8s-ci-robot merged commit 9cebf76 into kubernetes-sigs:main Aug 4, 2022
@k8s-ci-robot k8s-ci-robot added this to the v1.3 milestone Aug 4, 2022
@k8s-infra-cherrypick-robot

@vincepri: new pull request created: #7012

In response to this:

/cherry-pick release-1.2

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. kind/bug Categorizes issue or PR as related to a bug. kind/cleanup Categorizes issue or PR as related to cleaning up code, process, or technical debt. lgtm "Looks good to me", indicates that a PR is ready to be merged. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ownerReferences on ClusterResourceSetBinding are not re-updated after restoring from a backup
5 participants