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

🌱 cluster/topology: use cached Cluster get in Reconcile #8936

Merged

Conversation

sbueringer
Copy link
Member

Signed-off-by: Stefan Büringer buringerst@vmware.com

What this PR does / why we need it:
Basically the same optimization as in #8922. More information in the added godoc

Which issue(s) this PR fixes (optional, in fixes #<issue number>(, fixes #<issue_number>, ...) format, will close the issue(s) when PR gets merged):
Related #8814

@k8s-ci-robot k8s-ci-robot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label Jun 29, 2023
@k8s-ci-robot k8s-ci-robot added the size/S Denotes a PR that changes 10-29 lines, ignoring generated files. label Jun 29, 2023
@sbueringer sbueringer mentioned this pull request Jun 29, 2023
27 tasks
@sbueringer
Copy link
Member Author

/assign @fabriziopandini @killianmuldoon @ykakarap

/hold
for
/test pull-cluster-api-e2e-full-main

@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 Jun 29, 2023
@sbueringer
Copy link
Member Author

/hold cancel

e2e tests green, also works very well in scale tests

@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 Jun 29, 2023
return s.Current.Cluster.GetResourceVersion() != cachedCluster.GetResourceVersion(), nil
})
if err != nil {
return errors.Wrapf(err, "failed to patch %s: failed waiting for Cluster to be updated in cache", tlog.KObj{Obj: s.Current.Cluster})
Copy link
Member

@enxebre enxebre Jun 30, 2023

Choose a reason for hiding this comment

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

How is this "failed to patch" given we are beyond l439?
Also how does a wait here impact the controller workflow at all? As soon as the the patch request above or any other is sent a new event will trigger reconciliation and another worker thread of the controller will pick it, right?

Copy link
Member Author

@sbueringer sbueringer Jun 30, 2023

Choose a reason for hiding this comment

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

How is this "failed to patch" given we are beyond l439?

Good point. You're right

Also how does a wait here impact the controller workflow at all? As soon as the the patch request above or any other is sent a new event will trigger reconciliation and another worker thread of the controller will pick it, right?

Controller-runtime guarantees that there is at most one worker reconciling a specific object / cluster in this case. So while the Patch call will trigger a new reconcile (to be very specific by marking the Cluster item as dirty in the queue) the next reconcile will be deferred until the current reconcile is finished

Signed-off-by: Stefan Büringer buringerst@vmware.com
@sbueringer sbueringer force-pushed the pr-cluster-topology-cached-get branch from d2bd005 to abdcd98 Compare June 30, 2023 10:33
@sbueringer
Copy link
Member Author

sbueringer commented Jun 30, 2023

@enxebre Thx for the review. Should be fixed / answered. I had to rebase onto main so I could also fix simlar error messages in other cases.

@sbueringer
Copy link
Member Author

/test pull-cluster-api-e2e-full-main

Copy link
Contributor

@killianmuldoon killianmuldoon 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 Jun 30, 2023
@k8s-ci-robot
Copy link
Contributor

LGTM label has been added.

Git tree hash: 65cbcfb70ce828a00b3f40d64d6bfb268120145e

@enxebre
Copy link
Member

enxebre commented Jun 30, 2023

/approve

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: enxebre

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 Jun 30, 2023
@k8s-ci-robot k8s-ci-robot merged commit 8ccb67c into kubernetes-sigs:main Jun 30, 2023
10 checks passed
@k8s-ci-robot k8s-ci-robot added this to the v1.5 milestone Jun 30, 2023
@sbueringer sbueringer deleted the pr-cluster-topology-cached-get branch June 30, 2023 12:55
@killianmuldoon
Copy link
Contributor

/area clusterclass

@k8s-ci-robot k8s-ci-robot added the area/clusterclass Issues or PRs related to clusterclass label Jul 5, 2023
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. area/clusterclass Issues or PRs related to clusterclass cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. lgtm "Looks good to me", indicates that a PR is ready to be merged. size/S Denotes a PR that changes 10-29 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants