Skip to content

Commit dc9c331

Browse files
committed
metal: don't set CCM external always for IPv6
While we do require CCM for IPv6, we should configure the appropriate CCM.
1 parent d592f77 commit dc9c331

File tree

2 files changed

+37
-1
lines changed

2 files changed

+37
-1
lines changed

pkg/model/components/kubelet.go

+8-1
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,14 @@ func (b *KubeletOptionsBuilder) configureKubelet(cluster *kops.Cluster, kubelet
161161
}
162162

163163
if cluster.Spec.ExternalCloudControllerManager != nil {
164-
kubelet.CloudProvider = "external"
164+
if cloudProvider == kops.CloudProviderMetal {
165+
// metal does not (yet) have a cloud-controller-manager, so we don't need to set the cloud-provider flag
166+
// If we do set it to external, kubelet will taint the node with the node.kops.k8s.io/uninitialized taint
167+
// and there is no cloud-controller-manager to remove it
168+
kubelet.CloudProvider = ""
169+
} else {
170+
kubelet.CloudProvider = "external"
171+
}
165172
}
166173

167174
// Prevent image GC from pruning the pause image

tests/e2e/scenarios/bare-metal/e2e_test.go

+29
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,35 @@ func TestNodeAddresses(t *testing.T) {
5454
}
5555
}
5656
}
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+
}
5786

5887
// Harness is a test harness for our bare-metal e2e tests
5988
type Harness struct {

0 commit comments

Comments
 (0)