diff --git a/pkg/apis/openstackproviderconfig/v1alpha1/types.go b/pkg/apis/openstackproviderconfig/v1alpha1/types.go index 6091075e6d..95ffc89f68 100644 --- a/pkg/apis/openstackproviderconfig/v1alpha1/types.go +++ b/pkg/apis/openstackproviderconfig/v1alpha1/types.go @@ -124,7 +124,7 @@ type SecurityGroupFilter struct { type NetworkParam struct { // The UUID of the network. Required if you omit the port attribute. UUID string `json:"uuid,omitempty"` - // A fixed IPv4 address for the NIC. + // A fixed IP address for the NIC. FixedIp string `json:"fixedIp,omitempty"` // Filters for optional network query Filter Filter `json:"filter,omitempty"` diff --git a/pkg/cloud/openstack/machine/actuator.go b/pkg/cloud/openstack/machine/actuator.go index 6ad791a134..51bac3453c 100644 --- a/pkg/cloud/openstack/machine/actuator.go +++ b/pkg/cloud/openstack/machine/actuator.go @@ -424,6 +424,11 @@ func getIPsFromInstance(instance *clients.Instance) (map[string]string, error) { "": instance.AccessIPv4, }, nil } + if instance.AccessIPv6 != "" && net.ParseIP(instance.AccessIPv6) != nil { + return map[string]string{ + "": instance.AccessIPv6, + }, nil + } type networkInterface struct { Address string `json:"addr"` Version float64 `json:"version"` @@ -442,9 +447,7 @@ func getIPsFromInstance(instance *clients.Instance) (map[string]string, error) { var netInterface networkInterface b, _ := json.Marshal(network) json.Unmarshal(b, &netInterface) - if netInterface.Version == 4.0 { - addrMap[networkName] = netInterface.Address - } + addrMap[networkName] = netInterface.Address } } if len(addrMap) == 0 {