Skip to content

Commit b512861

Browse files
authored
fix: Remove the pkg/k8sutil/client.go and replace it with HAMi/pkg/util/client in pkg/scheduler/scheduler.go (#681)
Signed-off-by: Shouren Yang <[email protected]>
1 parent 6636542 commit b512861

File tree

2 files changed

+2
-52
lines changed

2 files changed

+2
-52
lines changed

pkg/k8sutil/client.go

Lines changed: 0 additions & 43 deletions
This file was deleted.

pkg/scheduler/scheduler.go

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ import (
4040
"github.com/Project-HAMi/HAMi/pkg/scheduler/config"
4141
"github.com/Project-HAMi/HAMi/pkg/scheduler/policy"
4242
"github.com/Project-HAMi/HAMi/pkg/util"
43+
"github.com/Project-HAMi/HAMi/pkg/util/client"
4344
)
4445

4546
type Scheduler struct {
@@ -72,12 +73,6 @@ func NewScheduler() *Scheduler {
7273
return s
7374
}
7475

75-
func check(err error) {
76-
if err != nil {
77-
klog.Fatal(err)
78-
}
79-
}
80-
8176
func (s *Scheduler) onUpdateNode(_, newObj interface{}) {
8277
s.nodeNotify <- struct{}{}
8378
}
@@ -128,9 +123,7 @@ func (s *Scheduler) onDelPod(obj interface{}) {
128123

129124
func (s *Scheduler) Start() {
130125
klog.InfoS("Starting HAMi scheduler components")
131-
kubeClient, err := k8sutil.NewClient()
132-
check(err)
133-
s.kubeClient = kubeClient
126+
s.kubeClient = client.GetClient()
134127
informerFactory := informers.NewSharedInformerFactoryWithOptions(s.kubeClient, time.Hour*1)
135128
s.podLister = informerFactory.Core().V1().Pods().Lister()
136129
s.nodeLister = informerFactory.Core().V1().Nodes().Lister()

0 commit comments

Comments
 (0)