-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
🌱 Pass Object's GVK version when reconcile. #1570
🌱 Pass Object's GVK version when reconcile. #1570
Conversation
/assign @gerred |
@mengqiy @pwittrock @gerred Could you help to take a look if this PR makes sense? I would fix fail test cases if you are OK with this appoarch. |
e2f8f8d
to
c35caf6
Compare
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: haosdent The full list of commands accepted by this bot can be found here.
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
@haosdent: The following tests 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. 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. I understand the commands that are listed here. |
This feature is very specifically eschewed from controller-runtime as controllers watching multiple root objects is both an anti-pattern and about as impossible as we can make it (ex. calling |
Hi, @coderanger thanks a lot for your comment. We understand it is an anti-pattern, but we still would like to find an approach to address performance issue. |
Why do you think there is a performance issue? |
/hold |
Hi, @coderanger the performance issue is because
|
@haosdent While technically yes, that is O(N) operations, they are extremely fast because it's working with a local cache of the objects. Do you have any evidence of actual performance issues causing problems in real use? I don't think we're interested in extremely footgun-y options to deal with hypothetical cases :) You can also cache one direction of the association in ownership references or annotations pretty easily, or just keep a local in-memory cache of it. I think all of those would be a better option than breaking our "stateless reconcile" model. |
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:
You can:
Please send feedback to sig-contributor-experience at kubernetes/community. /lifecycle stale |
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:
You can:
Please send feedback to sig-contributor-experience at kubernetes/community. /lifecycle rotten |
@haosdent The question is, even if you can pass But there will be a race condition that a same |
Hi, @FillZpp thx a lot for your comment. |
@coderanger Sry for missing your comment. Although we have the local cache, when there are 200k pods, it would become very slow. |
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:
You can:
Please send feedback to sig-contributor-experience at kubernetes/community. /close |
@k8s-triage-robot: Closed this PR. In response to this:
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. |
This PR tries to pass the Object's GVK info when reconciling resources in the controller. This would be helpful when the controller is watching multiple resources.
e.g. Suppose we have a CRD
PodHealthySet
, which status containsReadyPods
as a counter to record how manyPod
s are healthy under a specific selector.In our
PodHealthySet Controller
, we watchPodHealthySet
andPod
resources together.When Pod healthy status changed, we would like to update
PodHealthySet.Status.ReadyPods
.If we use
EnqueueRequestsFromMapFunc
, to countPodHealthySet.Status.ReadyPods
, request chain isPodHealthySet
for a specificPod
inEnqueueRequestsFromMapFunc
, then we enqueuePodHealthySet
reconcile request.PodHealthySet.Reconcile
, and calculateReadyPods
. => This would become slower as more and morePod
andPodHealthySet
objects.If we support pass object's GVK when reconcile, we could identify reconcile from which kind of object, and then don't need the slow Step 2 above.