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

azure: fix node public IP not able to fetch issues from IMDS #100690

Merged
merged 1 commit into from May 6, 2021

Conversation

feiskyer
Copy link
Member

What type of PR is this?

/kind bug
/sig cloud-provider
/area provider/azure

What this PR does / why we need it:

When VM or VMSS is bounded with "standard" LoadBalancer, the instance's public IP address would not be part of http://169.254.169.254/metadata/instance. Hence, kubectl get nodes would not show public IP address when using "standard" LoadBalancer.

This PR fixes the issue by fetching public IP from IMDS loadbalancer endpoint http://169.254.169.254/metadata/loadbalancer .

Which issue(s) this PR fixes:

Fixes #

Special notes for your reviewer:

This is a cherry-pick of kubernetes-sigs/cloud-provider-azure#540.

Does this PR introduce a user-facing change?

Fix Azure node public IP fetching issues from instance metadata service when the node is part of standard load balancer backend pool.

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


@k8s-ci-robot k8s-ci-robot added release-note Denotes a PR that will be considered when it comes time to generate release notes. kind/bug Categorizes issue or PR as related to a bug. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. sig/cloud-provider Categorizes an issue or PR as relevant to SIG Cloud Provider. area/provider/azure Issues or PRs related to azure provider cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. needs-priority Indicates a PR lacks a `priority/foo` label and requires one. labels Mar 31, 2021
@feiskyer
Copy link
Member Author

/triage accepted
/priority critical-urgent

@k8s-ci-robot k8s-ci-robot added triage/accepted Indicates an issue or PR is ready to be actively worked on. priority/critical-urgent Highest priority. Must be actively worked on as someone's top priority right now. area/cloudprovider and removed needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. needs-priority Indicates a PR lacks a `priority/foo` label and requires one. labels Mar 31, 2021
@nilo19
Copy link
Member

nilo19 commented Mar 31, 2021

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Mar 31, 2021
@feiskyer
Copy link
Member Author

/retest

@dims
Copy link
Member

dims commented Mar 31, 2021

cc @kubernetes/release-managers (for milestone)

/assign @cheftako @andrewsykim

(for approval)

@nilo19
Copy link
Member

nilo19 commented Mar 31, 2021

/retest

@feiskyer
Copy link
Member Author

feiskyer commented Apr 6, 2021

ping @cheftako @andrewsykim for approval

k8s-ci-robot added a commit that referenced this pull request Apr 9, 2021
Cherry pick of #100690: azure: fix node public IP not able to fetch issues from IMDS
k8s-ci-robot added a commit that referenced this pull request Apr 9, 2021
Cherry pick of #100690: azure: fix node public IP not able to fetch issues from IMDS
k8s-ci-robot added a commit that referenced this pull request Apr 9, 2021
Cherry pick of #100690: azure: fix node public IP not able to fetch issues from IMDS
@feiskyer
Copy link
Member Author

ping @cheftako @andrewsykim for approval


if instanceMetadata.Network != nil && len(instanceMetadata.Network.Interface) > 0 {
netInterface := instanceMetadata.Network.Interface[0]
if (len(netInterface.IPV4.IPAddress) > 0 && len(netInterface.IPV4.IPAddress[0].PublicIP) > 0) ||
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Might be nice to use a constant for primary ip index rather than just 0.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

agreed, constant is better than magic number

if err != nil {
return nil, err
}
defer resp.Body.Close()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Close() can fail, might be nice to use an anonymous function so you can log any failures?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good suggestion. would add a log later in case any failures happen.

@cheftako
Copy link
Member

cheftako commented May 6, 2021

/lgtm
/approve

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: cheftako, 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

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label May 6, 2021
@k8s-ci-robot k8s-ci-robot merged commit 7a0092f into kubernetes:master May 6, 2021
@k8s-ci-robot k8s-ci-robot added this to the v1.22 milestone May 6, 2021
@feiskyer feiskyer deleted the fix-node-pip branch May 7, 2021 01:38
k8s-ci-robot added a commit that referenced this pull request May 7, 2021
Cherry pick of #100690: azure: fix node public IP not able to fetch issues from IMDS
@ragarcia26
Copy link

How can we use this change? when will it be available in aks?

@feiskyer
Copy link
Member Author

feiskyer commented May 11, 2021

@ragarcia26 it would be part of 1.18.18+, 1.19.10+, 1.20.6+ (those versions would be available in AKS soon).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. area/cloudprovider area/provider/azure Issues or PRs related to azure provider cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. kind/bug Categorizes issue or PR as related to a bug. lgtm "Looks good to me", indicates that a PR is ready to be merged. priority/critical-urgent Highest priority. Must be actively worked on as someone's top priority right now. release-note Denotes a PR that will be considered when it comes time to generate release notes. sig/cloud-provider Categorizes an issue or PR as relevant to SIG Cloud Provider. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. triage/accepted Indicates an issue or PR is ready to be actively worked on.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

7 participants