🌱 Optimise patch calls#13367
Conversation
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
|
/hold Need rebase |
1b3d1d4 to
7a7828a
Compare
|
/hold cancel |
|
@fabriziopandini: 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. DetailsInstructions 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. |
| kcpRef := *metav1.NewControllerRef(kcp, controlplanev1.GroupVersion.WithKind(kubeadmControlPlaneKind)) | ||
| for _, m := range machines { | ||
| // No op if OwnerReferences is set and up to date. | ||
| if util.HasExactOwnerRef(m.OwnerReferences, kcpRef) { |
There was a problem hiding this comment.
Is it really correct to skip all this code if m has the ownerRef? (especially including adoptOwnedSecrets)
I would move this down to l.1591
| @@ -1647,29 +1640,25 @@ func (r *KubeadmControlPlaneReconciler) ensureCertificatesOwnerRef(ctx context.C | |||
| continue | |||
| } | |||
|
|
|||
There was a problem hiding this comment.
To me it looks like this code is not equivalent.
Previously we also did something for secrets that did not have ClusterSecretType. Is this change intentional? (probably yes, but wanted to double check)
What this PR does / why we need it:
This PR drops usage of patch helper when we are modifying only few fields, not including conditions.
Also, avoid patching entirely when the object is not changed,.
Which issue(s) this PR fixes (optional, in
fixes #<issue number>(, fixes #<issue_number>, ...)format, will close the issue(s) when PR gets merged):Part of #13305
/area util