mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-23 03:41:45 +00:00
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 (5b77996433/pkg/kubelet/kubelet.go (L385)
)
**Release note**:
```release-note
NONE
```
This commit is contained in:
commit
70e7a7d189
@ -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