@@ -39,7 +39,6 @@ import (
3939 "github.com/golang/protobuf/proto"
4040 dto "github.com/prometheus/client_model/go"
4141
42- v1 "k8s.io/api/core/v1"
4342 metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
4443 "k8s.io/client-go/informers"
4544 clientv1 "k8s.io/client-go/informers/core/v1"
@@ -48,9 +47,6 @@ import (
4847 "k8s.io/client-go/tools/cache"
4948 "k8s.io/klog/v2"
5049
51- client "github.com/project-codeflare/multi-cluster-app-dispatcher/pkg/client/clientset/controller-versioned/clients"
52- informerfactory "github.com/project-codeflare/multi-cluster-app-dispatcher/pkg/client/informers/controller-externalversion"
53- arbclient "github.com/project-codeflare/multi-cluster-app-dispatcher/pkg/client/informers/controller-externalversion/v1"
5450 "github.com/project-codeflare/multi-cluster-app-dispatcher/pkg/controller/clusterstate/api"
5551)
5652
@@ -64,18 +60,13 @@ type ClusterStateCache struct {
6460
6561 kubeclient * kubernetes.Clientset
6662
67- podInformer clientv1.PodInformer
68- nodeInformer clientv1.NodeInformer
69- schedulingSpecInformer arbclient.SchedulingSpecInformer
63+ nodeInformer clientv1.NodeInformer
7064
7165 Nodes map [string ]* api.NodeInfo
7266
7367 availableResources * api.Resource
7468 availableHistogram * api.ResourceHistogram
7569 resourceCapacities * api.Resource
76- deletedJobs * cache.FIFO
77-
78- errTasks * cache.FIFO
7970}
8071
8172func newClusterStateCache (config * rest.Config ) * ClusterStateCache {
@@ -98,38 +89,6 @@ func newClusterStateCache(config *rest.Config) *ClusterStateCache {
9889 0 ,
9990 )
10091
101- // create informer for pod information
102- sc .podInformer = informerFactory .Core ().V1 ().Pods ()
103- sc .podInformer .Informer ().AddEventHandler (
104- cache.FilteringResourceEventHandler {
105- FilterFunc : func (obj interface {}) bool {
106- switch obj .(type ) {
107- case * v1.Pod :
108- pod := obj .(* v1.Pod )
109- return pod .Status .Phase == v1 .PodRunning
110- //if pod.Status.Phase != v1.PodSucceeded && pod.Status.Phase != v1.PodFailed {
111- // return true
112- //} else {
113- // return false
114- //}
115- default :
116- return false
117- }
118- },
119- Handler : cache.ResourceEventHandlerFuncs {},
120- })
121-
122- // create queue informer
123- queueClient , _ , err := client .NewClient (config )
124- if err != nil {
125- panic (err )
126- }
127-
128- schedulingSpecInformerFactory := informerfactory .NewSharedInformerFactory (queueClient , 0 )
129- // create informer for Queue information
130- sc .schedulingSpecInformer = schedulingSpecInformerFactory .SchedulingSpec ().SchedulingSpecs ()
131- sc .schedulingSpecInformer .Informer ().AddEventHandler (cache.ResourceEventHandlerFuncs {})
132-
13392 sc .availableResources = api .EmptyResource ()
13493 sc .availableHistogram = api .NewResourceHistogram (api .EmptyResource (), api .EmptyResource ())
13594 sc .resourceCapacities = api .EmptyResource ()
@@ -139,10 +98,7 @@ func newClusterStateCache(config *rest.Config) *ClusterStateCache {
13998
14099func (sc * ClusterStateCache ) Run (stopCh <- chan struct {}) {
141100 klog .V (8 ).Infof ("Cluster State Cache started." )
142-
143- go sc .podInformer .Informer ().Run (stopCh )
144101 go sc .nodeInformer .Informer ().Run (stopCh )
145- go sc .schedulingSpecInformer .Informer ().Run (stopCh )
146102
147103 // Update cache
148104 go sc .updateCache ()
@@ -151,8 +107,6 @@ func (sc *ClusterStateCache) Run(stopCh <-chan struct{}) {
151107
152108func (sc * ClusterStateCache ) WaitForCacheSync (stopCh <- chan struct {}) bool {
153109 return cache .WaitForCacheSync (stopCh ,
154- sc .podInformer .Informer ().HasSynced ,
155- sc .schedulingSpecInformer .Informer ().HasSynced ,
156110 sc .nodeInformer .Informer ().HasSynced )
157111}
158112
0 commit comments