Skip to content

Commit

Permalink
If RBN, use IPv6 address instead of IPv4
Browse files Browse the repository at this point in the history
This code seems to only be used for gossip, but it is always run. This fixes IPv6 only networking
  • Loading branch information
Ole Markus With committed Dec 3, 2021
1 parent eea8e2a commit 878bedf
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion protokube/pkg/protokube/aws_volume.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ import (
"github.com/aws/aws-sdk-go/aws/session"
"github.com/aws/aws-sdk-go/service/ec2"
"k8s.io/klog/v2"

"k8s.io/kops/protokube/pkg/etcd"
"k8s.io/kops/protokube/pkg/gossip"
gossipaws "k8s.io/kops/protokube/pkg/gossip/aws"
Expand Down Expand Up @@ -125,7 +126,11 @@ func (a *AWSVolumes) discoverTags() error {

a.clusterTag = clusterID

a.internalIP = net.ParseIP(aws.StringValue(instance.PrivateIpAddress))
if *instance.PrivateDnsNameOptions.HostnameType == ec2.HostnameTypeResourceName {
a.internalIP = net.ParseIP(aws.StringValue(instance.Ipv6Address))
} else {
a.internalIP = net.ParseIP(aws.StringValue(instance.PrivateIpAddress))
}
if a.internalIP == nil {
return fmt.Errorf("Internal IP not found on this instance (%q)", a.instanceId)
}
Expand Down

0 comments on commit 878bedf

Please sign in to comment.