@@ -63,7 +63,6 @@ import (
63
63
watchtools "k8s.io/client-go/tools/watch"
64
64
podutil "k8s.io/kubernetes/pkg/api/v1/pod"
65
65
"k8s.io/kubernetes/pkg/controller"
66
- taintutils "k8s.io/kubernetes/pkg/util/taints"
67
66
testutils "k8s.io/kubernetes/test/utils"
68
67
imageutils "k8s.io/kubernetes/test/utils/image"
69
68
uexec "k8s.io/utils/exec"
@@ -1008,7 +1007,7 @@ func verifyThatTaintIsGone(c clientset.Interface, nodeName string, taint *v1.Tai
1008
1007
ginkgo .By ("verifying the node doesn't have the taint " + taint .ToString ())
1009
1008
nodeUpdated , err := c .CoreV1 ().Nodes ().Get (context .TODO (), nodeName , metav1.GetOptions {})
1010
1009
ExpectNoError (err )
1011
- if taintutils . TaintExists (nodeUpdated .Spec .Taints , taint ) {
1010
+ if taintExists (nodeUpdated .Spec .Taints , taint ) {
1012
1011
Failf ("Failed removing taint " + taint .ToString () + " of the node " + nodeName )
1013
1012
}
1014
1013
}
@@ -1031,7 +1030,7 @@ func NodeHasTaint(c clientset.Interface, nodeName string, taint *v1.Taint) (bool
1031
1030
1032
1031
nodeTaints := node .Spec .Taints
1033
1032
1034
- if len (nodeTaints ) == 0 || ! taintutils . TaintExists (nodeTaints , taint ) {
1033
+ if len (nodeTaints ) == 0 || ! taintExists (nodeTaints , taint ) {
1035
1034
return false , nil
1036
1035
}
1037
1036
return true , nil
@@ -1361,3 +1360,13 @@ func PrettyPrintJSON(metrics interface{}) string {
1361
1360
}
1362
1361
return string (formatted .Bytes ())
1363
1362
}
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