diff --git a/controllers/openstackmachine_controller.go b/controllers/openstackmachine_controller.go index 3a3f3e0a02..a00a9033b5 100644 --- a/controllers/openstackmachine_controller.go +++ b/controllers/openstackmachine_controller.go @@ -356,6 +356,14 @@ func (r *OpenStackMachineReconciler) reconcileNormal(ctx context.Context, scope } addresses := instanceNS.Addresses() + + // For OpenShift and likely other systems, a node joins the cluster if the CSR generated by kubelet with the node name is approved. + // The approval happens if the Machine InternalDNS matches the node name. The in-tree provider used the server name for the node name. + // Let's add the server name as the InternalDNS to keep getting CSRs of nodes upgraded from in-tree provider approved. + addresses = append(addresses, corev1.NodeAddress{ + Type: corev1.NodeInternalDNS, + Address: instanceStatus.Name(), + }) openStackMachine.Status.Addresses = addresses switch instanceStatus.State() { diff --git a/test/e2e/suites/e2e/e2e_test.go b/test/e2e/suites/e2e/e2e_test.go index e7e5a0bbde..7ca787e470 100644 --- a/test/e2e/suites/e2e/e2e_test.go +++ b/test/e2e/suites/e2e/e2e_test.go @@ -415,6 +415,12 @@ var _ = Describe("e2e tests [PR-Blocking]", func() { // All IP addresses on all ports should be reported in Addresses Expect(machine.Status.Addresses).To(ContainElements(seenAddresses)) + + // Expect an InternalDNS entry matching the name of the OpenStack server + Expect(machine.Status.Addresses).To(ContainElement(clusterv1.MachineAddress{ + Type: clusterv1.MachineInternalDNS, + Address: machine.Spec.InfrastructureRef.Name, + })) } }) })