Skip to content

Commit 145c1c1

Browse files
committed
e2e/framework: remove import to pkg/apis/core/v1/helper
Signed-off-by: Andrew Sy Kim <[email protected]>
1 parent 426e5dc commit 145c1c1

File tree

2 files changed

+28
-5
lines changed

2 files changed

+28
-5
lines changed

test/e2e/framework/node/BUILD

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ go_library(
1010
importpath = "k8s.io/kubernetes/test/e2e/framework/node",
1111
visibility = ["//visibility:public"],
1212
deps = [
13-
"//pkg/apis/core/v1/helper:go_default_library",
1413
"//pkg/controller/nodelifecycle:go_default_library",
1514
"//pkg/scheduler/nodeinfo:go_default_library",
1615
"//staging/src/k8s.io/api/core/v1:go_default_library",

test/e2e/framework/node/resource.go

Lines changed: 28 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ import (
2828
"k8s.io/apimachinery/pkg/util/rand"
2929
"k8s.io/apimachinery/pkg/util/sets"
3030
clientset "k8s.io/client-go/kubernetes"
31-
v1helper "k8s.io/kubernetes/pkg/apis/core/v1/helper"
3231
nodectlr "k8s.io/kubernetes/pkg/controller/nodelifecycle"
3332
schedulernodeinfo "k8s.io/kubernetes/pkg/scheduler/nodeinfo"
3433
e2elog "k8s.io/kubernetes/test/e2e/framework/log"
@@ -404,9 +403,34 @@ func isNodeUntaintedWithNonblocking(node *v1.Node, nonblockingTaints string) boo
404403
return false
405404
}
406405

407-
return v1helper.TolerationsTolerateTaintsWithFilter(fakePod.Spec.Tolerations, taints, func(t *v1.Taint) bool {
408-
return t.Effect == v1.TaintEffectNoExecute || t.Effect == v1.TaintEffectNoSchedule
409-
})
406+
return toleratesTaintsWithNoScheduleNoExecuteEffects(taints, fakePod.Spec.Tolerations)
407+
}
408+
409+
func toleratesTaintsWithNoScheduleNoExecuteEffects(taints []v1.Taint, tolerations []v1.Toleration) bool {
410+
filteredTaints := []v1.Taint{}
411+
for _, taint := range taints {
412+
if taint.Effect == v1.TaintEffectNoExecute || taint.Effect == v1.TaintEffectNoSchedule {
413+
filteredTaints = append(filteredTaints, taint)
414+
}
415+
}
416+
417+
toleratesTaint := func(taint v1.Taint) bool {
418+
for _, toleration := range tolerations {
419+
if toleration.ToleratesTaint(&taint) {
420+
return true
421+
}
422+
}
423+
424+
return false
425+
}
426+
427+
for _, taint := range filteredTaints {
428+
if !toleratesTaint(taint) {
429+
return false
430+
}
431+
}
432+
433+
return true
410434
}
411435

412436
// IsNodeSchedulable returns true if:

0 commit comments

Comments
 (0)