Skip to content

Commit

Permalink
fix nodeInformer cache
Browse files Browse the repository at this point in the history
  • Loading branch information
champly committed Jun 2, 2021
1 parent 573ec23 commit ec6b982
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion pkg/descheduler/descheduler.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import (
"context"
"fmt"

"k8s.io/api/core/v1"
v1 "k8s.io/api/core/v1"
"k8s.io/apimachinery/pkg/util/wait"
"k8s.io/client-go/informers"
clientset "k8s.io/client-go/kubernetes"
Expand Down Expand Up @@ -72,6 +72,8 @@ type strategyFunction func(ctx context.Context, client clientset.Interface, stra
func RunDeschedulerStrategies(ctx context.Context, rs *options.DeschedulerServer, deschedulerPolicy *api.DeschedulerPolicy, evictionPolicyGroupVersion string, stopChannel chan struct{}) error {
sharedInformerFactory := informers.NewSharedInformerFactory(rs.Client, 0)
nodeInformer := sharedInformerFactory.Core().V1().Nodes()
// just trigger sharedInformerFactory add node informers
nodeInformer.Informer()

sharedInformerFactory.Start(stopChannel)
sharedInformerFactory.WaitForCacheSync(stopChannel)
Expand Down

0 comments on commit ec6b982

Please sign in to comment.