@@ -464,7 +464,8 @@ func (m *MachineScope) GetMachineIPFromStatus() (string, error) {
464
464
// GetInstanceIp returns the OCIMachine's instance IP from its primary VNIC attachment.
465
465
//
466
466
// 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 {}
468
469
var page * string
469
470
for {
470
471
resp , err := m .ComputeClient .ListVnicAttachments (ctx , core.ListVnicAttachmentsRequest {
@@ -495,7 +496,20 @@ func (m *MachineScope) GetInstanceIp(ctx context.Context) (*string, error) {
495
496
return nil , err
496
497
}
497
498
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
499
513
}
500
514
}
501
515
0 commit comments