diff --git a/cmd/podgrouper/app/app.go b/cmd/podgrouper/app/app.go index bbe75aa08..3466ad41f 100644 --- a/cmd/podgrouper/app/app.go +++ b/cmd/podgrouper/app/app.go @@ -24,7 +24,7 @@ import ( metricsserver "sigs.k8s.io/controller-runtime/pkg/metrics/server" "sigs.k8s.io/controller-runtime/pkg/webhook" - "github.com/NVIDIA/KAI-scheduler/pkg/apis/scheduling/v2" + v2 "github.com/NVIDIA/KAI-scheduler/pkg/apis/scheduling/v2" kubeAiSchedulerV2alpha2 "github.com/NVIDIA/KAI-scheduler/pkg/apis/scheduling/v2alpha2" controllers "github.com/NVIDIA/KAI-scheduler/pkg/podgrouper" pluginshub "github.com/NVIDIA/KAI-scheduler/pkg/podgrouper/podgrouper/hub" @@ -51,7 +51,7 @@ func init() { type App struct { Mgr manager.Manager - DefaultPluginsHub pluginshub.PluginsHub + DefaultPluginsHub *pluginshub.DefaultPluginsHub configs controllers.Configs pluginsHub pluginshub.PluginsHub diff --git a/pkg/podgrouper/podgrouper/hub/hub.go b/pkg/podgrouper/podgrouper/hub/hub.go index 005b33b5d..2e72295a9 100644 --- a/pkg/podgrouper/podgrouper/hub/hub.go +++ b/pkg/podgrouper/podgrouper/hub/hub.go @@ -77,6 +77,19 @@ func (ph *DefaultPluginsHub) GetPodGrouperPlugin(gvk metav1.GroupVersionKind) gr return ph.defaultPlugin } +func (ph *DefaultPluginsHub) GetDefaultPlugin() grouper.Grouper { + return ph.defaultPlugin +} + +func (ph *DefaultPluginsHub) HasMatchingPlugin(gvk metav1.GroupVersionKind) bool { + // search using wildcard version - this hub will return a plugin even if the version is not exact match + gvk.Version = "*" + if _, found := ph.customPlugins[gvk]; found { + return true + } + return false +} + func NewDefaultPluginsHub(kubeClient client.Client, searchForLegacyPodGroups, gangScheduleKnative bool, queueLabelKey, nodePoolLabelKey string, defaultPrioritiesConfigMapName, defaultPrioritiesConfigMapNamespace string) *DefaultPluginsHub {