Merge pull request #106619 from chendave/ga

Graduate `PreferNominatedNode` to GA
This commit is contained in:
Kubernetes Prow Robot
2022-01-04 15:21:19 -08:00
committed by GitHub
4 changed files with 7 additions and 27 deletions

View File

@@ -34,12 +34,9 @@ import (
"k8s.io/apimachinery/pkg/types"
"k8s.io/apimachinery/pkg/util/sets"
"k8s.io/apimachinery/pkg/util/wait"
utilfeature "k8s.io/apiserver/pkg/util/feature"
"k8s.io/client-go/informers"
clientsetfake "k8s.io/client-go/kubernetes/fake"
featuregatetesting "k8s.io/component-base/featuregate/testing"
pvutil "k8s.io/kubernetes/pkg/controller/volume/persistentvolume/util"
"k8s.io/kubernetes/pkg/features"
schedulerapi "k8s.io/kubernetes/pkg/scheduler/apis/config"
"k8s.io/kubernetes/pkg/scheduler/framework"
"k8s.io/kubernetes/pkg/scheduler/framework/plugins/defaultbinder"
@@ -1454,33 +1451,23 @@ func TestFairEvaluationForNodes(t *testing.T) {
func TestPreferNominatedNodeFilterCallCounts(t *testing.T) {
tests := []struct {
name string
feature bool
pod *v1.Pod
nodeReturnCodeMap map[string]framework.Code
expectedCount int32
expectedPatchRequests int
}{
{
name: "Enable the feature, pod has the nominated node set, filter is called only once",
feature: true,
name: "pod has the nominated node set, filter is called only once",
pod: st.MakePod().Name("p_with_nominated_node").UID("p").Priority(highPriority).NominatedNodeName("node1").Obj(),
expectedCount: 1,
},
{
name: "Disable the feature, pod has the nominated node, filter is called for each node",
feature: false,
pod: st.MakePod().Name("p_with_nominated_node").UID("p").Priority(highPriority).NominatedNodeName("node1").Obj(),
expectedCount: 3,
},
{
name: "pod without the nominated pod, filter is called for each node",
feature: true,
pod: st.MakePod().Name("p_without_nominated_node").UID("p").Priority(highPriority).Obj(),
expectedCount: 3,
},
{
name: "nominated pod cannot pass the filter, filter is called for each node",
feature: true,
pod: st.MakePod().Name("p_with_nominated_node").UID("p").Priority(highPriority).NominatedNodeName("node1").Obj(),
nodeReturnCodeMap: map[string]framework.Code{"node1": framework.Unschedulable},
expectedCount: 4,
@@ -1489,7 +1476,6 @@ func TestPreferNominatedNodeFilterCallCounts(t *testing.T) {
for _, test := range tests {
t.Run(test.name, func(t *testing.T) {
defer featuregatetesting.SetFeatureGateDuringTest(t, utilfeature.DefaultFeatureGate, features.PreferNominatedNode, test.feature)()
// create three nodes in the cluster.
nodes := makeNodeList([]string{"node1", "node2", "node3"})
client := clientsetfake.NewSimpleClientset(test.pod)