mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-09-20 09:33:52 +00:00
Surface kube config in scheduler framework handle
This commit is contained in:
@@ -32,6 +32,7 @@ import (
|
||||
"k8s.io/client-go/informers"
|
||||
coreinformers "k8s.io/client-go/informers/core/v1"
|
||||
clientset "k8s.io/client-go/kubernetes"
|
||||
restclient "k8s.io/client-go/rest"
|
||||
"k8s.io/client-go/tools/cache"
|
||||
"k8s.io/klog/v2"
|
||||
podutil "k8s.io/kubernetes/pkg/api/v1/pod"
|
||||
@@ -89,6 +90,7 @@ type Scheduler struct {
|
||||
}
|
||||
|
||||
type schedulerOptions struct {
|
||||
kubeConfig *restclient.Config
|
||||
schedulerAlgorithmSource schedulerapi.SchedulerAlgorithmSource
|
||||
percentageOfNodesToScore int32
|
||||
podInitialBackoffSeconds int64
|
||||
@@ -104,6 +106,13 @@ type schedulerOptions struct {
|
||||
// Option configures a Scheduler
|
||||
type Option func(*schedulerOptions)
|
||||
|
||||
// WithKubeConfig sets the kube config for Scheduler.
|
||||
func WithKubeConfig(cfg *restclient.Config) Option {
|
||||
return func(o *schedulerOptions) {
|
||||
o.kubeConfig = cfg
|
||||
}
|
||||
}
|
||||
|
||||
// WithProfiles sets profiles for Scheduler. By default, there is one profile
|
||||
// with the name "default-scheduler".
|
||||
func WithProfiles(p ...schedulerapi.KubeSchedulerProfile) Option {
|
||||
@@ -214,6 +223,7 @@ func New(client clientset.Interface,
|
||||
|
||||
configurator := &Configurator{
|
||||
client: client,
|
||||
kubeConfig: options.kubeConfig,
|
||||
recorderFactory: recorderFactory,
|
||||
informerFactory: informerFactory,
|
||||
schedulerCache: schedulerCache,
|
||||
|
Reference in New Issue
Block a user