@@ -464,7 +464,8 @@ func (m *MachineScope) GetMachineIPFromStatus() (string, error) {
464464// GetInstanceIp returns the OCIMachine's instance IP from its primary VNIC attachment.
465465//
466466// See https://docs.oracle.com/en-us/iaas/Content/Network/Tasks/managingVNICs.htm for more on VNICs
467- func (m * MachineScope ) GetInstanceIp (ctx context.Context ) (* string , error ) {
467+ func (m * MachineScope ) GetInstanceIPs (ctx context.Context ) ([]clusterv1.MachineAddress , error ) {
468+ addresses := []clusterv1.MachineAddress {}
468469 var page * string
469470 for {
470471 resp , err := m .ComputeClient .ListVnicAttachments (ctx , core.ListVnicAttachmentsRequest {
@@ -495,7 +496,20 @@ func (m *MachineScope) GetInstanceIp(ctx context.Context) (*string, error) {
495496 return nil , err
496497 }
497498 if vnic .IsPrimary != nil && * vnic .IsPrimary {
498- return vnic .PrivateIp , nil
499+ if vnic .PublicIp != nil {
500+ publicIP := clusterv1.MachineAddress {
501+ Address : * vnic .PublicIp ,
502+ Type : clusterv1 .MachineExternalIP ,
503+ }
504+ addresses = append (addresses , publicIP )
505+ return addresses , nil
506+ }
507+ privateIP := clusterv1.MachineAddress {
508+ Address : * vnic .PrivateIp ,
509+ Type : clusterv1 .MachineInternalIP ,
510+ }
511+ addresses = append (addresses , privateIP )
512+ return addresses , nil
499513 }
500514 }
501515
0 commit comments