-
Notifications
You must be signed in to change notification settings - Fork 40k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Get location and subscriptionID from IMDS when useInstanceMetadata is true #81500
Conversation
/assign @andyzhangx |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: feiskyer The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
/test pull-kubernetes-e2e-aks-engine-azure |
/retest |
@@ -111,7 +113,7 @@ func (ims *InstanceMetadataService) getInstanceMetadata(key string) (interface{} | |||
|
|||
q := req.URL.Query() | |||
q.Add("format", "json") | |||
q.Add("api-version", "2017-12-01") | |||
q.Add("api-version", "2019-03-11") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
where is this 2019-03-11
version from?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
from IMDS documentation, https://docs.microsoft.com/en-us/azure/virtual-machines/windows/instance-metadata-service
|
||
// Compose instanceID based on nodeName for standard instance. | ||
if az.VMType == vmTypeStandard { | ||
return az.getStandardMachineID(resourceGroup, nodeName), nil | ||
if metadata.Compute.VMScaleSetName == "" { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why not use if az.VMType == vmTypeStandard
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this increase robustness, so that even vmtype is not configured, we could still figure out the right vmtype.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I did run into the issue with vmtype not being specified for scalesets, so great addition
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/lgtm
/retest Review the full test history for this PR. Silence the bot with an |
What type of PR is this?
/kind bug
What this PR does / why we need it:
PR #77906 allows Kubelet to run with no Azure identity:
But actually, subscriptionId could also be got from IMDS.
Also, when getting availability zones,
location
from IMDS should be used instead of cloud-config file:kubernetes/staging/src/k8s.io/legacy-cloud-providers/azure/azure_zones.go
Lines 75 to 77 in 2974adf
This PR fixes those issues by getting location and subscriptionId from IMDS.
Which issue(s) this PR fixes:
Fixes #81496
Fixes kubernetes-sigs/cloud-provider-azure#219
Special notes for your reviewer:
Does this PR introduce a user-facing change?:
Additional documentation e.g., KEPs (Kubernetes Enhancement Proposals), usage docs, etc.:
/sig cloud-provider
/priority important-soon
/area provider/azure