@@ -54,6 +54,35 @@ func TestNodeAddresses(t *testing.T) {
54
54
}
55
55
}
56
56
}
57
+ func TestNodesNotTainted (t * testing.T ) {
58
+ h := NewHarness (context .Background (), t )
59
+
60
+ nodes := h .Nodes ()
61
+
62
+ // Quick check that we have some nodes
63
+ if len (nodes ) == 0 {
64
+ t .Errorf ("expected some nodes, got 0 nodes" )
65
+ }
66
+
67
+ // Verify that the nodes aren't tainted
68
+ // In particular, we are checking for the node.cloudprovider.kubernetes.io/uninitialized taint
69
+ for _ , node := range nodes {
70
+ t .Logf ("node %s has taints: %v" , node .Name , node .Spec .Taints )
71
+ for _ , taint := range node .Spec .Taints {
72
+ switch taint .Key {
73
+ case "node.kops.k8s.io/uninitialized" :
74
+ t .Errorf ("unexpected taint for node %s: %s" , node .Name , taint .Key )
75
+ t .Errorf ("if we pass the --cloud-provider=external flag to kubelet, the node will be tainted with the node.kops.k8s.io/uninitialize taint" )
76
+ t .Errorf ("the taint is expected to be removed by the cloud-contoller-manager" )
77
+ t .Errorf ("(likely should be running a cloud-controller-manager in the cluster, or we should not pass the --cloud-provider=external flag to kubelet)" )
78
+ case "node-role.kubernetes.io/control-plane" :
79
+ // expected for control-plane nodes
80
+ default :
81
+ t .Errorf ("unexpected taint for node %s: %s" , node .Name , taint .Key )
82
+ }
83
+ }
84
+ }
85
+ }
57
86
58
87
// Harness is a test harness for our bare-metal e2e tests
59
88
type Harness struct {
0 commit comments