Use internal config types in scheduling plugin args

Signed-off-by: Aldo Culquicondor <acondor@google.com>
This commit is contained in:
Aldo Culquicondor
2020-04-15 13:37:56 -04:00
parent 6b153dc920
commit 98d1e241f1
29 changed files with 491 additions and 429 deletions

View File

@@ -19,10 +19,11 @@ package noderesources
import (
"context"
"fmt"
"k8s.io/apimachinery/pkg/runtime"
"reflect"
"testing"
"k8s.io/kubernetes/pkg/scheduler/apis/config"
v1 "k8s.io/api/core/v1"
"k8s.io/apimachinery/pkg/api/resource"
v1helper "k8s.io/kubernetes/pkg/apis/core/v1/helper"
@@ -94,7 +95,7 @@ func TestEnoughRequests(t *testing.T) {
pod *v1.Pod
nodeInfo *framework.NodeInfo
name string
ignoredResources []byte
args config.NodeResourcesFitArgs
wantInsufficientResources []InsufficientResource
wantStatus *framework.Status
}{
@@ -340,8 +341,10 @@ func TestEnoughRequests(t *testing.T) {
{
pod: newResourcePod(
framework.Resource{MilliCPU: 1, Memory: 1, ScalarResources: map[v1.ResourceName]int64{extendedResourceB: 1}}),
nodeInfo: framework.NewNodeInfo(newResourcePod(framework.Resource{MilliCPU: 0, Memory: 0})),
ignoredResources: []byte(`{"IgnoredResources" : ["example.com/bbb"]}`),
nodeInfo: framework.NewNodeInfo(newResourcePod(framework.Resource{MilliCPU: 0, Memory: 0})),
args: config.NodeResourcesFitArgs{
IgnoredResources: []string{"example.com/bbb"},
},
name: "skip checking ignored extended resource",
wantInsufficientResources: []InsufficientResource{},
},
@@ -371,8 +374,10 @@ func TestEnoughRequests(t *testing.T) {
node := v1.Node{Status: v1.NodeStatus{Capacity: makeResources(10, 20, 32, 5, 20, 5).Capacity, Allocatable: makeAllocatableResources(10, 20, 32, 5, 20, 5)}}
test.nodeInfo.SetNode(&node)
args := &runtime.Unknown{Raw: test.ignoredResources}
p, _ := NewFit(args, nil)
p, err := NewFit(&test.args, nil)
if err != nil {
t.Fatal(err)
}
cycleState := framework.NewCycleState()
preFilterStatus := p.(framework.PreFilterPlugin).PreFilter(context.Background(), cycleState, test.pod)
if !preFilterStatus.IsSuccess() {