Skip to content

Commit de8aaa4

Browse files
committed
Add server name for the Machine InternalDNS
For a node to join the cluster, a CSR generated by kubelet with the node name must be approved. The approval happens if the value of the NodeInternalDNS entry on the Machine matches the node name. When using legacy cloud provider the value of that node name is the Server name. This commit ensures the nodes handled with legacy cloud provides get approved by adding the server name to the list of Machine addresses.
1 parent 3652e4b commit de8aaa4

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

controllers/openstackmachine_controller.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -348,6 +348,14 @@ func (r *OpenStackMachineReconciler) reconcileNormal(ctx context.Context, scope
348348
}
349349

350350
addresses := instanceNS.Addresses()
351+
352+
// For OpenShift and likely other systems, a node joins the cluster if the CSR generated by kubelet with the node name is approved.
353+
// The approval happens if the Machine InternalDNS matches the node name. The in-tree provider used the server name for the node name.
354+
// Let's add the server name as the InternalDNS to keep getting CSRs of nodes upgraded from in-tree provider approved.
355+
addresses = append(addresses, corev1.NodeAddress{
356+
Type: corev1.NodeInternalDNS,
357+
Address: instanceStatus.Name(),
358+
})
351359
openStackMachine.Status.Addresses = addresses
352360

353361
switch instanceStatus.State() {

test/e2e/suites/e2e/e2e_test.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -415,6 +415,12 @@ var _ = Describe("e2e tests [PR-Blocking]", func() {
415415

416416
// All IP addresses on all ports should be reported in Addresses
417417
Expect(machine.Status.Addresses).To(ContainElements(seenAddresses))
418+
419+
// Expect an InternalDNS entry matching the name of the OpenStack server
420+
Expect(machine.Status.Addresses).To(ContainElement(clusterv1.MachineAddress{
421+
Type: clusterv1.MachineInternalDNS,
422+
Address: machine.Spec.InfrastructureRef.Name,
423+
}))
418424
}
419425
})
420426
})

0 commit comments

Comments
 (0)