Open kingeasternsun opened 1 week ago
add
vcinformer.SharedInformerFactory vcClient vcclient.Interface
to framework.Sesstion
type Session struct { UID types.UID kubeClient kubernetes.Interface recorder record.EventRecorder cache cache.Cache restConfig *rest.Config informerFactory informers.SharedInformerFactory vcinformer.SharedInformerFactory vcClient vcclient.Interface
Some plugin need get vcClient and vcinformer from session, otherwise they have to create a separate vcClient and vcinformer.
for example, in ascend-volcano-plugin https://gitee.com/ascend/ascend-for-volcano/blob/branch_v6.0.0-RC1/plugin/factory.go#L426 , they have to create a a separate vcClient and vcinformer, these vcinfomer cannot share indexer cache with the informer in scheduler.
func (sHandle *ScheduleHandler) initNSLB2(ssn *framework.Session) error { vcClient, err := NewVCClinetk8s() if err != nil { klog.V(util.LogErrorLev).Infof("create vc client err: %v.", err) return err } factory := externalversions.NewSharedInformerFactory(vcClient, 0) pgInformer := factory.Scheduling().V1beta1().PodGroups() cacheIndexer := pgInformer.Informer().GetIndexer() agents, err := NewAgent(ssn.KubeClient(), newConfig()) if err != nil { klog.V(util.LogErrorLev).Infof("create agent err: %v", err) return err } ... }
I think it's reasonable.
Why informer is used instead of snapshot of that?
What would you like to be added:
add
to framework.Sesstion
Why is this needed:
Some plugin need get vcClient and vcinformer from session, otherwise they have to create a separate vcClient and vcinformer.
for example, in ascend-volcano-plugin https://gitee.com/ascend/ascend-for-volcano/blob/branch_v6.0.0-RC1/plugin/factory.go#L426 , they have to create a a separate vcClient and vcinformer, these vcinfomer cannot share indexer cache with the informer in scheduler.