mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-22 19:31:44 +00:00
Populate internal DNS names in GCE provider
Both VM name and hostname are internally routable.
This commit is contained in:
parent
03df9aa4af
commit
50e9407951
@ -91,10 +91,20 @@ func (gce *GCECloud) NodeAddresses(_ context.Context, _ types.NodeName) ([]v1.No
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("couldn't get external IP: %v", err)
|
||||
}
|
||||
return []v1.NodeAddress{
|
||||
addresses := []v1.NodeAddress{
|
||||
{Type: v1.NodeInternalIP, Address: internalIP},
|
||||
{Type: v1.NodeExternalIP, Address: externalIP},
|
||||
}, nil
|
||||
}
|
||||
|
||||
if internalDNSFull, err := metadata.Get("instance/hostname"); err != nil {
|
||||
glog.Warningf("couldn't get full internal DNS name: %v", err)
|
||||
} else {
|
||||
addresses = append(addresses,
|
||||
v1.NodeAddress{Type: v1.NodeInternalDNS, Address: internalDNSFull},
|
||||
v1.NodeAddress{Type: v1.NodeHostName, Address: internalDNSFull},
|
||||
)
|
||||
}
|
||||
return addresses, nil
|
||||
}
|
||||
|
||||
// NodeAddressesByProviderID will not be called from the node that is requesting this ID.
|
||||
|
Loading…
Reference in New Issue
Block a user