Skip to content

Commit

Permalink
fix(scheduler): The client should inherit framework configs (#309)
Browse files Browse the repository at this point in the history
  • Loading branch information
RealAnna authored Nov 4, 2022
1 parent a8f58a4 commit 847a460
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions scheduler/pkg/klcpermit/permit.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import (
v1 "k8s.io/api/core/v1"
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/client-go/dynamic"
"k8s.io/client-go/rest"
"k8s.io/klog/v2"
"k8s.io/kubernetes/pkg/scheduler/framework"
)
Expand Down Expand Up @@ -76,7 +75,7 @@ func (pl *Permit) monitorPod(ctx context.Context, p *v1.Pod) {

// New initializes a new plugin and returns it.
func New(_ runtime.Object, h framework.Handle) (framework.Plugin, error) {
client, err := newClient()
client, err := newClient(h)
if err != nil {
return nil, err
}
Expand All @@ -87,11 +86,8 @@ func New(_ runtime.Object, h framework.Handle) (framework.Plugin, error) {
}, nil
}

func newClient() (dynamic.Interface, error) {
config, err := rest.InClusterConfig()
if err != nil {
return nil, err
}
func newClient(handle framework.Handle) (dynamic.Interface, error) {
config := handle.KubeConfig()

dynClient, err := dynamic.NewForConfig(config)
if err != nil {
Expand Down

0 comments on commit 847a460

Please sign in to comment.