Skip to content

Commit

Permalink
fix: Remove the pkg/k8sutil/client.go and replace it with HAMi/pkg/ut…
Browse files Browse the repository at this point in the history
…il/client in pkg/scheduler/scheduler.go

Signed-off-by: Shouren Yang <yangshouren@gmail.com>
  • Loading branch information
Shouren committed Dec 6, 2024
1 parent 94ba833 commit 09448b9
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 52 deletions.
43 changes: 0 additions & 43 deletions pkg/k8sutil/client.go

This file was deleted.

11 changes: 2 additions & 9 deletions pkg/scheduler/scheduler.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ import (
"github.com/Project-HAMi/HAMi/pkg/scheduler/config"
"github.com/Project-HAMi/HAMi/pkg/scheduler/policy"
"github.com/Project-HAMi/HAMi/pkg/util"
"github.com/Project-HAMi/HAMi/pkg/util/client"

corev1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
Expand Down Expand Up @@ -71,12 +72,6 @@ func NewScheduler() *Scheduler {
return s
}

func check(err error) {
if err != nil {
klog.Fatal(err)
}
}

func (s *Scheduler) onUpdateNode(_, newObj interface{}) {
s.nodeNotify <- struct{}{}
}
Expand Down Expand Up @@ -125,9 +120,7 @@ func (s *Scheduler) onDelPod(obj interface{}) {
}

func (s *Scheduler) Start() {
kubeClient, err := k8sutil.NewClient()
check(err)
s.kubeClient = kubeClient
s.kubeClient = client.GetClient()

Check warning on line 123 in pkg/scheduler/scheduler.go

View check run for this annotation

Codecov / codecov/patch

pkg/scheduler/scheduler.go#L123

Added line #L123 was not covered by tests
informerFactory := informers.NewSharedInformerFactoryWithOptions(s.kubeClient, time.Hour*1)
s.podLister = informerFactory.Core().V1().Pods().Lister()
s.nodeLister = informerFactory.Core().V1().Nodes().Lister()
Expand Down

0 comments on commit 09448b9

Please sign in to comment.