Merge pull request #59539 from feiskyer/meta

Automatic merge from submit-queue (batch tested with PRs 59539, 59309). 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>.

Set instanceID to azure resource ID format while useInstanceMetadata is enabled

**What this PR does / why we need it**:

This PR sets instanceID to azure resource ID format while useInstanceMetadata is enabled.

Before this PR, it is `azure://d84a1c30-0c9f-11e8-8a34-000d3a919531`.

With this PR, it becomes `azure:///subscriptions/<id>/resourceGroups/<rg>/providers/Microsoft.Compute/virtualMachines/<node-name>`


**Which issue(s) this PR fixes** *(optional, in `fixes #<issue number>(, fixes #<issue_number>, ...)` format, will close the issue(s) when PR gets merged)*:
Fixes #

**Special notes for your reviewer**:

This PR is only for vmas and could be cherry-picked to old releases. There will be another PR for vmss after this.

Should cherry-pick to release 1.8 and 1.9.

**Release note**:

```release-note
Node's providerID is following Azure resource ID format now when useInstanceMetadata is enabled
```
This commit is contained in:
Kubernetes Submit Queue 2018-02-08 02:18:33 -08:00 committed by GitHub
commit b133434911
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -112,10 +112,8 @@ func (az *Cloud) InstanceID(ctx context.Context, name types.NodeName) (string, e
return "", err
}
if isLocalInstance {
externalInstanceID, err := az.metadata.Text("instance/compute/vmId")
if err == nil {
return externalInstanceID, nil
}
nodeName := mapNodeNameToVMName(name)
return az.getMachineID(nodeName), nil
}
}