Skip to content

Commit

Permalink
Merge pull request #14470 from johngmyers/ipv6-fix
Browse files Browse the repository at this point in the history
ipv6: NPE fixes for IPv6-only instances
  • Loading branch information
k8s-ci-robot authored Oct 29, 2022
2 parents 20b0595 + 63111f6 commit 228a573
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
8 changes: 6 additions & 2 deletions upup/pkg/fi/cloudup/awsup/aws_cloud.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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)
}
Expand Down
7 changes: 7 additions & 0 deletions upup/pkg/fi/cloudup/new_cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -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()
}
Expand Down

0 comments on commit 228a573

Please sign in to comment.