mirror of https://github.com/k3s-io/k3s
Merge pull request #62611 from feiskyer/vmss-standard
Automatic merge from submit-queue. 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>. Fix machineID getting for vmss nodes when using instance metadata **What this PR does / why we need it**: When instancemetadata is for Kubelet on master nodes , kubelet is not able to register itself with errors: ```sh Unable to construct v1.Node object for kubelet: failed to get external ID from cloud provider: not a vmss instance ``` This PR fixes this issue by composing standard instance ID for such nodes. **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 #62610 **Special notes for your reviewer**: Need cherry pick to 1.10. **Release note**: ```release-note Fix machineID getting for vmss nodes when using instance metadata ``` /assign @andyzhangxpull/8/head
commit
5e50a0fb7a
|
@ -162,6 +162,10 @@ func (az *Cloud) InstanceID(ctx context.Context, name types.NodeName) (string, e
|
|||
}
|
||||
ssName, instanceID, err := extractVmssVMName(metadataName)
|
||||
if err != nil {
|
||||
if err == ErrorNotVmssInstance {
|
||||
// Compose machineID for standard Node.
|
||||
return az.getStandardMachineID(nodeName), nil
|
||||
}
|
||||
return "", err
|
||||
}
|
||||
// Compose instanceID based on ssName and instanceID for vmss instance.
|
||||
|
|
Loading…
Reference in New Issue