Merge pull request #14470 from johngmyers/ipv6-fix

ipv6: NPE fixes for IPv6-only instances
This commit is contained in:
Kubernetes Prow Robot 2022-10-28 22:04:39 -07:00 committed by GitHub
commit 228a573ba5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 13 additions and 2 deletions

View File

@ -2432,7 +2432,9 @@ func GetInstanceCertificateNames(instances *ec2.DescribeInstancesOutput, useInst
addrs = append(addrs, *instance.InstanceId)
}
addrs = append(addrs, *instance.PrivateDnsName)
if instance.PrivateDnsName != nil {
addrs = append(addrs, *instance.PrivateDnsName)
}
// We only use data for the first interface, and only the first IP
for _, iface := range instance.NetworkInterfaces {
@ -2442,7 +2444,9 @@ func GetInstanceCertificateNames(instances *ec2.DescribeInstancesOutput, useInst
if *iface.Attachment.DeviceIndex != 0 {
continue
}
addrs = append(addrs, *iface.PrivateIpAddress)
if iface.PrivateIpAddress != nil {
addrs = append(addrs, *iface.PrivateIpAddress)
}
if iface.Ipv6Addresses != nil && len(iface.Ipv6Addresses) > 0 {
addrs = append(addrs, *iface.Ipv6Addresses[0].Ipv6Address)
}

View File

@ -1231,6 +1231,13 @@ func setupTopology(opt *NewClusterOptions, cluster *api.Cluster, allZones sets.S
PublicName: "bastion." + cluster.Name,
}
}
if opt.IPv6 {
for _, s := range cluster.Spec.Subnets {
if s.Type == kopsapi.SubnetTypeDualStack {
bastionGroup.Spec.Subnets = append(bastionGroup.Spec.Subnets, s.Name)
}
}
}
if cluster.Spec.GetCloudProvider() == api.CloudProviderGCE {
bastionGroup.Spec.Zones = allZones.List()
}