@@ -260,18 +260,6 @@ func buildInstanceAddrs(ctx context.Context, machineScope *scope.MachineScope, i
260260 Type : clusterv1 .MachineExternalIP ,
261261 })
262262
263- // check if a node has public ipv6 ip and store it
264- if addresses .IPv6 == nil {
265- return nil , errNoPublicIPv6Addrs
266- }
267- if addresses .IPv6 .SLAAC == nil {
268- return nil , errNoPublicIPv6SLAACAddrs
269- }
270- ips = append (ips , clusterv1.MachineAddress {
271- Address : addresses .IPv6 .SLAAC .Address ,
272- Type : clusterv1 .MachineExternalIP ,
273- })
274-
275263 // check if a node has vpc specific ip and store it
276264 for _ , vpcIP := range addresses .IPv4 .VPC {
277265 if vpcIP .Address != nil && * vpcIP .Address != "" {
@@ -281,6 +269,39 @@ func buildInstanceAddrs(ctx context.Context, machineScope *scope.MachineScope, i
281269 })
282270 }
283271 }
272+ // get the interfaces?
273+
274+ vpcPublicIPv6 := false
275+ // if the cluster has a public vpc ipv6 exclude the slaac
276+ for _ , vpcIP := range addresses .IPv6 .VPC {
277+ var ipType clusterv1.MachineAddressType
278+ if vpcIP .IPv6IsPublic != nil && * vpcIP .IPv6IsPublic {
279+ vpcPublicIPv6 = true
280+ ipType = clusterv1 .MachineExternalIP
281+ } else {
282+ ipType = clusterv1 .MachineInternalIP
283+ }
284+ for _ , ipv6IP := range vpcIP .IPv6Addresses {
285+ ips = append (ips , clusterv1.MachineAddress {
286+ Address : ipv6IP .SLAACAddress ,
287+ Type : ipType ,
288+ })
289+ }
290+ }
291+
292+ if ! vpcPublicIPv6 {
293+ // check if a node has public ipv6 ip and store it
294+ if addresses .IPv6 == nil {
295+ return nil , errNoPublicIPv6Addrs
296+ }
297+ if addresses .IPv6 .SLAAC == nil {
298+ return nil , errNoPublicIPv6SLAACAddrs
299+ }
300+ ips = append (ips , clusterv1.MachineAddress {
301+ Address : addresses .IPv6 .SLAAC .Address ,
302+ Type : clusterv1 .MachineExternalIP ,
303+ })
304+ }
284305
285306 if machineScope .LinodeCluster .Spec .Network .UseVlan {
286307 vlanIps , err := handleVlanIps (ctx , machineScope , instanceID )
0 commit comments