Skip to content

Commit f8e62e3

Browse files
authored
Merge pull request kubernetes#89502 from SataQiu/staging-e2e-20200326
e2e/framework: remove direct imports to pkg/util/taints
2 parents 295b53f + d294e67 commit f8e62e3

File tree

2 files changed

+12
-4
lines changed

2 files changed

+12
-4
lines changed

test/e2e/framework/BUILD

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ go_library(
3030
"//pkg/kubelet/apis/stats/v1alpha1:go_default_library",
3131
"//pkg/kubelet/events:go_default_library",
3232
"//pkg/kubelet/sysctl:go_default_library",
33-
"//pkg/util/taints:go_default_library",
3433
"//staging/src/k8s.io/api/apps/v1:go_default_library",
3534
"//staging/src/k8s.io/api/core/v1:go_default_library",
3635
"//staging/src/k8s.io/api/policy/v1beta1:go_default_library",

test/e2e/framework/util.go

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,6 @@ import (
6363
watchtools "k8s.io/client-go/tools/watch"
6464
podutil "k8s.io/kubernetes/pkg/api/v1/pod"
6565
"k8s.io/kubernetes/pkg/controller"
66-
taintutils "k8s.io/kubernetes/pkg/util/taints"
6766
testutils "k8s.io/kubernetes/test/utils"
6867
imageutils "k8s.io/kubernetes/test/utils/image"
6968
uexec "k8s.io/utils/exec"
@@ -1008,7 +1007,7 @@ func verifyThatTaintIsGone(c clientset.Interface, nodeName string, taint *v1.Tai
10081007
ginkgo.By("verifying the node doesn't have the taint " + taint.ToString())
10091008
nodeUpdated, err := c.CoreV1().Nodes().Get(context.TODO(), nodeName, metav1.GetOptions{})
10101009
ExpectNoError(err)
1011-
if taintutils.TaintExists(nodeUpdated.Spec.Taints, taint) {
1010+
if taintExists(nodeUpdated.Spec.Taints, taint) {
10121011
Failf("Failed removing taint " + taint.ToString() + " of the node " + nodeName)
10131012
}
10141013
}
@@ -1031,7 +1030,7 @@ func NodeHasTaint(c clientset.Interface, nodeName string, taint *v1.Taint) (bool
10311030

10321031
nodeTaints := node.Spec.Taints
10331032

1034-
if len(nodeTaints) == 0 || !taintutils.TaintExists(nodeTaints, taint) {
1033+
if len(nodeTaints) == 0 || !taintExists(nodeTaints, taint) {
10351034
return false, nil
10361035
}
10371036
return true, nil
@@ -1361,3 +1360,13 @@ func PrettyPrintJSON(metrics interface{}) string {
13611360
}
13621361
return string(formatted.Bytes())
13631362
}
1363+
1364+
// taintExists checks if the given taint exists in list of taints. Returns true if exists false otherwise.
1365+
func taintExists(taints []v1.Taint, taintToFind *v1.Taint) bool {
1366+
for _, taint := range taints {
1367+
if taint.MatchTaint(taintToFind) {
1368+
return true
1369+
}
1370+
}
1371+
return false
1372+
}

0 commit comments

Comments
 (0)