-
Notifications
You must be signed in to change notification settings - Fork 40.1k
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
Conversation
/triage accepted |
/lgtm |
/retest |
cc @kubernetes/release-managers (for milestone) /assign @cheftako @andrewsykim (for approval) |
/retest |
ping @cheftako @andrewsykim for approval |
staging/src/k8s.io/legacy-cloud-providers/azure/azure_instance_metadata.go
Show resolved
Hide resolved
staging/src/k8s.io/legacy-cloud-providers/azure/azure_instance_metadata.go
Show resolved
Hide resolved
staging/src/k8s.io/legacy-cloud-providers/azure/azure_instance_metadata.go
Show resolved
Hide resolved
Cherry pick of #100690: azure: fix node public IP not able to fetch issues from IMDS
Cherry pick of #100690: azure: fix node public IP not able to fetch issues from IMDS
Cherry pick of #100690: azure: fix node public IP not able to fetch issues from IMDS
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) || |
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.
Might be nice to use a constant for primary ip index rather than just 0.
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.
agreed, constant is better than magic number
if err != nil { | ||
return nil, err | ||
} | ||
defer resp.Body.Close() |
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.
Close() can fail, might be nice to use an anonymous function so you can log any failures?
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.
good suggestion. would add a log later in case any failures happen.
/lgtm |
[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 |
Cherry pick of #100690: azure: fix node public IP not able to fetch issues from IMDS
How can we use this change? when will it be available in aks? |
@ragarcia26 it would be part of 1.18.18+, 1.19.10+, 1.20.6+ (those versions would be available in AKS soon). |
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?
Additional documentation e.g., KEPs (Kubernetes Enhancement Proposals), usage docs, etc.: