[
https://issues.apache.org/jira/browse/YUNIKORN-2625?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17847922#comment-17847922
]
Craig Condit commented on YUNIKORN-2625:
----------------------------------------
I'm not really sure this is an improvement. It exposes a lot more
implementation details.
> Refactor Clients to avoid hard-code checks
> ------------------------------------------
>
> Key: YUNIKORN-2625
> URL: https://issues.apache.org/jira/browse/YUNIKORN-2625
> Project: Apache YuniKorn
> Issue Type: Improvement
> Reporter: Chia-Ping Tsai
> Assignee: Arthur Wang
> Priority: Minor
> Labels: pull-request-available
>
>
> {code:java}
> if c.NodeInformer.Informer().HasSynced() &&
> c.PodInformer.Informer().HasSynced() &&
> c.PVCInformer.Informer().HasSynced() &&
> c.PVInformer.Informer().HasSynced() &&
> c.StorageInformer.Informer().HasSynced() &&
> c.CSINodeInformer.Informer().HasSynced() &&
> c.ConfigMapInformer.Informer().HasSynced() &&
> c.NamespaceInformer.Informer().HasSynced() &&
> c.PriorityClassInformer.Informer().HasSynced() {
> return
> } {code}
>
> {code:java}
> go c.NodeInformer.Informer().Run(stopCh)
> go c.PodInformer.Informer().Run(stopCh)
> go c.PVInformer.Informer().Run(stopCh)
> go c.PVCInformer.Informer().Run(stopCh)
> go c.StorageInformer.Informer().Run(stopCh)
> go c.CSINodeInformer.Informer().Run(stopCh)
> go c.ConfigMapInformer.Informer().Run(stopCh)
> go c.NamespaceInformer.Informer().Run(stopCh)
> go c.PriorityClassInformer.Informer().Run(stopCh) {code}
> Instead of listing all informer manually, we should add a method to `Clients`
> to list all informers and then loop all of them. That can bring two benefits.
>
> # more readable
> # easy to write tests. We can override the `informers` method to return mock
> informer
> # avoid error-prone (we could miss one of informers in adding more helper
> methods in the future)
>
>
--
This message was sent by Atlassian Jira
(v8.20.10#820010)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]