mirror of
https://github.com/optim-enterprises-bv/kubernetes.git
synced 2025-11-01 02:38:12 +00:00
scheduler/framework: introduce pluggable SharedDRAManager
SharedDRAManager will be used by the DRA plugin to obtain DRA objects, and to track modifications to them in-memory. The current DRA plugin behavior will be the default implementation of SharedDRAManager. Plugging a different implementation will allow Cluster Autoscaler to provide a simulated state of DRA objects to the DRA plugin when making scheduling simulations, as well as obtain the modifications to DRA objects from the plugin.
This commit is contained in:
@@ -39,7 +39,6 @@ import (
|
||||
"k8s.io/kubernetes/pkg/scheduler/framework"
|
||||
"k8s.io/kubernetes/pkg/scheduler/framework/parallelize"
|
||||
"k8s.io/kubernetes/pkg/scheduler/metrics"
|
||||
"k8s.io/kubernetes/pkg/scheduler/util/assumecache"
|
||||
"k8s.io/kubernetes/pkg/util/slice"
|
||||
)
|
||||
|
||||
@@ -72,12 +71,12 @@ type frameworkImpl struct {
|
||||
// pluginsMap contains all plugins, by name.
|
||||
pluginsMap map[string]framework.Plugin
|
||||
|
||||
clientSet clientset.Interface
|
||||
kubeConfig *restclient.Config
|
||||
eventRecorder events.EventRecorder
|
||||
informerFactory informers.SharedInformerFactory
|
||||
resourceClaimCache *assumecache.AssumeCache
|
||||
logger klog.Logger
|
||||
clientSet clientset.Interface
|
||||
kubeConfig *restclient.Config
|
||||
eventRecorder events.EventRecorder
|
||||
informerFactory informers.SharedInformerFactory
|
||||
sharedDRAManager framework.SharedDRAManager
|
||||
logger klog.Logger
|
||||
|
||||
metricsRecorder *metrics.MetricAsyncRecorder
|
||||
profileName string
|
||||
@@ -128,7 +127,7 @@ type frameworkOptions struct {
|
||||
kubeConfig *restclient.Config
|
||||
eventRecorder events.EventRecorder
|
||||
informerFactory informers.SharedInformerFactory
|
||||
resourceClaimCache *assumecache.AssumeCache
|
||||
sharedDRAManager framework.SharedDRAManager
|
||||
snapshotSharedLister framework.SharedLister
|
||||
metricsRecorder *metrics.MetricAsyncRecorder
|
||||
podNominator framework.PodNominator
|
||||
@@ -180,10 +179,10 @@ func WithInformerFactory(informerFactory informers.SharedInformerFactory) Option
|
||||
}
|
||||
}
|
||||
|
||||
// WithResourceClaimCache sets the resource claim cache for the scheduling frameworkImpl.
|
||||
func WithResourceClaimCache(resourceClaimCache *assumecache.AssumeCache) Option {
|
||||
// WithSharedDRAManager sets SharedDRAManager for the framework.
|
||||
func WithSharedDRAManager(sharedDRAManager framework.SharedDRAManager) Option {
|
||||
return func(o *frameworkOptions) {
|
||||
o.resourceClaimCache = resourceClaimCache
|
||||
o.sharedDRAManager = sharedDRAManager
|
||||
}
|
||||
}
|
||||
|
||||
@@ -267,7 +266,6 @@ func NewFramework(ctx context.Context, r Registry, profile *config.KubeScheduler
|
||||
if options.logger != nil {
|
||||
logger = *options.logger
|
||||
}
|
||||
|
||||
f := &frameworkImpl{
|
||||
registry: r,
|
||||
snapshotSharedLister: options.snapshotSharedLister,
|
||||
@@ -277,7 +275,7 @@ func NewFramework(ctx context.Context, r Registry, profile *config.KubeScheduler
|
||||
kubeConfig: options.kubeConfig,
|
||||
eventRecorder: options.eventRecorder,
|
||||
informerFactory: options.informerFactory,
|
||||
resourceClaimCache: options.resourceClaimCache,
|
||||
sharedDRAManager: options.sharedDRAManager,
|
||||
metricsRecorder: options.metricsRecorder,
|
||||
extenders: options.extenders,
|
||||
PodNominator: options.podNominator,
|
||||
@@ -1617,8 +1615,9 @@ func (f *frameworkImpl) SharedInformerFactory() informers.SharedInformerFactory
|
||||
return f.informerFactory
|
||||
}
|
||||
|
||||
func (f *frameworkImpl) ResourceClaimCache() *assumecache.AssumeCache {
|
||||
return f.resourceClaimCache
|
||||
// SharedDRAManager returns the SharedDRAManager of the framework.
|
||||
func (f *frameworkImpl) SharedDRAManager() framework.SharedDRAManager {
|
||||
return f.sharedDRAManager
|
||||
}
|
||||
|
||||
func (f *frameworkImpl) pluginsNeeded(plugins *config.Plugins) sets.Set[string] {
|
||||
|
||||
Reference in New Issue
Block a user