Skip to content

🌱 Optimise patch calls#13367

Open
fabriziopandini wants to merge 1 commit intokubernetes-sigs:mainfrom
fabriziopandini:patch-improvements
Open

🌱 Optimise patch calls#13367
fabriziopandini wants to merge 1 commit intokubernetes-sigs:mainfrom
fabriziopandini:patch-improvements

Conversation

@fabriziopandini
Copy link
Member

@fabriziopandini fabriziopandini commented Feb 20, 2026

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

@k8s-ci-robot k8s-ci-robot added the area/util Issues or PRs related to utils label Feb 20, 2026
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign justinsb for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found here.

Details 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 size/L Denotes a PR that changes 100-499 lines, ignoring generated files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. labels Feb 20, 2026
@sbueringer sbueringer mentioned this pull request Feb 23, 2026
12 tasks
@fabriziopandini
Copy link
Member Author

/hold

Need rebase

@k8s-ci-robot k8s-ci-robot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Feb 23, 2026
@fabriziopandini
Copy link
Member Author

/hold cancel

@k8s-ci-robot k8s-ci-robot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Feb 23, 2026
@k8s-ci-robot
Copy link
Contributor

@fabriziopandini: The following test failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
pull-cluster-api-test-main 7a7828a link true /test pull-cluster-api-test-main

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.

Details

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-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) {
Copy link
Member

Choose a reason for hiding this comment

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

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
}

Copy link
Member

@sbueringer sbueringer Feb 24, 2026

Choose a reason for hiding this comment

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

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)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/util Issues or PRs related to utils cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants