Merge pull request #69077 from feiskyer/az-ip

Add fallbacks for getting node IP from Azure IMDS
This commit is contained in:
k8s-ci-robot 2018-09-27 11:07:46 -07:00 committed by GitHub
commit 58102b7517
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -87,6 +87,15 @@ func (az *Cloud) NodeAddresses(ctx context.Context, name types.NodeName) ([]v1.N
if err != nil {
return nil, err
}
// Fall back to ARM API if the address is empty string.
// TODO: this is a workaround because IMDS is not stable enough.
// It should be removed after IMDS fixing the issue.
if strings.TrimSpace(ipAddress.PrivateIP) == "" {
return addressGetter(name)
}
// Use ip address got from instance metadata.
addresses := []v1.NodeAddress{
{Type: v1.NodeInternalIP, Address: ipAddress.PrivateIP},
{Type: v1.NodeHostName, Address: string(name)},