Skip to content
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

Merged
merged 1 commit into from Aug 17, 2019

Conversation

@feiskyer
Copy link
Member

commented Aug 16, 2019

What type of PR is this?

Uncomment only one /kind <> line, hit enter to put that in a new line, and remove leading whitespaces from that line:

/kind api-change
/kind bug
/kind cleanup
/kind design
/kind documentation
/kind failing-test
/kind feature
/kind flake

/kind bug

What this PR does / why we need it:

PR #77906 allows Kubelet to run with no Azure identity:

Kubelet could be run with no Azure identity now. A sample cloud provider configure is: {"vmType": "vmss", "useInstanceMetadata": true, "subscriptionId": "<subscriptionId>"}

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:

return cloudprovider.Zone{
FailureDomain: zone,
Region: az.Location,

This PR fixes those issues by getting location and subscriptionId from IMDS.

Which issue(s) this PR fixes:

Fixes #81496
Fixes kubernetes/cloud-provider-azure#219

Special notes for your reviewer:

Does this PR introduce a user-facing change?:

Kubelet could be run with no Azure identity without subscriptionId configured now.
A sample cloud provider configure is: '{"vmType": "vmss", "useInstanceMetadata": true}'.

Additional documentation e.g., KEPs (Kubernetes Enhancement Proposals), usage docs, etc.:


/sig cloud-provider
/priority important-soon
/area provider/azure

@feiskyer

This comment has been minimized.

Copy link
Member Author

commented Aug 16, 2019

/assign @andyzhangx

@k8s-ci-robot

This comment has been minimized.

Copy link
Contributor

commented Aug 16, 2019

[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 /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@feiskyer feiskyer force-pushed the feiskyer:fix-81496 branch from 1467b3f to bd85699 Aug 16, 2019

@feiskyer

This comment has been minimized.

Copy link
Member Author

commented Aug 16, 2019

/test pull-kubernetes-e2e-aks-engine-azure

@feiskyer feiskyer added this to In progress in Provider Azure via automation Aug 16, 2019

@feiskyer

This comment has been minimized.

Copy link
Member Author

commented Aug 16, 2019

/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")

This comment has been minimized.

Copy link
@andyzhangx

andyzhangx Aug 16, 2019

Member

where is this 2019-03-11 version from?

This comment has been minimized.


// Compose instanceID based on nodeName for standard instance.
if az.VMType == vmTypeStandard {
return az.getStandardMachineID(resourceGroup, nodeName), nil
if metadata.Compute.VMScaleSetName == "" {

This comment has been minimized.

Copy link
@andyzhangx

andyzhangx Aug 16, 2019

Member

why not use if az.VMType == vmTypeStandard?

This comment has been minimized.

Copy link
@feiskyer

feiskyer Aug 16, 2019

Author Member

this increase robustness, so that even vmtype is not configured, we could still figure out the right vmtype.

This comment has been minimized.

Copy link
@mlushpenko

mlushpenko Aug 16, 2019

I did run into the issue with vmtype not being specified for scalesets, so great addition

@andyzhangx
Copy link
Member

left a comment

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm label Aug 16, 2019

@fejta-bot

This comment has been minimized.

Copy link

commented Aug 16, 2019

/retest
This bot automatically retries jobs that failed/flaked on approved PRs (send feedback to fejta).

Review the full test history for this PR.

Silence the bot with an /lgtm cancel or /hold comment for consistent failures.

@k8s-ci-robot k8s-ci-robot merged commit 667ea63 into kubernetes:master Aug 17, 2019

24 checks passed

cla/linuxfoundation feiskyer authorized
Details
pull-kubernetes-bazel-build Job succeeded.
Details
pull-kubernetes-bazel-test Job succeeded.
Details
pull-kubernetes-conformance-image-test Skipped.
pull-kubernetes-cross Skipped.
pull-kubernetes-dependencies Job succeeded.
Details
pull-kubernetes-e2e-aks-engine-azure Job succeeded.
Details
pull-kubernetes-e2e-gce Job succeeded.
Details
pull-kubernetes-e2e-gce-100-performance Job succeeded.
Details
pull-kubernetes-e2e-gce-csi-serial Skipped.
pull-kubernetes-e2e-gce-device-plugin-gpu Job succeeded.
Details
pull-kubernetes-e2e-gce-iscsi Skipped.
pull-kubernetes-e2e-gce-iscsi-serial Skipped.
pull-kubernetes-e2e-gce-storage-slow Skipped.
pull-kubernetes-godeps Skipped.
pull-kubernetes-integration Job succeeded.
Details
pull-kubernetes-kubemark-e2e-gce-big Job succeeded.
Details
pull-kubernetes-local-e2e Skipped.
pull-kubernetes-node-e2e Job succeeded.
Details
pull-kubernetes-node-e2e-containerd Job succeeded.
Details
pull-kubernetes-typecheck Job succeeded.
Details
pull-kubernetes-verify Job succeeded.
Details
pull-publishing-bot-validate Skipped.
tide In merge pool.
Details

Provider Azure automation moved this from In progress to Done Aug 17, 2019

@k8s-ci-robot k8s-ci-robot added this to the v1.16 milestone Aug 17, 2019

@feiskyer feiskyer deleted the feiskyer:fix-81496 branch Aug 17, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.