Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add NodeResourcesFitPlus and ScarceResourceAvoidance plugin #2302

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 11 additions & 7 deletions cmd/koord-scheduler/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,9 @@ import (
"github.com/koordinator-sh/koordinator/pkg/scheduler/plugins/elasticquota"
"github.com/koordinator-sh/koordinator/pkg/scheduler/plugins/loadaware"
"github.com/koordinator-sh/koordinator/pkg/scheduler/plugins/nodenumaresource"
noderesourcesfitplus "github.com/koordinator-sh/koordinator/pkg/scheduler/plugins/noderesourcefitplus"
"github.com/koordinator-sh/koordinator/pkg/scheduler/plugins/reservation"
"github.com/koordinator-sh/koordinator/pkg/scheduler/plugins/scarceresourceavoidance"

// Ensure metric package is initialized
_ "k8s.io/component-base/metrics/prometheus/clientgo"
Expand All @@ -40,13 +42,15 @@ import (
)

var koordinatorPlugins = map[string]frameworkruntime.PluginFactory{
loadaware.Name: loadaware.New,
nodenumaresource.Name: nodenumaresource.New,
reservation.Name: reservation.New,
coscheduling.Name: coscheduling.New,
deviceshare.Name: deviceshare.New,
elasticquota.Name: elasticquota.New,
defaultprebind.Name: defaultprebind.New,
loadaware.Name: loadaware.New,
nodenumaresource.Name: nodenumaresource.New,
reservation.Name: reservation.New,
coscheduling.Name: coscheduling.New,
deviceshare.Name: deviceshare.New,
elasticquota.Name: elasticquota.New,
defaultprebind.Name: defaultprebind.New,
noderesourcesfitplus.Name: noderesourcesfitplus.New,
scarceresourceavoidance.Name: scarceresourceavoidance.New,
}

func flatten(plugins map[string]frameworkruntime.PluginFactory) []app.Option {
Expand Down
2 changes: 2 additions & 0 deletions pkg/scheduler/apis/config/register.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ func addKnownTypes(scheme *runtime.Scheme) error {
&ElasticQuotaArgs{},
&CoschedulingArgs{},
&DeviceShareArgs{},
&NodeResourcesFitPlusArgs{},
&ScarceResourceAvoidanceArgs{},
)
return nil
}
Expand Down
23 changes: 23 additions & 0 deletions pkg/scheduler/apis/config/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,11 @@ package config
import (
corev1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/kubernetes/pkg/scheduler/apis/config"
schedconfig "k8s.io/kubernetes/pkg/scheduler/apis/config"

"github.com/koordinator-sh/koordinator/apis/extension"
v1 "k8s.io/api/core/v1"
)

// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
Expand Down Expand Up @@ -237,3 +239,24 @@ type DeviceShareArgs struct {
// DisableDeviceNUMATopologyAlignment indicates device don't need to align with other resources' numa topology
DisableDeviceNUMATopologyAlignment bool
}

// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object

// ScarceResourceAvoidanceArgs defines the parameters for ScarceResourceAvoidance plugin.
type ScarceResourceAvoidanceArgs struct {
metav1.TypeMeta
Resources []v1.ResourceName
}

// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object

// NodeResourcesFitPlusArgs defines the parameters for NodeResourcesFitPlus plugin.
type NodeResourcesFitPlusArgs struct {
metav1.TypeMeta
Resources map[v1.ResourceName]ResourcesType
}

type ResourcesType struct {
Type config.ScoringStrategyType
Weight int64
}
2 changes: 2 additions & 0 deletions pkg/scheduler/apis/config/v1beta3/register.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ func addKnownTypes(scheme *runtime.Scheme) error {
&ElasticQuotaArgs{},
&CoschedulingArgs{},
&DeviceShareArgs{},
&NodeResourcesFitPlusArgs{},
&ScarceResourceAvoidanceArgs{},
)
return nil
}
Expand Down
23 changes: 23 additions & 0 deletions pkg/scheduler/apis/config/v1beta3/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ import (
schedconfigv1beta3 "k8s.io/kube-scheduler/config/v1beta3"

"github.com/koordinator-sh/koordinator/apis/extension"
v1 "k8s.io/api/core/v1"
"k8s.io/kubernetes/pkg/scheduler/apis/config"
)

// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
Expand Down Expand Up @@ -232,3 +234,24 @@ type DeviceShareArgs struct {
// DisableDeviceNUMATopologyAlignment indicates device don't need to align with other resources' numa topology
DisableDeviceNUMATopologyAlignment bool `json:"disableDeviceNUMATopologyAlignment,omitempty"`
}

// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object

// ScarceResourceAvoidanceArgs defines the parameters for ScarceResourceAvoidance plugin.
type ScarceResourceAvoidanceArgs struct {
metav1.TypeMeta
Resources []v1.ResourceName `json:"resources,omitempty"`
}

// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object

// NodeResourcesFitPlusArgs defines the parameters for NodeResourcesFitPlus plugin.
type NodeResourcesFitPlusArgs struct {
metav1.TypeMeta
Resources map[v1.ResourceName]ResourcesType `json:"resources"`
}

type ResourcesType struct {
Type config.ScoringStrategyType `json:"type"`
Weight int64 `json:"weight"`
}
92 changes: 92 additions & 0 deletions pkg/scheduler/apis/config/v1beta3/zz_generated.conversion.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

78 changes: 78 additions & 0 deletions pkg/scheduler/apis/config/v1beta3/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading
Loading