Unverified Commit 70e7a7d1 authored by Kubernetes Submit Queue's avatar Kubernetes Submit Queue Committed by GitHub

Merge pull request #63512 from awly/gce-provider-dns-names

Automatic merge from submit-queue (batch tested with PRs 66973, 67704, 67722, 67723, 63512). If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>. Populate internal DNS names in GCE provider Both VM name and hostname are internally routable. **What this PR does / why we need it**: GCE cloud provider only populated IP addresses for instances. This PR adds internal DNS names. DNS names are used e.g. in kubelet server certificates (https://github.com/kubernetes/kubernetes/blob/5b77996433e8e8e07a7b0a9f7436fd44da2cad9c/pkg/kubelet/kubelet.go#L385) **Release note**: ```release-note NONE ```
parents 99c11643 50e94079
...@@ -91,10 +91,20 @@ func (gce *GCECloud) NodeAddresses(_ context.Context, _ types.NodeName) ([]v1.No ...@@ -91,10 +91,20 @@ func (gce *GCECloud) NodeAddresses(_ context.Context, _ types.NodeName) ([]v1.No
if err != nil { if err != nil {
return nil, fmt.Errorf("couldn't get external IP: %v", err) return nil, fmt.Errorf("couldn't get external IP: %v", err)
} }
return []v1.NodeAddress{ addresses := []v1.NodeAddress{
{Type: v1.NodeInternalIP, Address: internalIP}, {Type: v1.NodeInternalIP, Address: internalIP},
{Type: v1.NodeExternalIP, Address: externalIP}, {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. // NodeAddressesByProviderID will not be called from the node that is requesting this ID.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment