mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-23 19:56:01 +00:00
Merge pull request #102746 from ahg-g/ahg-names
Define in-tree scheduler plugin names in separate pkg
This commit is contained in:
commit
0d9c29078b
@ -24,10 +24,11 @@ import (
|
|||||||
"k8s.io/apimachinery/pkg/runtime"
|
"k8s.io/apimachinery/pkg/runtime"
|
||||||
"k8s.io/klog/v2"
|
"k8s.io/klog/v2"
|
||||||
"k8s.io/kubernetes/pkg/scheduler/framework"
|
"k8s.io/kubernetes/pkg/scheduler/framework"
|
||||||
|
"k8s.io/kubernetes/pkg/scheduler/framework/plugins/names"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Name of the plugin used in the plugin registry and configurations.
|
// Name of the plugin used in the plugin registry and configurations.
|
||||||
const Name = "DefaultBinder"
|
const Name = names.DefaultBinder
|
||||||
|
|
||||||
// DefaultBinder binds pods to nodes using a k8s client.
|
// DefaultBinder binds pods to nodes using a k8s client.
|
||||||
type DefaultBinder struct {
|
type DefaultBinder struct {
|
||||||
|
@ -43,13 +43,14 @@ import (
|
|||||||
"k8s.io/kubernetes/pkg/scheduler/apis/config/validation"
|
"k8s.io/kubernetes/pkg/scheduler/apis/config/validation"
|
||||||
"k8s.io/kubernetes/pkg/scheduler/framework"
|
"k8s.io/kubernetes/pkg/scheduler/framework"
|
||||||
"k8s.io/kubernetes/pkg/scheduler/framework/plugins/feature"
|
"k8s.io/kubernetes/pkg/scheduler/framework/plugins/feature"
|
||||||
|
"k8s.io/kubernetes/pkg/scheduler/framework/plugins/names"
|
||||||
"k8s.io/kubernetes/pkg/scheduler/metrics"
|
"k8s.io/kubernetes/pkg/scheduler/metrics"
|
||||||
"k8s.io/kubernetes/pkg/scheduler/util"
|
"k8s.io/kubernetes/pkg/scheduler/util"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
// Name of the plugin used in the plugin registry and configurations.
|
// Name of the plugin used in the plugin registry and configurations.
|
||||||
Name = "DefaultPreemption"
|
Name = names.DefaultPreemption
|
||||||
)
|
)
|
||||||
|
|
||||||
// DefaultPreemption is a PostFilter plugin implements the preemption logic.
|
// DefaultPreemption is a PostFilter plugin implements the preemption logic.
|
||||||
|
@ -24,6 +24,7 @@ import (
|
|||||||
v1 "k8s.io/api/core/v1"
|
v1 "k8s.io/api/core/v1"
|
||||||
"k8s.io/apimachinery/pkg/runtime"
|
"k8s.io/apimachinery/pkg/runtime"
|
||||||
"k8s.io/kubernetes/pkg/scheduler/framework"
|
"k8s.io/kubernetes/pkg/scheduler/framework"
|
||||||
|
"k8s.io/kubernetes/pkg/scheduler/framework/plugins/names"
|
||||||
)
|
)
|
||||||
|
|
||||||
// The two thresholds are used as bounds for the image score range. They correspond to a reasonable size range for
|
// The two thresholds are used as bounds for the image score range. They correspond to a reasonable size range for
|
||||||
@ -42,7 +43,7 @@ type ImageLocality struct {
|
|||||||
var _ framework.ScorePlugin = &ImageLocality{}
|
var _ framework.ScorePlugin = &ImageLocality{}
|
||||||
|
|
||||||
// Name is the name of the plugin used in the plugin registry and configurations.
|
// Name is the name of the plugin used in the plugin registry and configurations.
|
||||||
const Name = "ImageLocality"
|
const Name = names.ImageLocality
|
||||||
|
|
||||||
// Name returns name of the plugin. It is used in logs, etc.
|
// Name returns name of the plugin. It is used in logs, etc.
|
||||||
func (pl *ImageLocality) Name() string {
|
func (pl *ImageLocality) Name() string {
|
||||||
|
@ -27,12 +27,13 @@ import (
|
|||||||
"k8s.io/kubernetes/pkg/scheduler/apis/config/validation"
|
"k8s.io/kubernetes/pkg/scheduler/apis/config/validation"
|
||||||
"k8s.io/kubernetes/pkg/scheduler/framework"
|
"k8s.io/kubernetes/pkg/scheduler/framework"
|
||||||
"k8s.io/kubernetes/pkg/scheduler/framework/plugins/feature"
|
"k8s.io/kubernetes/pkg/scheduler/framework/plugins/feature"
|
||||||
|
"k8s.io/kubernetes/pkg/scheduler/framework/plugins/names"
|
||||||
"k8s.io/kubernetes/pkg/scheduler/internal/parallelize"
|
"k8s.io/kubernetes/pkg/scheduler/internal/parallelize"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
// Name is the name of the plugin used in the plugin registry and configurations.
|
// Name is the name of the plugin used in the plugin registry and configurations.
|
||||||
Name = "InterPodAffinity"
|
Name = names.InterPodAffinity
|
||||||
)
|
)
|
||||||
|
|
||||||
var _ framework.PreFilterPlugin = &InterPodAffinity{}
|
var _ framework.PreFilterPlugin = &InterPodAffinity{}
|
||||||
|
48
pkg/scheduler/framework/plugins/names/names.go
Normal file
48
pkg/scheduler/framework/plugins/names/names.go
Normal file
@ -0,0 +1,48 @@
|
|||||||
|
/*
|
||||||
|
Copyright 2021 The Kubernetes Authors.
|
||||||
|
|
||||||
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
you may not use this file except in compliance with the License.
|
||||||
|
You may obtain a copy of the License at
|
||||||
|
|
||||||
|
http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
|
||||||
|
Unless required by applicable law or agreed to in writing, software
|
||||||
|
distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
See the License for the specific language governing permissions and
|
||||||
|
limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package names
|
||||||
|
|
||||||
|
const (
|
||||||
|
PrioritySort = "PrioritySort"
|
||||||
|
DefaultBinder = "DefaultBinder"
|
||||||
|
DefaultPreemption = "DefaultPreemption"
|
||||||
|
ImageLocality = "ImageLocality"
|
||||||
|
InterPodAffinity = "InterPodAffinity"
|
||||||
|
NodeAffinity = "NodeAffinity"
|
||||||
|
NodeLabel = "NodeLabel"
|
||||||
|
NodeName = "NodeName"
|
||||||
|
NodePorts = "NodePorts"
|
||||||
|
NodePreferAvoidPods = "NodePreferAvoidPods"
|
||||||
|
NodeResourcesBalancedAllocation = "NodeResourcesBalancedAllocation"
|
||||||
|
NodeResourcesFit = "NodeResourcesFit"
|
||||||
|
NodeResourcesLeastAllocated = "NodeResourcesLeastAllocated"
|
||||||
|
NodeResourcesMostAllocated = "NodeResourcesMostAllocated"
|
||||||
|
RequestedToCapacityRatio = "RequestedToCapacityRatio"
|
||||||
|
NodeUnschedulable = "NodeUnschedulable"
|
||||||
|
NodeVolumeLimits = "NodeVolumeLimits"
|
||||||
|
AzureDiskLimits = "AzureDiskLimits"
|
||||||
|
CinderLimits = "CinderLimits"
|
||||||
|
EBSLimits = "EBSLimits"
|
||||||
|
GCEPDLimits = "GCEPDLimits"
|
||||||
|
PodTopologySpread = "PodTopologySpread"
|
||||||
|
SelectorSpread = "SelectorSpread"
|
||||||
|
ServiceAffinity = "ServiceAffinity"
|
||||||
|
TaintToleration = "TaintToleration"
|
||||||
|
VolumeBinding = "VolumeBinding"
|
||||||
|
VolumeRestrictions = "VolumeRestrictions"
|
||||||
|
VolumeZone = "VolumeZone"
|
||||||
|
)
|
@ -26,7 +26,8 @@ import (
|
|||||||
"k8s.io/kubernetes/pkg/scheduler/apis/config"
|
"k8s.io/kubernetes/pkg/scheduler/apis/config"
|
||||||
"k8s.io/kubernetes/pkg/scheduler/apis/config/validation"
|
"k8s.io/kubernetes/pkg/scheduler/apis/config/validation"
|
||||||
"k8s.io/kubernetes/pkg/scheduler/framework"
|
"k8s.io/kubernetes/pkg/scheduler/framework"
|
||||||
pluginhelper "k8s.io/kubernetes/pkg/scheduler/framework/plugins/helper"
|
"k8s.io/kubernetes/pkg/scheduler/framework/plugins/helper"
|
||||||
|
"k8s.io/kubernetes/pkg/scheduler/framework/plugins/names"
|
||||||
)
|
)
|
||||||
|
|
||||||
// NodeAffinity is a plugin that checks if a pod node selector matches the node label.
|
// NodeAffinity is a plugin that checks if a pod node selector matches the node label.
|
||||||
@ -44,7 +45,7 @@ var _ framework.EnqueueExtensions = &NodeAffinity{}
|
|||||||
|
|
||||||
const (
|
const (
|
||||||
// Name is the name of the plugin used in the plugin registry and configurations.
|
// Name is the name of the plugin used in the plugin registry and configurations.
|
||||||
Name = "NodeAffinity"
|
Name = names.NodeAffinity
|
||||||
|
|
||||||
// preScoreStateKey is the key in CycleState to NodeAffinity pre-computed data for Scoring.
|
// preScoreStateKey is the key in CycleState to NodeAffinity pre-computed data for Scoring.
|
||||||
preScoreStateKey = "PreScore" + Name
|
preScoreStateKey = "PreScore" + Name
|
||||||
@ -187,7 +188,7 @@ func (pl *NodeAffinity) Score(ctx context.Context, state *framework.CycleState,
|
|||||||
|
|
||||||
// NormalizeScore invoked after scoring all nodes.
|
// NormalizeScore invoked after scoring all nodes.
|
||||||
func (pl *NodeAffinity) NormalizeScore(ctx context.Context, state *framework.CycleState, pod *v1.Pod, scores framework.NodeScoreList) *framework.Status {
|
func (pl *NodeAffinity) NormalizeScore(ctx context.Context, state *framework.CycleState, pod *v1.Pod, scores framework.NodeScoreList) *framework.Status {
|
||||||
return pluginhelper.DefaultNormalizeScore(framework.MaxNodeScore, false, scores)
|
return helper.DefaultNormalizeScore(framework.MaxNodeScore, false, scores)
|
||||||
}
|
}
|
||||||
|
|
||||||
// ScoreExtensions of the Score plugin.
|
// ScoreExtensions of the Score plugin.
|
||||||
|
@ -30,10 +30,11 @@ import (
|
|||||||
"k8s.io/kubernetes/pkg/scheduler/apis/config"
|
"k8s.io/kubernetes/pkg/scheduler/apis/config"
|
||||||
"k8s.io/kubernetes/pkg/scheduler/apis/config/validation"
|
"k8s.io/kubernetes/pkg/scheduler/apis/config/validation"
|
||||||
"k8s.io/kubernetes/pkg/scheduler/framework"
|
"k8s.io/kubernetes/pkg/scheduler/framework"
|
||||||
|
"k8s.io/kubernetes/pkg/scheduler/framework/plugins/names"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Name of this plugin.
|
// Name of this plugin.
|
||||||
const Name = "NodeLabel"
|
const Name = names.NodeLabel
|
||||||
|
|
||||||
const (
|
const (
|
||||||
// ErrReasonPresenceViolated is used for CheckNodeLabelPresence predicate error.
|
// ErrReasonPresenceViolated is used for CheckNodeLabelPresence predicate error.
|
||||||
|
@ -22,6 +22,7 @@ import (
|
|||||||
v1 "k8s.io/api/core/v1"
|
v1 "k8s.io/api/core/v1"
|
||||||
"k8s.io/apimachinery/pkg/runtime"
|
"k8s.io/apimachinery/pkg/runtime"
|
||||||
"k8s.io/kubernetes/pkg/scheduler/framework"
|
"k8s.io/kubernetes/pkg/scheduler/framework"
|
||||||
|
"k8s.io/kubernetes/pkg/scheduler/framework/plugins/names"
|
||||||
)
|
)
|
||||||
|
|
||||||
// NodeName is a plugin that checks if a pod spec node name matches the current node.
|
// NodeName is a plugin that checks if a pod spec node name matches the current node.
|
||||||
@ -32,7 +33,7 @@ var _ framework.EnqueueExtensions = &NodeName{}
|
|||||||
|
|
||||||
const (
|
const (
|
||||||
// Name is the name of the plugin used in the plugin registry and configurations.
|
// Name is the name of the plugin used in the plugin registry and configurations.
|
||||||
Name = "NodeName"
|
Name = names.NodeName
|
||||||
|
|
||||||
// ErrReason returned when node name doesn't match.
|
// ErrReason returned when node name doesn't match.
|
||||||
ErrReason = "node(s) didn't match the requested node name"
|
ErrReason = "node(s) didn't match the requested node name"
|
||||||
|
@ -23,6 +23,7 @@ import (
|
|||||||
v1 "k8s.io/api/core/v1"
|
v1 "k8s.io/api/core/v1"
|
||||||
"k8s.io/apimachinery/pkg/runtime"
|
"k8s.io/apimachinery/pkg/runtime"
|
||||||
"k8s.io/kubernetes/pkg/scheduler/framework"
|
"k8s.io/kubernetes/pkg/scheduler/framework"
|
||||||
|
"k8s.io/kubernetes/pkg/scheduler/framework/plugins/names"
|
||||||
)
|
)
|
||||||
|
|
||||||
// NodePorts is a plugin that checks if a node has free ports for the requested pod ports.
|
// NodePorts is a plugin that checks if a node has free ports for the requested pod ports.
|
||||||
@ -34,7 +35,7 @@ var _ framework.EnqueueExtensions = &NodePorts{}
|
|||||||
|
|
||||||
const (
|
const (
|
||||||
// Name is the name of the plugin used in the plugin registry and configurations.
|
// Name is the name of the plugin used in the plugin registry and configurations.
|
||||||
Name = "NodePorts"
|
Name = names.NodePorts
|
||||||
|
|
||||||
// preFilterStateKey is the key in CycleState to NodePorts pre-computed data.
|
// preFilterStateKey is the key in CycleState to NodePorts pre-computed data.
|
||||||
// Using the name of the plugin will likely help us avoid collisions with other plugins.
|
// Using the name of the plugin will likely help us avoid collisions with other plugins.
|
||||||
|
@ -29,6 +29,7 @@ import (
|
|||||||
v1helper "k8s.io/component-helpers/scheduling/corev1"
|
v1helper "k8s.io/component-helpers/scheduling/corev1"
|
||||||
"k8s.io/klog/v2"
|
"k8s.io/klog/v2"
|
||||||
"k8s.io/kubernetes/pkg/scheduler/framework"
|
"k8s.io/kubernetes/pkg/scheduler/framework"
|
||||||
|
"k8s.io/kubernetes/pkg/scheduler/framework/plugins/names"
|
||||||
)
|
)
|
||||||
|
|
||||||
// NodePreferAvoidPods is a plugin that priorities nodes according to the node annotation
|
// NodePreferAvoidPods is a plugin that priorities nodes according to the node annotation
|
||||||
@ -40,7 +41,7 @@ type NodePreferAvoidPods struct {
|
|||||||
var _ framework.ScorePlugin = &NodePreferAvoidPods{}
|
var _ framework.ScorePlugin = &NodePreferAvoidPods{}
|
||||||
|
|
||||||
// Name is the name of the plugin used in the plugin registry and configurations.
|
// Name is the name of the plugin used in the plugin registry and configurations.
|
||||||
const Name = "NodePreferAvoidPods"
|
const Name = names.NodePreferAvoidPods
|
||||||
|
|
||||||
// Name returns name of the plugin. It is used in logs, etc.
|
// Name returns name of the plugin. It is used in logs, etc.
|
||||||
func (pl *NodePreferAvoidPods) Name() string {
|
func (pl *NodePreferAvoidPods) Name() string {
|
||||||
|
@ -25,6 +25,7 @@ import (
|
|||||||
"k8s.io/apimachinery/pkg/runtime"
|
"k8s.io/apimachinery/pkg/runtime"
|
||||||
"k8s.io/kubernetes/pkg/scheduler/framework"
|
"k8s.io/kubernetes/pkg/scheduler/framework"
|
||||||
"k8s.io/kubernetes/pkg/scheduler/framework/plugins/feature"
|
"k8s.io/kubernetes/pkg/scheduler/framework/plugins/feature"
|
||||||
|
"k8s.io/kubernetes/pkg/scheduler/framework/plugins/names"
|
||||||
)
|
)
|
||||||
|
|
||||||
// BalancedAllocation is a score plugin that calculates the difference between the cpu and memory fraction
|
// BalancedAllocation is a score plugin that calculates the difference between the cpu and memory fraction
|
||||||
@ -37,7 +38,7 @@ type BalancedAllocation struct {
|
|||||||
var _ = framework.ScorePlugin(&BalancedAllocation{})
|
var _ = framework.ScorePlugin(&BalancedAllocation{})
|
||||||
|
|
||||||
// BalancedAllocationName is the name of the plugin used in the plugin registry and configurations.
|
// BalancedAllocationName is the name of the plugin used in the plugin registry and configurations.
|
||||||
const BalancedAllocationName = "NodeResourcesBalancedAllocation"
|
const BalancedAllocationName = names.NodeResourcesBalancedAllocation
|
||||||
|
|
||||||
// Name returns name of the plugin. It is used in logs, etc.
|
// Name returns name of the plugin. It is used in logs, etc.
|
||||||
func (ba *BalancedAllocation) Name() string {
|
func (ba *BalancedAllocation) Name() string {
|
||||||
|
@ -29,6 +29,7 @@ import (
|
|||||||
"k8s.io/kubernetes/pkg/scheduler/apis/config/validation"
|
"k8s.io/kubernetes/pkg/scheduler/apis/config/validation"
|
||||||
"k8s.io/kubernetes/pkg/scheduler/framework"
|
"k8s.io/kubernetes/pkg/scheduler/framework"
|
||||||
"k8s.io/kubernetes/pkg/scheduler/framework/plugins/feature"
|
"k8s.io/kubernetes/pkg/scheduler/framework/plugins/feature"
|
||||||
|
"k8s.io/kubernetes/pkg/scheduler/framework/plugins/names"
|
||||||
)
|
)
|
||||||
|
|
||||||
var _ framework.PreFilterPlugin = &Fit{}
|
var _ framework.PreFilterPlugin = &Fit{}
|
||||||
@ -37,7 +38,7 @@ var _ framework.EnqueueExtensions = &Fit{}
|
|||||||
|
|
||||||
const (
|
const (
|
||||||
// FitName is the name of the plugin used in the plugin registry and configurations.
|
// FitName is the name of the plugin used in the plugin registry and configurations.
|
||||||
FitName = "NodeResourcesFit"
|
FitName = names.NodeResourcesFit
|
||||||
|
|
||||||
// preFilterStateKey is the key in CycleState to NodeResourcesFit pre-computed data.
|
// preFilterStateKey is the key in CycleState to NodeResourcesFit pre-computed data.
|
||||||
// Using the name of the plugin will likely help us avoid collisions with other plugins.
|
// Using the name of the plugin will likely help us avoid collisions with other plugins.
|
||||||
|
@ -26,6 +26,7 @@ import (
|
|||||||
"k8s.io/kubernetes/pkg/scheduler/apis/config/validation"
|
"k8s.io/kubernetes/pkg/scheduler/apis/config/validation"
|
||||||
"k8s.io/kubernetes/pkg/scheduler/framework"
|
"k8s.io/kubernetes/pkg/scheduler/framework"
|
||||||
"k8s.io/kubernetes/pkg/scheduler/framework/plugins/feature"
|
"k8s.io/kubernetes/pkg/scheduler/framework/plugins/feature"
|
||||||
|
"k8s.io/kubernetes/pkg/scheduler/framework/plugins/names"
|
||||||
)
|
)
|
||||||
|
|
||||||
// LeastAllocated is a score plugin that favors nodes with fewer allocation requested resources based on requested resources.
|
// LeastAllocated is a score plugin that favors nodes with fewer allocation requested resources based on requested resources.
|
||||||
@ -37,7 +38,7 @@ type LeastAllocated struct {
|
|||||||
var _ = framework.ScorePlugin(&LeastAllocated{})
|
var _ = framework.ScorePlugin(&LeastAllocated{})
|
||||||
|
|
||||||
// LeastAllocatedName is the name of the plugin used in the plugin registry and configurations.
|
// LeastAllocatedName is the name of the plugin used in the plugin registry and configurations.
|
||||||
const LeastAllocatedName = "NodeResourcesLeastAllocated"
|
const LeastAllocatedName = names.NodeResourcesLeastAllocated
|
||||||
|
|
||||||
// Name returns name of the plugin. It is used in logs, etc.
|
// Name returns name of the plugin. It is used in logs, etc.
|
||||||
func (la *LeastAllocated) Name() string {
|
func (la *LeastAllocated) Name() string {
|
||||||
|
@ -26,6 +26,7 @@ import (
|
|||||||
"k8s.io/kubernetes/pkg/scheduler/apis/config/validation"
|
"k8s.io/kubernetes/pkg/scheduler/apis/config/validation"
|
||||||
"k8s.io/kubernetes/pkg/scheduler/framework"
|
"k8s.io/kubernetes/pkg/scheduler/framework"
|
||||||
"k8s.io/kubernetes/pkg/scheduler/framework/plugins/feature"
|
"k8s.io/kubernetes/pkg/scheduler/framework/plugins/feature"
|
||||||
|
"k8s.io/kubernetes/pkg/scheduler/framework/plugins/names"
|
||||||
)
|
)
|
||||||
|
|
||||||
// MostAllocated is a score plugin that favors nodes with high allocation based on requested resources.
|
// MostAllocated is a score plugin that favors nodes with high allocation based on requested resources.
|
||||||
@ -37,7 +38,7 @@ type MostAllocated struct {
|
|||||||
var _ = framework.ScorePlugin(&MostAllocated{})
|
var _ = framework.ScorePlugin(&MostAllocated{})
|
||||||
|
|
||||||
// MostAllocatedName is the name of the plugin used in the plugin registry and configurations.
|
// MostAllocatedName is the name of the plugin used in the plugin registry and configurations.
|
||||||
const MostAllocatedName = "NodeResourcesMostAllocated"
|
const MostAllocatedName = names.NodeResourcesMostAllocated
|
||||||
|
|
||||||
// Name returns name of the plugin. It is used in logs, etc.
|
// Name returns name of the plugin. It is used in logs, etc.
|
||||||
func (ma *MostAllocated) Name() string {
|
func (ma *MostAllocated) Name() string {
|
||||||
|
@ -28,11 +28,12 @@ import (
|
|||||||
"k8s.io/kubernetes/pkg/scheduler/framework"
|
"k8s.io/kubernetes/pkg/scheduler/framework"
|
||||||
"k8s.io/kubernetes/pkg/scheduler/framework/plugins/feature"
|
"k8s.io/kubernetes/pkg/scheduler/framework/plugins/feature"
|
||||||
"k8s.io/kubernetes/pkg/scheduler/framework/plugins/helper"
|
"k8s.io/kubernetes/pkg/scheduler/framework/plugins/helper"
|
||||||
|
"k8s.io/kubernetes/pkg/scheduler/framework/plugins/names"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
// RequestedToCapacityRatioName is the name of this plugin.
|
// RequestedToCapacityRatioName is the name of this plugin.
|
||||||
RequestedToCapacityRatioName = "RequestedToCapacityRatio"
|
RequestedToCapacityRatioName = names.RequestedToCapacityRatio
|
||||||
maxUtilization = 100
|
maxUtilization = 100
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -23,6 +23,7 @@ import (
|
|||||||
"k8s.io/apimachinery/pkg/runtime"
|
"k8s.io/apimachinery/pkg/runtime"
|
||||||
v1helper "k8s.io/component-helpers/scheduling/corev1"
|
v1helper "k8s.io/component-helpers/scheduling/corev1"
|
||||||
"k8s.io/kubernetes/pkg/scheduler/framework"
|
"k8s.io/kubernetes/pkg/scheduler/framework"
|
||||||
|
"k8s.io/kubernetes/pkg/scheduler/framework/plugins/names"
|
||||||
)
|
)
|
||||||
|
|
||||||
// NodeUnschedulable plugin filters nodes that set node.Spec.Unschedulable=true unless
|
// NodeUnschedulable plugin filters nodes that set node.Spec.Unschedulable=true unless
|
||||||
@ -34,7 +35,7 @@ var _ framework.FilterPlugin = &NodeUnschedulable{}
|
|||||||
var _ framework.EnqueueExtensions = &NodeUnschedulable{}
|
var _ framework.EnqueueExtensions = &NodeUnschedulable{}
|
||||||
|
|
||||||
// Name is the name of the plugin used in the plugin registry and configurations.
|
// Name is the name of the plugin used in the plugin registry and configurations.
|
||||||
const Name = "NodeUnschedulable"
|
const Name = names.NodeUnschedulable
|
||||||
|
|
||||||
const (
|
const (
|
||||||
// ErrReasonUnknownCondition is used for NodeUnknownCondition predicate error.
|
// ErrReasonUnknownCondition is used for NodeUnknownCondition predicate error.
|
||||||
|
@ -28,10 +28,10 @@ import (
|
|||||||
storagelisters "k8s.io/client-go/listers/storage/v1"
|
storagelisters "k8s.io/client-go/listers/storage/v1"
|
||||||
storagehelpers "k8s.io/component-helpers/storage/volume"
|
storagehelpers "k8s.io/component-helpers/storage/volume"
|
||||||
csitrans "k8s.io/csi-translation-lib"
|
csitrans "k8s.io/csi-translation-lib"
|
||||||
"k8s.io/kubernetes/pkg/scheduler/framework"
|
|
||||||
volumeutil "k8s.io/kubernetes/pkg/volume/util"
|
|
||||||
|
|
||||||
"k8s.io/klog/v2"
|
"k8s.io/klog/v2"
|
||||||
|
"k8s.io/kubernetes/pkg/scheduler/framework"
|
||||||
|
"k8s.io/kubernetes/pkg/scheduler/framework/plugins/names"
|
||||||
|
volumeutil "k8s.io/kubernetes/pkg/volume/util"
|
||||||
)
|
)
|
||||||
|
|
||||||
// InTreeToCSITranslator contains methods required to check migratable status
|
// InTreeToCSITranslator contains methods required to check migratable status
|
||||||
@ -60,7 +60,7 @@ var _ framework.FilterPlugin = &CSILimits{}
|
|||||||
var _ framework.EnqueueExtensions = &CSILimits{}
|
var _ framework.EnqueueExtensions = &CSILimits{}
|
||||||
|
|
||||||
// CSIName is the name of the plugin used in the plugin registry and configurations.
|
// CSIName is the name of the plugin used in the plugin registry and configurations.
|
||||||
const CSIName = "NodeVolumeLimits"
|
const CSIName = names.NodeVolumeLimits
|
||||||
|
|
||||||
// Name returns name of the plugin. It is used in logs, etc.
|
// Name returns name of the plugin. It is used in logs, etc.
|
||||||
func (pl *CSILimits) Name() string {
|
func (pl *CSILimits) Name() string {
|
||||||
|
@ -37,6 +37,7 @@ import (
|
|||||||
"k8s.io/klog/v2"
|
"k8s.io/klog/v2"
|
||||||
"k8s.io/kubernetes/pkg/features"
|
"k8s.io/kubernetes/pkg/features"
|
||||||
"k8s.io/kubernetes/pkg/scheduler/framework"
|
"k8s.io/kubernetes/pkg/scheduler/framework"
|
||||||
|
"k8s.io/kubernetes/pkg/scheduler/framework/plugins/names"
|
||||||
volumeutil "k8s.io/kubernetes/pkg/volume/util"
|
volumeutil "k8s.io/kubernetes/pkg/volume/util"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -66,7 +67,7 @@ const (
|
|||||||
)
|
)
|
||||||
|
|
||||||
// AzureDiskName is the name of the plugin used in the plugin registry and configurations.
|
// AzureDiskName is the name of the plugin used in the plugin registry and configurations.
|
||||||
const AzureDiskName = "AzureDiskLimits"
|
const AzureDiskName = names.AzureDiskLimits
|
||||||
|
|
||||||
// NewAzureDisk returns function that initializes a new plugin and returns it.
|
// NewAzureDisk returns function that initializes a new plugin and returns it.
|
||||||
func NewAzureDisk(_ runtime.Object, handle framework.Handle) (framework.Plugin, error) {
|
func NewAzureDisk(_ runtime.Object, handle framework.Handle) (framework.Plugin, error) {
|
||||||
@ -75,7 +76,7 @@ func NewAzureDisk(_ runtime.Object, handle framework.Handle) (framework.Plugin,
|
|||||||
}
|
}
|
||||||
|
|
||||||
// CinderName is the name of the plugin used in the plugin registry and configurations.
|
// CinderName is the name of the plugin used in the plugin registry and configurations.
|
||||||
const CinderName = "CinderLimits"
|
const CinderName = names.CinderLimits
|
||||||
|
|
||||||
// NewCinder returns function that initializes a new plugin and returns it.
|
// NewCinder returns function that initializes a new plugin and returns it.
|
||||||
func NewCinder(_ runtime.Object, handle framework.Handle) (framework.Plugin, error) {
|
func NewCinder(_ runtime.Object, handle framework.Handle) (framework.Plugin, error) {
|
||||||
@ -84,7 +85,7 @@ func NewCinder(_ runtime.Object, handle framework.Handle) (framework.Plugin, err
|
|||||||
}
|
}
|
||||||
|
|
||||||
// EBSName is the name of the plugin used in the plugin registry and configurations.
|
// EBSName is the name of the plugin used in the plugin registry and configurations.
|
||||||
const EBSName = "EBSLimits"
|
const EBSName = names.EBSLimits
|
||||||
|
|
||||||
// NewEBS returns function that initializes a new plugin and returns it.
|
// NewEBS returns function that initializes a new plugin and returns it.
|
||||||
func NewEBS(_ runtime.Object, handle framework.Handle) (framework.Plugin, error) {
|
func NewEBS(_ runtime.Object, handle framework.Handle) (framework.Plugin, error) {
|
||||||
@ -93,7 +94,7 @@ func NewEBS(_ runtime.Object, handle framework.Handle) (framework.Plugin, error)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// GCEPDName is the name of the plugin used in the plugin registry and configurations.
|
// GCEPDName is the name of the plugin used in the plugin registry and configurations.
|
||||||
const GCEPDName = "GCEPDLimits"
|
const GCEPDName = names.GCEPDLimits
|
||||||
|
|
||||||
// NewGCEPD returns function that initializes a new plugin and returns it.
|
// NewGCEPD returns function that initializes a new plugin and returns it.
|
||||||
func NewGCEPD(_ runtime.Object, handle framework.Handle) (framework.Plugin, error) {
|
func NewGCEPD(_ runtime.Object, handle framework.Handle) (framework.Plugin, error) {
|
||||||
|
@ -27,6 +27,7 @@ import (
|
|||||||
"k8s.io/kubernetes/pkg/scheduler/apis/config"
|
"k8s.io/kubernetes/pkg/scheduler/apis/config"
|
||||||
"k8s.io/kubernetes/pkg/scheduler/apis/config/validation"
|
"k8s.io/kubernetes/pkg/scheduler/apis/config/validation"
|
||||||
"k8s.io/kubernetes/pkg/scheduler/framework"
|
"k8s.io/kubernetes/pkg/scheduler/framework"
|
||||||
|
"k8s.io/kubernetes/pkg/scheduler/framework/plugins/names"
|
||||||
"k8s.io/kubernetes/pkg/scheduler/internal/parallelize"
|
"k8s.io/kubernetes/pkg/scheduler/internal/parallelize"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -69,7 +70,7 @@ var _ framework.EnqueueExtensions = &PodTopologySpread{}
|
|||||||
|
|
||||||
const (
|
const (
|
||||||
// Name is the name of the plugin used in the plugin registry and configurations.
|
// Name is the name of the plugin used in the plugin registry and configurations.
|
||||||
Name = "PodTopologySpread"
|
Name = names.PodTopologySpread
|
||||||
)
|
)
|
||||||
|
|
||||||
// Name returns name of the plugin. It is used in logs, etc.
|
// Name returns name of the plugin. It is used in logs, etc.
|
||||||
|
@ -20,10 +20,11 @@ import (
|
|||||||
"k8s.io/apimachinery/pkg/runtime"
|
"k8s.io/apimachinery/pkg/runtime"
|
||||||
corev1helpers "k8s.io/component-helpers/scheduling/corev1"
|
corev1helpers "k8s.io/component-helpers/scheduling/corev1"
|
||||||
"k8s.io/kubernetes/pkg/scheduler/framework"
|
"k8s.io/kubernetes/pkg/scheduler/framework"
|
||||||
|
"k8s.io/kubernetes/pkg/scheduler/framework/plugins/names"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Name is the name of the plugin used in the plugin registry and configurations.
|
// Name is the name of the plugin used in the plugin registry and configurations.
|
||||||
const Name = "PrioritySort"
|
const Name = names.PrioritySort
|
||||||
|
|
||||||
// PrioritySort is a plugin that implements Priority based sorting.
|
// PrioritySort is a plugin that implements Priority based sorting.
|
||||||
type PrioritySort struct{}
|
type PrioritySort struct{}
|
||||||
|
@ -28,6 +28,7 @@ import (
|
|||||||
utilnode "k8s.io/component-helpers/node/topology"
|
utilnode "k8s.io/component-helpers/node/topology"
|
||||||
"k8s.io/kubernetes/pkg/scheduler/framework"
|
"k8s.io/kubernetes/pkg/scheduler/framework"
|
||||||
"k8s.io/kubernetes/pkg/scheduler/framework/plugins/helper"
|
"k8s.io/kubernetes/pkg/scheduler/framework/plugins/helper"
|
||||||
|
"k8s.io/kubernetes/pkg/scheduler/framework/plugins/names"
|
||||||
)
|
)
|
||||||
|
|
||||||
// SelectorSpread is a plugin that calculates selector spread priority.
|
// SelectorSpread is a plugin that calculates selector spread priority.
|
||||||
@ -44,7 +45,7 @@ var _ framework.ScorePlugin = &SelectorSpread{}
|
|||||||
|
|
||||||
const (
|
const (
|
||||||
// Name is the name of the plugin used in the plugin registry and configurations.
|
// Name is the name of the plugin used in the plugin registry and configurations.
|
||||||
Name = "SelectorSpread"
|
Name = names.SelectorSpread
|
||||||
// preScoreStateKey is the key in CycleState to SelectorSpread pre-computed data for Scoring.
|
// preScoreStateKey is the key in CycleState to SelectorSpread pre-computed data for Scoring.
|
||||||
preScoreStateKey = "PreScore" + Name
|
preScoreStateKey = "PreScore" + Name
|
||||||
|
|
||||||
|
@ -31,11 +31,12 @@ import (
|
|||||||
"k8s.io/kubernetes/pkg/scheduler/apis/config"
|
"k8s.io/kubernetes/pkg/scheduler/apis/config"
|
||||||
"k8s.io/kubernetes/pkg/scheduler/framework"
|
"k8s.io/kubernetes/pkg/scheduler/framework"
|
||||||
"k8s.io/kubernetes/pkg/scheduler/framework/plugins/helper"
|
"k8s.io/kubernetes/pkg/scheduler/framework/plugins/helper"
|
||||||
|
"k8s.io/kubernetes/pkg/scheduler/framework/plugins/names"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
// Name is the name of the plugin used in the plugin registry and configurations.
|
// Name is the name of the plugin used in the plugin registry and configurations.
|
||||||
Name = "ServiceAffinity"
|
Name = names.ServiceAffinity
|
||||||
|
|
||||||
// preFilterStateKey is the key in CycleState to ServiceAffinity pre-computed data.
|
// preFilterStateKey is the key in CycleState to ServiceAffinity pre-computed data.
|
||||||
// Using the name of the plugin will likely help us avoid collisions with other plugins.
|
// Using the name of the plugin will likely help us avoid collisions with other plugins.
|
||||||
|
@ -24,7 +24,8 @@ import (
|
|||||||
"k8s.io/apimachinery/pkg/runtime"
|
"k8s.io/apimachinery/pkg/runtime"
|
||||||
v1helper "k8s.io/component-helpers/scheduling/corev1"
|
v1helper "k8s.io/component-helpers/scheduling/corev1"
|
||||||
"k8s.io/kubernetes/pkg/scheduler/framework"
|
"k8s.io/kubernetes/pkg/scheduler/framework"
|
||||||
pluginhelper "k8s.io/kubernetes/pkg/scheduler/framework/plugins/helper"
|
"k8s.io/kubernetes/pkg/scheduler/framework/plugins/helper"
|
||||||
|
"k8s.io/kubernetes/pkg/scheduler/framework/plugins/names"
|
||||||
)
|
)
|
||||||
|
|
||||||
// TaintToleration is a plugin that checks if a pod tolerates a node's taints.
|
// TaintToleration is a plugin that checks if a pod tolerates a node's taints.
|
||||||
@ -39,7 +40,7 @@ var _ framework.EnqueueExtensions = &TaintToleration{}
|
|||||||
|
|
||||||
const (
|
const (
|
||||||
// Name is the name of the plugin used in the plugin registry and configurations.
|
// Name is the name of the plugin used in the plugin registry and configurations.
|
||||||
Name = "TaintToleration"
|
Name = names.TaintToleration
|
||||||
// preScoreStateKey is the key in CycleState to TaintToleration pre-computed data for Scoring.
|
// preScoreStateKey is the key in CycleState to TaintToleration pre-computed data for Scoring.
|
||||||
preScoreStateKey = "PreScore" + Name
|
preScoreStateKey = "PreScore" + Name
|
||||||
// ErrReasonNotMatch is the Filter reason status when not matching.
|
// ErrReasonNotMatch is the Filter reason status when not matching.
|
||||||
@ -162,7 +163,7 @@ func (pl *TaintToleration) Score(ctx context.Context, state *framework.CycleStat
|
|||||||
|
|
||||||
// NormalizeScore invoked after scoring all nodes.
|
// NormalizeScore invoked after scoring all nodes.
|
||||||
func (pl *TaintToleration) NormalizeScore(ctx context.Context, _ *framework.CycleState, pod *v1.Pod, scores framework.NodeScoreList) *framework.Status {
|
func (pl *TaintToleration) NormalizeScore(ctx context.Context, _ *framework.CycleState, pod *v1.Pod, scores framework.NodeScoreList) *framework.Status {
|
||||||
return pluginhelper.DefaultNormalizeScore(framework.MaxNodeScore, true, scores)
|
return helper.DefaultNormalizeScore(framework.MaxNodeScore, true, scores)
|
||||||
}
|
}
|
||||||
|
|
||||||
// ScoreExtensions of the Score plugin.
|
// ScoreExtensions of the Score plugin.
|
||||||
|
@ -35,6 +35,7 @@ import (
|
|||||||
"k8s.io/kubernetes/pkg/scheduler/apis/config/validation"
|
"k8s.io/kubernetes/pkg/scheduler/apis/config/validation"
|
||||||
"k8s.io/kubernetes/pkg/scheduler/framework"
|
"k8s.io/kubernetes/pkg/scheduler/framework"
|
||||||
"k8s.io/kubernetes/pkg/scheduler/framework/plugins/helper"
|
"k8s.io/kubernetes/pkg/scheduler/framework/plugins/helper"
|
||||||
|
"k8s.io/kubernetes/pkg/scheduler/framework/plugins/names"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
@ -82,7 +83,7 @@ var _ framework.PreBindPlugin = &VolumeBinding{}
|
|||||||
var _ framework.ScorePlugin = &VolumeBinding{}
|
var _ framework.ScorePlugin = &VolumeBinding{}
|
||||||
|
|
||||||
// Name is the name of the plugin used in Registry and configurations.
|
// Name is the name of the plugin used in Registry and configurations.
|
||||||
const Name = "VolumeBinding"
|
const Name = names.VolumeBinding
|
||||||
|
|
||||||
// Name returns name of the plugin. It is used in logs, etc.
|
// Name returns name of the plugin. It is used in logs, etc.
|
||||||
func (pl *VolumeBinding) Name() string {
|
func (pl *VolumeBinding) Name() string {
|
||||||
|
@ -23,6 +23,7 @@ import (
|
|||||||
"k8s.io/apimachinery/pkg/runtime"
|
"k8s.io/apimachinery/pkg/runtime"
|
||||||
"k8s.io/apimachinery/pkg/util/sets"
|
"k8s.io/apimachinery/pkg/util/sets"
|
||||||
"k8s.io/kubernetes/pkg/scheduler/framework"
|
"k8s.io/kubernetes/pkg/scheduler/framework"
|
||||||
|
"k8s.io/kubernetes/pkg/scheduler/framework/plugins/names"
|
||||||
)
|
)
|
||||||
|
|
||||||
// VolumeRestrictions is a plugin that checks volume restrictions.
|
// VolumeRestrictions is a plugin that checks volume restrictions.
|
||||||
@ -32,7 +33,7 @@ var _ framework.FilterPlugin = &VolumeRestrictions{}
|
|||||||
var _ framework.EnqueueExtensions = &VolumeRestrictions{}
|
var _ framework.EnqueueExtensions = &VolumeRestrictions{}
|
||||||
|
|
||||||
// Name is the name of the plugin used in the plugin registry and configurations.
|
// Name is the name of the plugin used in the plugin registry and configurations.
|
||||||
const Name = "VolumeRestrictions"
|
const Name = names.VolumeRestrictions
|
||||||
|
|
||||||
const (
|
const (
|
||||||
// ErrReasonDiskConflict is used for NoDiskConflict predicate error.
|
// ErrReasonDiskConflict is used for NoDiskConflict predicate error.
|
||||||
|
@ -31,6 +31,7 @@ import (
|
|||||||
storagehelpers "k8s.io/component-helpers/storage/volume"
|
storagehelpers "k8s.io/component-helpers/storage/volume"
|
||||||
"k8s.io/klog/v2"
|
"k8s.io/klog/v2"
|
||||||
"k8s.io/kubernetes/pkg/scheduler/framework"
|
"k8s.io/kubernetes/pkg/scheduler/framework"
|
||||||
|
"k8s.io/kubernetes/pkg/scheduler/framework/plugins/names"
|
||||||
)
|
)
|
||||||
|
|
||||||
// VolumeZone is a plugin that checks volume zone.
|
// VolumeZone is a plugin that checks volume zone.
|
||||||
@ -45,7 +46,7 @@ var _ framework.EnqueueExtensions = &VolumeZone{}
|
|||||||
|
|
||||||
const (
|
const (
|
||||||
// Name is the name of the plugin used in the plugin registry and configurations.
|
// Name is the name of the plugin used in the plugin registry and configurations.
|
||||||
Name = "VolumeZone"
|
Name = names.VolumeZone
|
||||||
|
|
||||||
// ErrReasonConflict is used for NoVolumeZoneConflict predicate error.
|
// ErrReasonConflict is used for NoVolumeZoneConflict predicate error.
|
||||||
ErrReasonConflict = "node(s) had no available volume zone"
|
ErrReasonConflict = "node(s) had no available volume zone"
|
||||||
|
Loading…
Reference in New Issue
Block a user