mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-12-15 23:53:09 +00:00
remove scheduler component config v1beta1
Signed-off-by: kerthcet <kerthcet@gmail.com>
This commit is contained in:
@@ -33,7 +33,6 @@ import (
|
||||
componentbasevalidation "k8s.io/component-base/config/validation"
|
||||
v1helper "k8s.io/kubernetes/pkg/apis/core/v1/helper"
|
||||
"k8s.io/kubernetes/pkg/scheduler/apis/config"
|
||||
"k8s.io/kubernetes/pkg/scheduler/apis/config/v1beta1"
|
||||
"k8s.io/kubernetes/pkg/scheduler/apis/config/v1beta2"
|
||||
)
|
||||
|
||||
@@ -126,10 +125,6 @@ type removedPlugins struct {
|
||||
// Remember to add an entry to that list when creating a new component config
|
||||
// version (even if the list of removed plugins is empty).
|
||||
var removedPluginsByVersion = []removedPlugins{
|
||||
{
|
||||
schemeGroupVersion: v1beta1.SchemeGroupVersion.String(),
|
||||
plugins: []string{},
|
||||
},
|
||||
{
|
||||
schemeGroupVersion: v1beta2.SchemeGroupVersion.String(),
|
||||
plugins: []string{
|
||||
@@ -143,39 +138,6 @@ var removedPluginsByVersion = []removedPlugins{
|
||||
},
|
||||
}
|
||||
|
||||
// conflictScorePluginsByVersion maintains a map of conflict plugins in each version.
|
||||
// Remember to add an entry to that list when creating a new component config
|
||||
// version (even if the list of conflict plugins is empty).
|
||||
var conflictScorePluginsByVersion = map[string]map[string]sets.String{
|
||||
v1beta1.SchemeGroupVersion.String(): {
|
||||
"NodeResourcesFit": sets.NewString(
|
||||
"NodeResourcesLeastAllocated",
|
||||
"NodeResourcesMostAllocated",
|
||||
"RequestedToCapacityRatio"),
|
||||
},
|
||||
v1beta2.SchemeGroupVersion.String(): nil,
|
||||
}
|
||||
|
||||
// isScorePluginConflict checks if a given plugin was conflict with other plugin in the given component
|
||||
// config version or earlier.
|
||||
func isScorePluginConflict(apiVersion string, name string, profile *config.KubeSchedulerProfile) []string {
|
||||
var conflictPlugins []string
|
||||
cp, ok := conflictScorePluginsByVersion[apiVersion]
|
||||
if !ok {
|
||||
return nil
|
||||
}
|
||||
plugin, ok := cp[name]
|
||||
if !ok {
|
||||
return nil
|
||||
}
|
||||
for _, p := range profile.Plugins.Score.Enabled {
|
||||
if plugin.Has(p.Name) {
|
||||
conflictPlugins = append(conflictPlugins, p.Name)
|
||||
}
|
||||
}
|
||||
return conflictPlugins
|
||||
}
|
||||
|
||||
// isPluginRemoved checks if a given plugin was removed in the given component
|
||||
// config version or earlier.
|
||||
func isPluginRemoved(apiVersion string, name string) (bool, string) {
|
||||
@@ -202,16 +164,6 @@ func validatePluginSetForRemovedPlugins(path *field.Path, apiVersion string, ps
|
||||
return errs
|
||||
}
|
||||
|
||||
func validateScorePluginSetForConflictPlugins(path *field.Path, apiVersion string, profile *config.KubeSchedulerProfile) []error {
|
||||
var errs []error
|
||||
for i, plugin := range profile.Plugins.Score.Enabled {
|
||||
if cp := isScorePluginConflict(apiVersion, plugin.Name, profile); len(cp) > 0 {
|
||||
errs = append(errs, field.Invalid(path.Child("enabled").Index(i), plugin.Name, fmt.Sprintf("was conflict with %q in version %q (KubeSchedulerConfiguration is version %q)", cp, apiVersion, apiVersion)))
|
||||
}
|
||||
}
|
||||
return errs
|
||||
}
|
||||
|
||||
func validateKubeSchedulerProfile(path *field.Path, apiVersion string, profile *config.KubeSchedulerProfile) []error {
|
||||
var errs []error
|
||||
if len(profile.SchedulerName) == 0 {
|
||||
@@ -257,8 +209,6 @@ func validatePluginConfig(path *field.Path, apiVersion string, profile *config.K
|
||||
errs = append(errs, validatePluginSetForRemovedPlugins(
|
||||
pluginsPath.Child(s), apiVersion, p)...)
|
||||
}
|
||||
errs = append(errs, validateScorePluginSetForConflictPlugins(
|
||||
pluginsPath.Child("score"), apiVersion, profile)...)
|
||||
}
|
||||
|
||||
seenPluginConfig := make(sets.String)
|
||||
|
||||
Reference in New Issue
Block a user