-
Notifications
You must be signed in to change notification settings - Fork 681
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
fix(propeller): Replace SharedIndexInformer with Informer #5129
fix(propeller): Replace SharedIndexInformer with Informer #5129
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #5129 +/- ##
==========================================
+ Coverage 59.06% 59.93% +0.86%
==========================================
Files 646 463 -183
Lines 55714 39030 -16684
==========================================
- Hits 32910 23394 -9516
+ Misses 20208 13792 -6416
+ Partials 2596 1844 -752
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The fix looks good overall! Thanks for the quick help! But it would be better if you can add the logics behind why you made this change. The reader only knows "what is the issue" and "the solution", but there is a gap in between
counts := r.countList(ctx, objects) | ||
|
||
pods := &corev1.PodList{} | ||
if err := r.kubeClient.GetClient().List(ctx, pods); err != nil { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am uncertain about the change here. Originally, sharedInformer fetches the resources it listens to, but now it changes to only fetches pods. Also, the code seems be metrics collecting and is from four years ago. I am not sure if the code is still relevant. cc @wild-endeavor
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agreed, it is not safe to update this to a PodList
because it will not capture other k8s resource types for other Flyte plugins (ex. Spark, Ray, TF, PyTorch, etc).
@@ -668,16 +668,10 @@ func getPluginGvk(resourceToWatch runtime.Object) (schema.GroupVersionKind, erro | |||
return kinds[0], nil | |||
} | |||
|
|||
func getPluginSharedInformer(ctx context.Context, kubeClient pluginsCore.KubeClient, resourceToWatch client.Object) (cache.SharedIndexInformer, error) { | |||
func getPluginSharedInformer(ctx context.Context, kubeClient pluginsCore.KubeClient, resourceToWatch client.Object) (cache.Informer, error) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit:
func getPluginSharedInformer(ctx context.Context, kubeClient pluginsCore.KubeClient, resourceToWatch client.Object) (cache.Informer, error) { | |
func getPluginInformer(ctx context.Context, kubeClient pluginsCore.KubeClient, resourceToWatch client.Object) (cache.Informer, error) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
aa10ed9
to
80037f5
Compare
Resolves: flyteorg#5087 Signed-off-by: Chi-Sheng Liu <[email protected]>
Update unittests corresponding to the changes from SharedIndexInformer to Informer Resolves: flyteorg#5087 Signed-off-by: Chi-Sheng Liu <[email protected]>
80037f5
to
70d0573
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@MortalHappiness thanks for the PR here! Great insight, but I'm actually wondering if we have gone too far here. The original code just retrieves the informer and uses the cache.sharedIndexInformer
to periodically retrieve the list of k8s resources so that it can emit a metric. This obviously pulls from a cache.
Does it make more sense to just use the cache (ie. kubeClient.GetCache()
) within the ResourceLevelMonitor
and periodically retrieve directly from there depending on object type? So this line could instead be:
rm := monitorIndex.GetOrCreateResourceLevelMonitor(ctx, metricsScope, kubeClient.GetCache(), entry.ResourceToWatch, gvk)
Superseded by #5238. |
Tracking issue
Resolves: #5087
Why are the changes needed?
See the issue for detailed information.
What changes were proposed in this pull request?
SharedIndexInformer
(client-go
) withInformer
(controller-runtime
)core.KubeClient
toResourceLevelMonitor
objects
withPodList
How was this patch tested?
Setup process
Screenshots
Check all the applicable boxes
Related PRs
Docs link