mirror of
https://github.com/ceph/ceph-csi.git
synced 2025-06-14 02:43:36 +00:00
Fresh dep ensure
This commit is contained in:
9
vendor/k8s.io/kubernetes/pkg/scheduler/algorithmprovider/BUILD
generated
vendored
9
vendor/k8s.io/kubernetes/pkg/scheduler/algorithmprovider/BUILD
generated
vendored
@ -15,11 +15,16 @@ go_library(
|
||||
|
||||
go_test(
|
||||
name = "go_default_test",
|
||||
srcs = ["plugins_test.go"],
|
||||
srcs = [
|
||||
"main_test.go",
|
||||
"plugins_test.go",
|
||||
],
|
||||
embed = [":go_default_library"],
|
||||
deps = [
|
||||
"//pkg/features:go_default_library",
|
||||
"//pkg/scheduler/factory:go_default_library",
|
||||
"//vendor/k8s.io/apiserver/pkg/util/feature:go_default_library",
|
||||
"//staging/src/k8s.io/apiserver/pkg/util/feature:go_default_library",
|
||||
"//staging/src/k8s.io/apiserver/pkg/util/feature/testing:go_default_library",
|
||||
],
|
||||
)
|
||||
|
||||
|
22
vendor/k8s.io/kubernetes/pkg/scheduler/algorithmprovider/defaults/BUILD
generated
vendored
22
vendor/k8s.io/kubernetes/pkg/scheduler/algorithmprovider/defaults/BUILD
generated
vendored
@ -17,9 +17,9 @@ go_library(
|
||||
"//pkg/scheduler/algorithm/priorities:go_default_library",
|
||||
"//pkg/scheduler/core:go_default_library",
|
||||
"//pkg/scheduler/factory:go_default_library",
|
||||
"//vendor/github.com/golang/glog:go_default_library",
|
||||
"//vendor/k8s.io/apimachinery/pkg/util/sets:go_default_library",
|
||||
"//vendor/k8s.io/apiserver/pkg/util/feature:go_default_library",
|
||||
"//staging/src/k8s.io/apimachinery/pkg/util/sets:go_default_library",
|
||||
"//staging/src/k8s.io/apiserver/pkg/util/feature:go_default_library",
|
||||
"//vendor/k8s.io/klog:go_default_library",
|
||||
],
|
||||
)
|
||||
|
||||
@ -36,14 +36,14 @@ go_test(
|
||||
"//pkg/scheduler/api:go_default_library",
|
||||
"//pkg/scheduler/api/latest:go_default_library",
|
||||
"//pkg/scheduler/factory:go_default_library",
|
||||
"//vendor/k8s.io/api/core/v1:go_default_library",
|
||||
"//vendor/k8s.io/apimachinery/pkg/runtime:go_default_library",
|
||||
"//vendor/k8s.io/apimachinery/pkg/runtime/schema:go_default_library",
|
||||
"//vendor/k8s.io/apimachinery/pkg/util/sets:go_default_library",
|
||||
"//vendor/k8s.io/client-go/informers:go_default_library",
|
||||
"//vendor/k8s.io/client-go/kubernetes:go_default_library",
|
||||
"//vendor/k8s.io/client-go/rest:go_default_library",
|
||||
"//vendor/k8s.io/client-go/util/testing:go_default_library",
|
||||
"//staging/src/k8s.io/api/core/v1:go_default_library",
|
||||
"//staging/src/k8s.io/apimachinery/pkg/runtime:go_default_library",
|
||||
"//staging/src/k8s.io/apimachinery/pkg/runtime/schema:go_default_library",
|
||||
"//staging/src/k8s.io/apimachinery/pkg/util/sets:go_default_library",
|
||||
"//staging/src/k8s.io/client-go/informers:go_default_library",
|
||||
"//staging/src/k8s.io/client-go/kubernetes:go_default_library",
|
||||
"//staging/src/k8s.io/client-go/rest:go_default_library",
|
||||
"//staging/src/k8s.io/client-go/util/testing:go_default_library",
|
||||
],
|
||||
)
|
||||
|
||||
|
159
vendor/k8s.io/kubernetes/pkg/scheduler/algorithmprovider/defaults/compatibility_test.go
generated
vendored
159
vendor/k8s.io/kubernetes/pkg/scheduler/algorithmprovider/defaults/compatibility_test.go
generated
vendored
@ -814,6 +814,130 @@ func TestCompatibility_v1_Scheduler(t *testing.T) {
|
||||
}},
|
||||
},
|
||||
},
|
||||
// Do not change this JSON after the corresponding release has been tagged.
|
||||
// A failure indicates backwards compatibility with the specified release was broken.
|
||||
"1.12": {
|
||||
JSON: `{
|
||||
"kind": "Policy",
|
||||
"apiVersion": "v1",
|
||||
"predicates": [
|
||||
{"name": "MatchNodeSelector"},
|
||||
{"name": "PodFitsResources"},
|
||||
{"name": "PodFitsHostPorts"},
|
||||
{"name": "HostName"},
|
||||
{"name": "NoDiskConflict"},
|
||||
{"name": "NoVolumeZoneConflict"},
|
||||
{"name": "PodToleratesNodeTaints"},
|
||||
{"name": "CheckNodeMemoryPressure"},
|
||||
{"name": "CheckNodeDiskPressure"},
|
||||
{"name": "CheckNodePIDPressure"},
|
||||
{"name": "CheckNodeCondition"},
|
||||
{"name": "MaxEBSVolumeCount"},
|
||||
{"name": "MaxGCEPDVolumeCount"},
|
||||
{"name": "MaxAzureDiskVolumeCount"},
|
||||
{"name": "MaxCSIVolumeCountPred"},
|
||||
{"name": "MatchInterPodAffinity"},
|
||||
{"name": "GeneralPredicates"},
|
||||
{"name": "CheckVolumeBinding"},
|
||||
{"name": "TestServiceAffinity", "argument": {"serviceAffinity" : {"labels" : ["region"]}}},
|
||||
{"name": "TestLabelsPresence", "argument": {"labelsPresence" : {"labels" : ["foo"], "presence":true}}}
|
||||
],"priorities": [
|
||||
{"name": "EqualPriority", "weight": 2},
|
||||
{"name": "ImageLocalityPriority", "weight": 2},
|
||||
{"name": "LeastRequestedPriority", "weight": 2},
|
||||
{"name": "BalancedResourceAllocation", "weight": 2},
|
||||
{"name": "SelectorSpreadPriority", "weight": 2},
|
||||
{"name": "NodePreferAvoidPodsPriority", "weight": 2},
|
||||
{"name": "NodeAffinityPriority", "weight": 2},
|
||||
{"name": "TaintTolerationPriority", "weight": 2},
|
||||
{"name": "InterPodAffinityPriority", "weight": 2},
|
||||
{"name": "MostRequestedPriority", "weight": 2},
|
||||
{
|
||||
"name": "RequestedToCapacityRatioPriority",
|
||||
"weight": 2,
|
||||
"argument": {
|
||||
"requestedToCapacityRatioArguments": {
|
||||
"shape": [
|
||||
{"utilization": 0, "score": 0},
|
||||
{"utilization": 50, "score": 7}
|
||||
]
|
||||
}
|
||||
}}
|
||||
],"extenders": [{
|
||||
"urlPrefix": "/prefix",
|
||||
"filterVerb": "filter",
|
||||
"prioritizeVerb": "prioritize",
|
||||
"weight": 1,
|
||||
"bindVerb": "bind",
|
||||
"enableHttps": true,
|
||||
"tlsConfig": {"Insecure":true},
|
||||
"httpTimeout": 1,
|
||||
"nodeCacheCapable": true,
|
||||
"managedResources": [{"name":"example.com/foo","ignoredByScheduler":true}],
|
||||
"ignorable":true
|
||||
}]
|
||||
}`,
|
||||
ExpectedPolicy: schedulerapi.Policy{
|
||||
Predicates: []schedulerapi.PredicatePolicy{
|
||||
{Name: "MatchNodeSelector"},
|
||||
{Name: "PodFitsResources"},
|
||||
{Name: "PodFitsHostPorts"},
|
||||
{Name: "HostName"},
|
||||
{Name: "NoDiskConflict"},
|
||||
{Name: "NoVolumeZoneConflict"},
|
||||
{Name: "PodToleratesNodeTaints"},
|
||||
{Name: "CheckNodeMemoryPressure"},
|
||||
{Name: "CheckNodeDiskPressure"},
|
||||
{Name: "CheckNodePIDPressure"},
|
||||
{Name: "CheckNodeCondition"},
|
||||
{Name: "MaxEBSVolumeCount"},
|
||||
{Name: "MaxGCEPDVolumeCount"},
|
||||
{Name: "MaxAzureDiskVolumeCount"},
|
||||
{Name: "MaxCSIVolumeCountPred"},
|
||||
{Name: "MatchInterPodAffinity"},
|
||||
{Name: "GeneralPredicates"},
|
||||
{Name: "CheckVolumeBinding"},
|
||||
{Name: "TestServiceAffinity", Argument: &schedulerapi.PredicateArgument{ServiceAffinity: &schedulerapi.ServiceAffinity{Labels: []string{"region"}}}},
|
||||
{Name: "TestLabelsPresence", Argument: &schedulerapi.PredicateArgument{LabelsPresence: &schedulerapi.LabelsPresence{Labels: []string{"foo"}, Presence: true}}},
|
||||
},
|
||||
Priorities: []schedulerapi.PriorityPolicy{
|
||||
{Name: "EqualPriority", Weight: 2},
|
||||
{Name: "ImageLocalityPriority", Weight: 2},
|
||||
{Name: "LeastRequestedPriority", Weight: 2},
|
||||
{Name: "BalancedResourceAllocation", Weight: 2},
|
||||
{Name: "SelectorSpreadPriority", Weight: 2},
|
||||
{Name: "NodePreferAvoidPodsPriority", Weight: 2},
|
||||
{Name: "NodeAffinityPriority", Weight: 2},
|
||||
{Name: "TaintTolerationPriority", Weight: 2},
|
||||
{Name: "InterPodAffinityPriority", Weight: 2},
|
||||
{Name: "MostRequestedPriority", Weight: 2},
|
||||
{
|
||||
Name: "RequestedToCapacityRatioPriority",
|
||||
Weight: 2,
|
||||
Argument: &schedulerapi.PriorityArgument{
|
||||
RequestedToCapacityRatioArguments: &schedulerapi.RequestedToCapacityRatioArguments{
|
||||
UtilizationShape: []schedulerapi.UtilizationShapePoint{
|
||||
{Utilization: 0, Score: 0},
|
||||
{Utilization: 50, Score: 7},
|
||||
}},
|
||||
},
|
||||
},
|
||||
},
|
||||
ExtenderConfigs: []schedulerapi.ExtenderConfig{{
|
||||
URLPrefix: "/prefix",
|
||||
FilterVerb: "filter",
|
||||
PrioritizeVerb: "prioritize",
|
||||
Weight: 1,
|
||||
BindVerb: "bind", // 1.11 restored case-sensitivity, but allowed either "BindVerb" or "bindVerb"
|
||||
EnableHTTPS: true,
|
||||
TLSConfig: &restclient.TLSClientConfig{Insecure: true},
|
||||
HTTPTimeout: 1,
|
||||
NodeCacheCapable: true,
|
||||
ManagedResources: []schedulerapi.ExtenderManagedResource{{Name: v1.ResourceName("example.com/foo"), IgnoredByScheduler: true}},
|
||||
Ignorable: true,
|
||||
}},
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
registeredPredicates := sets.NewString(factory.ListRegisteredFitPredicates()...)
|
||||
@ -849,23 +973,24 @@ func TestCompatibility_v1_Scheduler(t *testing.T) {
|
||||
client := clientset.NewForConfigOrDie(&restclient.Config{Host: server.URL, ContentConfig: restclient.ContentConfig{GroupVersion: &schema.GroupVersion{Group: "", Version: "v1"}}})
|
||||
informerFactory := informers.NewSharedInformerFactory(client, 0)
|
||||
|
||||
if _, err := factory.NewConfigFactory(
|
||||
"some-scheduler-name",
|
||||
client,
|
||||
informerFactory.Core().V1().Nodes(),
|
||||
informerFactory.Core().V1().Pods(),
|
||||
informerFactory.Core().V1().PersistentVolumes(),
|
||||
informerFactory.Core().V1().PersistentVolumeClaims(),
|
||||
informerFactory.Core().V1().ReplicationControllers(),
|
||||
informerFactory.Extensions().V1beta1().ReplicaSets(),
|
||||
informerFactory.Apps().V1beta1().StatefulSets(),
|
||||
informerFactory.Core().V1().Services(),
|
||||
informerFactory.Policy().V1beta1().PodDisruptionBudgets(),
|
||||
informerFactory.Storage().V1().StorageClasses(),
|
||||
v1.DefaultHardPodAffinitySymmetricWeight,
|
||||
enableEquivalenceCache,
|
||||
false,
|
||||
).CreateFromConfig(policy); err != nil {
|
||||
if _, err := factory.NewConfigFactory(&factory.ConfigFactoryArgs{
|
||||
SchedulerName: "some-scheduler-name",
|
||||
Client: client,
|
||||
NodeInformer: informerFactory.Core().V1().Nodes(),
|
||||
PodInformer: informerFactory.Core().V1().Pods(),
|
||||
PvInformer: informerFactory.Core().V1().PersistentVolumes(),
|
||||
PvcInformer: informerFactory.Core().V1().PersistentVolumeClaims(),
|
||||
ReplicationControllerInformer: informerFactory.Core().V1().ReplicationControllers(),
|
||||
ReplicaSetInformer: informerFactory.Apps().V1().ReplicaSets(),
|
||||
StatefulSetInformer: informerFactory.Apps().V1().StatefulSets(),
|
||||
ServiceInformer: informerFactory.Core().V1().Services(),
|
||||
PdbInformer: informerFactory.Policy().V1beta1().PodDisruptionBudgets(),
|
||||
StorageClassInformer: informerFactory.Storage().V1().StorageClasses(),
|
||||
HardPodAffinitySymmetricWeight: v1.DefaultHardPodAffinitySymmetricWeight,
|
||||
EnableEquivalenceClassCache: enableEquivalenceCache,
|
||||
DisablePreemption: false,
|
||||
PercentageOfNodesToScore: schedulerapi.DefaultPercentageOfNodesToScore,
|
||||
}).CreateFromConfig(policy); err != nil {
|
||||
t.Errorf("%s: Error constructing: %v", v, err)
|
||||
continue
|
||||
}
|
||||
|
24
vendor/k8s.io/kubernetes/pkg/scheduler/algorithmprovider/defaults/defaults.go
generated
vendored
24
vendor/k8s.io/kubernetes/pkg/scheduler/algorithmprovider/defaults/defaults.go
generated
vendored
@ -17,7 +17,7 @@ limitations under the License.
|
||||
package defaults
|
||||
|
||||
import (
|
||||
"github.com/golang/glog"
|
||||
"k8s.io/klog"
|
||||
|
||||
"k8s.io/apimachinery/pkg/util/sets"
|
||||
utilfeature "k8s.io/apiserver/pkg/util/feature"
|
||||
@ -94,10 +94,6 @@ func init() {
|
||||
// Register the priority function so that its available
|
||||
// but do not include it as part of the default priorities
|
||||
factory.RegisterPriorityFunction2("EqualPriority", core.EqualPriorityMap, nil, 1)
|
||||
// ImageLocalityPriority prioritizes nodes based on locality of images requested by a pod. Nodes with larger size
|
||||
// of already-installed packages required by the pod will be preferred over nodes with no already-installed
|
||||
// packages required by the pod or a small total size of already-installed packages required by the pod.
|
||||
factory.RegisterPriorityFunction2("ImageLocalityPriority", priorities.ImageLocalityPriorityMap, nil, 1)
|
||||
// Optional, cluster-autoscaler friendly priority function - give used nodes higher priority.
|
||||
factory.RegisterPriorityFunction2("MostRequestedPriority", priorities.MostRequestedPriorityMap, nil, 1)
|
||||
factory.RegisterPriorityFunction2(
|
||||
@ -137,6 +133,12 @@ func defaultPredicates() sets.String {
|
||||
return predicates.NewMaxPDVolumeCountPredicate(predicates.AzureDiskVolumeFilterType, args.PVInfo, args.PVCInfo)
|
||||
},
|
||||
),
|
||||
factory.RegisterFitPredicateFactory(
|
||||
predicates.MaxCSIVolumeCountPred,
|
||||
func(args factory.PluginFactoryArgs) algorithm.FitPredicate {
|
||||
return predicates.NewCSIMaxVolumeLimitPredicate(args.PVInfo, args.PVCInfo)
|
||||
},
|
||||
),
|
||||
// Fit is determined by inter-pod affinity.
|
||||
factory.RegisterFitPredicateFactory(
|
||||
predicates.MatchInterPodAffinityPred,
|
||||
@ -197,19 +199,24 @@ func ApplyFeatureGates() {
|
||||
|
||||
// Fit is determined based on whether a pod can tolerate all of the node's taints
|
||||
factory.RegisterMandatoryFitPredicate(predicates.PodToleratesNodeTaintsPred, predicates.PodToleratesNodeTaints)
|
||||
// Fit is determined based on whether a pod can tolerate unschedulable of node
|
||||
factory.RegisterMandatoryFitPredicate(predicates.CheckNodeUnschedulablePred, predicates.CheckNodeUnschedulablePredicate)
|
||||
// Insert Key "PodToleratesNodeTaints" and "CheckNodeUnschedulable" To All Algorithm Provider
|
||||
// The key will insert to all providers which in algorithmProviderMap[]
|
||||
// if you just want insert to specific provider, call func InsertPredicateKeyToAlgoProvider()
|
||||
factory.InsertPredicateKeyToAlgorithmProviderMap(predicates.PodToleratesNodeTaintsPred)
|
||||
factory.InsertPredicateKeyToAlgorithmProviderMap(predicates.CheckNodeUnschedulablePred)
|
||||
|
||||
glog.Warningf("TaintNodesByCondition is enabled, PodToleratesNodeTaints predicate is mandatory")
|
||||
klog.Infof("TaintNodesByCondition is enabled, PodToleratesNodeTaints predicate is mandatory")
|
||||
}
|
||||
|
||||
// Prioritizes nodes that satisfy pod's resource limits
|
||||
if utilfeature.DefaultFeatureGate.Enabled(features.ResourceLimitsPriorityFunction) {
|
||||
klog.Infof("Registering resourcelimits priority function")
|
||||
factory.RegisterPriorityFunction2("ResourceLimitsPriority", priorities.ResourceLimitsPriorityMap, nil, 1)
|
||||
// Register the priority function to specific provider too.
|
||||
factory.InsertPriorityKeyToAlgorithmProviderMap(factory.RegisterPriorityFunction2("ResourceLimitsPriority", priorities.ResourceLimitsPriorityMap, nil, 1))
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
func registerAlgorithmProvider(predSet, priSet sets.String) {
|
||||
@ -260,6 +267,9 @@ func defaultPriorities() sets.String {
|
||||
|
||||
// Prioritizes nodes that marked with taint which pod can tolerate.
|
||||
factory.RegisterPriorityFunction2("TaintTolerationPriority", priorities.ComputeTaintTolerationPriorityMap, priorities.ComputeTaintTolerationPriorityReduce, 1),
|
||||
|
||||
// ImageLocalityPriority prioritizes nodes that have images requested by the pod present.
|
||||
factory.RegisterPriorityFunction2("ImageLocalityPriority", priorities.ImageLocalityPriorityMap, nil, 1),
|
||||
)
|
||||
}
|
||||
|
||||
|
28
vendor/k8s.io/kubernetes/pkg/scheduler/algorithmprovider/defaults/defaults_test.go
generated
vendored
28
vendor/k8s.io/kubernetes/pkg/scheduler/algorithmprovider/defaults/defaults_test.go
generated
vendored
@ -59,7 +59,8 @@ func TestDefaultPriorities(t *testing.T) {
|
||||
"BalancedResourceAllocation",
|
||||
"NodePreferAvoidPodsPriority",
|
||||
"NodeAffinityPriority",
|
||||
"TaintTolerationPriority")
|
||||
"TaintTolerationPriority",
|
||||
"ImageLocalityPriority")
|
||||
if expected := defaultPriorities(); !result.Equal(expected) {
|
||||
t.Errorf("expected %v got %v", expected, result)
|
||||
}
|
||||
@ -67,18 +68,19 @@ func TestDefaultPriorities(t *testing.T) {
|
||||
|
||||
func TestDefaultPredicates(t *testing.T) {
|
||||
result := sets.NewString(
|
||||
"NoVolumeZoneConflict",
|
||||
"MaxEBSVolumeCount",
|
||||
"MaxGCEPDVolumeCount",
|
||||
"MaxAzureDiskVolumeCount",
|
||||
"MatchInterPodAffinity",
|
||||
"NoDiskConflict",
|
||||
"GeneralPredicates",
|
||||
"CheckNodeMemoryPressure",
|
||||
"CheckNodeDiskPressure",
|
||||
"CheckNodePIDPressure",
|
||||
"CheckNodeCondition",
|
||||
"PodToleratesNodeTaints",
|
||||
predicates.NoVolumeZoneConflictPred,
|
||||
predicates.MaxEBSVolumeCountPred,
|
||||
predicates.MaxGCEPDVolumeCountPred,
|
||||
predicates.MaxAzureDiskVolumeCountPred,
|
||||
predicates.MaxCSIVolumeCountPred,
|
||||
predicates.MatchInterPodAffinityPred,
|
||||
predicates.NoDiskConflictPred,
|
||||
predicates.GeneralPred,
|
||||
predicates.CheckNodeMemoryPressurePred,
|
||||
predicates.CheckNodeDiskPressurePred,
|
||||
predicates.CheckNodePIDPressurePred,
|
||||
predicates.CheckNodeConditionPred,
|
||||
predicates.PodToleratesNodeTaintsPred,
|
||||
predicates.CheckVolumeBindingPred,
|
||||
)
|
||||
|
||||
|
29
vendor/k8s.io/kubernetes/pkg/scheduler/algorithmprovider/main_test.go
generated
vendored
Normal file
29
vendor/k8s.io/kubernetes/pkg/scheduler/algorithmprovider/main_test.go
generated
vendored
Normal file
@ -0,0 +1,29 @@
|
||||
/*
|
||||
Copyright 2018 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 algorithmprovider
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
utilfeature "k8s.io/apiserver/pkg/util/feature"
|
||||
utilfeaturetesting "k8s.io/apiserver/pkg/util/feature/testing"
|
||||
_ "k8s.io/kubernetes/pkg/features"
|
||||
)
|
||||
|
||||
func TestMain(m *testing.M) {
|
||||
utilfeaturetesting.VerifyFeatureGatesUnchanged(utilfeature.DefaultFeatureGate, m.Run)
|
||||
}
|
92
vendor/k8s.io/kubernetes/pkg/scheduler/algorithmprovider/plugins_test.go
generated
vendored
92
vendor/k8s.io/kubernetes/pkg/scheduler/algorithmprovider/plugins_test.go
generated
vendored
@ -17,9 +17,12 @@ limitations under the License.
|
||||
package algorithmprovider
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"testing"
|
||||
|
||||
utilfeature "k8s.io/apiserver/pkg/util/feature"
|
||||
utilfeaturetesting "k8s.io/apiserver/pkg/util/feature/testing"
|
||||
"k8s.io/kubernetes/pkg/features"
|
||||
"k8s.io/kubernetes/pkg/scheduler/factory"
|
||||
)
|
||||
|
||||
@ -44,66 +47,69 @@ func TestDefaultConfigExists(t *testing.T) {
|
||||
|
||||
func TestAlgorithmProviders(t *testing.T) {
|
||||
for _, pn := range algorithmProviderNames {
|
||||
p, err := factory.GetAlgorithmProvider(pn)
|
||||
if err != nil {
|
||||
t.Errorf("error retrieving '%s' provider: %v", pn, err)
|
||||
break
|
||||
}
|
||||
if len(p.PriorityFunctionKeys) == 0 {
|
||||
t.Errorf("%s algorithm provider shouldn't have 0 priority functions", pn)
|
||||
}
|
||||
for _, pf := range p.PriorityFunctionKeys.List() {
|
||||
if !factory.IsPriorityFunctionRegistered(pf) {
|
||||
t.Errorf("priority function %s is not registered but is used in the %s algorithm provider", pf, pn)
|
||||
t.Run(pn, func(t *testing.T) {
|
||||
p, err := factory.GetAlgorithmProvider(pn)
|
||||
if err != nil {
|
||||
t.Fatalf("error retrieving provider: %v", err)
|
||||
}
|
||||
}
|
||||
for _, fp := range p.FitPredicateKeys.List() {
|
||||
if !factory.IsFitPredicateRegistered(fp) {
|
||||
t.Errorf("fit predicate %s is not registered but is used in the %s algorithm provider", fp, pn)
|
||||
if len(p.PriorityFunctionKeys) == 0 {
|
||||
t.Errorf("algorithm provider shouldn't have 0 priority functions")
|
||||
}
|
||||
}
|
||||
for _, pf := range p.PriorityFunctionKeys.List() {
|
||||
t.Run(fmt.Sprintf("priorityfunction/%s", pf), func(t *testing.T) {
|
||||
if !factory.IsPriorityFunctionRegistered(pf) {
|
||||
t.Errorf("priority function is not registered but is used in the algorithm provider")
|
||||
}
|
||||
})
|
||||
}
|
||||
for _, fp := range p.FitPredicateKeys.List() {
|
||||
t.Run(fmt.Sprintf("fitpredicate/%s", fp), func(t *testing.T) {
|
||||
if !factory.IsFitPredicateRegistered(fp) {
|
||||
t.Errorf("fit predicate is not registered but is used in the algorithm provider")
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
func TestApplyFeatureGates(t *testing.T) {
|
||||
for _, pn := range algorithmProviderNames {
|
||||
p, err := factory.GetAlgorithmProvider(pn)
|
||||
if err != nil {
|
||||
t.Errorf("Error retrieving '%s' provider: %v", pn, err)
|
||||
break
|
||||
}
|
||||
t.Run(pn, func(t *testing.T) {
|
||||
p, err := factory.GetAlgorithmProvider(pn)
|
||||
if err != nil {
|
||||
t.Fatalf("Error retrieving provider: %v", err)
|
||||
}
|
||||
|
||||
if !p.FitPredicateKeys.Has("CheckNodeCondition") {
|
||||
t.Errorf("Failed to find predicate: 'CheckNodeCondition'")
|
||||
break
|
||||
}
|
||||
if !p.FitPredicateKeys.Has("CheckNodeCondition") {
|
||||
t.Fatalf("Failed to find predicate: 'CheckNodeCondition'")
|
||||
}
|
||||
|
||||
if !p.FitPredicateKeys.Has("PodToleratesNodeTaints") {
|
||||
t.Errorf("Failed to find predicate: 'PodToleratesNodeTaints'")
|
||||
break
|
||||
}
|
||||
if !p.FitPredicateKeys.Has("PodToleratesNodeTaints") {
|
||||
t.Fatalf("Failed to find predicate: 'PodToleratesNodeTaints'")
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
// Apply features for algorithm providers.
|
||||
utilfeature.DefaultFeatureGate.Set("TaintNodesByCondition=True")
|
||||
defer utilfeaturetesting.SetFeatureGateDuringTest(t, utilfeature.DefaultFeatureGate, features.TaintNodesByCondition, true)()
|
||||
|
||||
ApplyFeatureGates()
|
||||
|
||||
for _, pn := range algorithmProviderNames {
|
||||
p, err := factory.GetAlgorithmProvider(pn)
|
||||
if err != nil {
|
||||
t.Errorf("Error retrieving '%s' provider: %v", pn, err)
|
||||
break
|
||||
}
|
||||
t.Run(pn, func(t *testing.T) {
|
||||
p, err := factory.GetAlgorithmProvider(pn)
|
||||
if err != nil {
|
||||
t.Fatalf("Error retrieving '%s' provider: %v", pn, err)
|
||||
}
|
||||
|
||||
if !p.FitPredicateKeys.Has("PodToleratesNodeTaints") {
|
||||
t.Errorf("Failed to find predicate: 'PodToleratesNodeTaints'")
|
||||
break
|
||||
}
|
||||
if !p.FitPredicateKeys.Has("PodToleratesNodeTaints") {
|
||||
t.Fatalf("Failed to find predicate: 'PodToleratesNodeTaints'")
|
||||
}
|
||||
|
||||
if p.FitPredicateKeys.Has("CheckNodeCondition") {
|
||||
t.Errorf("Unexpected predicate: 'CheckNodeCondition'")
|
||||
break
|
||||
}
|
||||
if p.FitPredicateKeys.Has("CheckNodeCondition") {
|
||||
t.Fatalf("Unexpected predicate: 'CheckNodeCondition'")
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user