From 848ff2b52f9f976953659d70f557b52c4c43d5f5 Mon Sep 17 00:00:00 2001 From: Ashley Dumaine Date: Fri, 1 Mar 2024 10:41:38 -0500 Subject: [PATCH] fix ip type setting for addresses on machine controller --- controller/linodemachine_controller.go | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/controller/linodemachine_controller.go b/controller/linodemachine_controller.go index c5bda5468..75465d3fe 100644 --- a/controller/linodemachine_controller.go +++ b/controller/linodemachine_controller.go @@ -378,10 +378,14 @@ func (r *LinodeMachineReconciler) reconcileCreate( machineScope.LinodeMachine.Spec.ProviderID = util.Pointer(fmt.Sprintf("linode://%d", linodeInstance.ID)) machineScope.LinodeMachine.Status.Addresses = []clusterv1.MachineAddress{} - for _, add := range linodeInstance.IPv4 { + for _, addr := range linodeInstance.IPv4 { + addrType := clusterv1.MachineExternalIP + if addr.IsPrivate() { + addrType = clusterv1.MachineInternalIP + } machineScope.LinodeMachine.Status.Addresses = append(machineScope.LinodeMachine.Status.Addresses, clusterv1.MachineAddress{ - Type: clusterv1.MachineExternalIP, - Address: add.String(), + Type: addrType, + Address: addr.String(), }) }