controller-runtime icon indicating copy to clipboard operation
controller-runtime copied to clipboard

difference between api reader and delegating client reader (with cache disabled)

Open sheelshah9 opened this issue 3 years ago • 2 comments

Hi,

I have ran into similar issues as #245 wherein I try to patch an object status and fetch it immediately in the next reconcile request. I tried using api reader (https://github.com/kubernetes-sigs/controller-runtime/blob/master/pkg/cluster/cluster.go#L172) and delegating client reader (with ClientDisableCacheFor my object, https://github.com/kubernetes-sigs/controller-runtime/blob/master/pkg/client/split.go#L128) and found that api reader only fails to fetch the updated object 5% of times (out of 100) while the delegating client reader never fails. From the implementation of both the functions I can see that api reader uses the same logic as delegating client reader (with cache disabled) wherein both of them try to hit the API server. Any idea why I see this discrepancy?

Thanks

sheelshah9 avatar Jul 24 '22 05:07 sheelshah9

No, I think they have no difference if you has disabled cache for the object.

found that api reader only fails to fetch the updated object 5% of times (out of 100)

What do you mean "failed to fetch"? Did it get error from APIServer, or you get an outdated object that is before your patching?

FillZpp avatar Jul 25 '22 11:07 FillZpp

I got an outdated object. Would it be helpful to add a flag to the update/patch command that is basically a blocking call to make sure that the object was actually patched in the API server before returning?

sheelshah9 avatar Jul 27 '22 18:07 sheelshah9

The Kubernetes project currently lacks enough contributors to adequately respond to all issues and PRs.

This bot triages issues and PRs according to the following rules:

  • After 90d of inactivity, lifecycle/stale is applied
  • After 30d of inactivity since lifecycle/stale was applied, lifecycle/rotten is applied
  • After 30d of inactivity since lifecycle/rotten was applied, the issue is closed

You can:

  • Mark this issue or PR as fresh with /remove-lifecycle stale
  • Mark this issue or PR as rotten with /lifecycle rotten
  • Close this issue or PR with /close
  • Offer to help out with Issue Triage

Please send feedback to sig-contributor-experience at kubernetes/community.

/lifecycle stale

k8s-triage-robot avatar Oct 25 '22 18:10 k8s-triage-robot

The Kubernetes project currently lacks enough active contributors to adequately respond to all issues and PRs.

This bot triages issues and PRs according to the following rules:

  • After 90d of inactivity, lifecycle/stale is applied
  • After 30d of inactivity since lifecycle/stale was applied, lifecycle/rotten is applied
  • After 30d of inactivity since lifecycle/rotten was applied, the issue is closed

You can:

  • Mark this issue or PR as fresh with /remove-lifecycle rotten
  • Close this issue or PR with /close
  • Offer to help out with Issue Triage

Please send feedback to sig-contributor-experience at kubernetes/community.

/lifecycle rotten

k8s-triage-robot avatar Nov 24 '22 19:11 k8s-triage-robot

The Kubernetes project currently lacks enough active contributors to adequately respond to all issues and PRs.

This bot triages issues according to the following rules:

  • After 90d of inactivity, lifecycle/stale is applied
  • After 30d of inactivity since lifecycle/stale was applied, lifecycle/rotten is applied
  • After 30d of inactivity since lifecycle/rotten was applied, the issue is closed

You can:

  • Reopen this issue with /reopen
  • Mark this issue as fresh with /remove-lifecycle rotten
  • Offer to help out with Issue Triage

Please send feedback to sig-contributor-experience at kubernetes/community.

/close not-planned

k8s-triage-robot avatar Dec 24 '22 19:12 k8s-triage-robot

@k8s-triage-robot: Closing this issue, marking it as "Not Planned".

In response to this:

The Kubernetes project currently lacks enough active contributors to adequately respond to all issues and PRs.

This bot triages issues according to the following rules:

  • After 90d of inactivity, lifecycle/stale is applied
  • After 30d of inactivity since lifecycle/stale was applied, lifecycle/rotten is applied
  • After 30d of inactivity since lifecycle/rotten was applied, the issue is closed

You can:

  • Reopen this issue with /reopen
  • Mark this issue as fresh with /remove-lifecycle rotten
  • Offer to help out with Issue Triage

Please send feedback to sig-contributor-experience at kubernetes/community.

/close not-planned

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 avatar Dec 24 '22 19:12 k8s-ci-robot