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

Cherry pick #537 from cloud provider azure: Refresh VM cache when node is not found #100110

Merged
merged 1 commit into from
Apr 9, 2021

Conversation

CecileRobertMichon
Copy link
Member

What type of PR is this?

/kind bug

What this PR does / why we need it: kubernetes-sigs/cloud-provider-azure#537

This fixes a bug affecting clusters with virtual machines when vmType is set to "vmss". What happens is the control manager comes online and queries for azure machines power status. Since the machines are not available yet they are not in the cache. When the request comes in for the load balancer the cache is queried and reports that the node does not exist as a VMAS and attempts to run the VMSS code hence the following error message: failed: not a vmss instance. The same error also occurs when trying to expose a load balancer service. When it is found the cache it goes down the correct code path.

Which issue(s) this PR fixes:

Fixes #

Special notes for your reviewer:

Does this PR introduce a user-facing change?

Fix availability set cache in vmss cache

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


/sig cloud-provider
/area provider/azure
/assign @feiskyer

@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. sig/cloud-provider Categorizes an issue or PR as relevant to SIG Cloud Provider. size/M Denotes a PR that changes 30-99 lines, ignoring generated files. 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. area/cloudprovider labels Mar 11, 2021
@nilo19
Copy link
Member

nilo19 commented Mar 11, 2021

/lgtm
/approve

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

nilo19 commented Mar 11, 2021

/triage accepted

@k8s-ci-robot
Copy link
Contributor

@nilo19: The label(s) priority/import-soon cannot be applied, because the repository doesn't have them.

In response to this:

/priority import-soon
/triage accepted

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@k8s-ci-robot k8s-ci-robot added triage/accepted Indicates an issue or PR is ready to be actively worked on. and removed needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. labels Mar 11, 2021
@nilo19
Copy link
Member

nilo19 commented Mar 11, 2021

/priority important-soon

@k8s-ci-robot k8s-ci-robot added priority/important-soon Must be staffed and worked on either currently, or very soon, ideally in time for the next release. and removed needs-priority Indicates a PR lacks a `priority/foo` label and requires one. labels Mar 11, 2021
@CecileRobertMichon
Copy link
Member Author

@nilo19
Copy link
Member

nilo19 commented Mar 12, 2021

/retest

@nilo19
Copy link
Member

nilo19 commented Mar 12, 2021

test failures related to #99909

@CecileRobertMichon
Copy link
Member Author

/retest

@nilo19 anything else I can do to get this merged?

@feiskyer
Copy link
Member

@andrewsykim could you help to approve this change? it is a bug fix.

@CecileRobertMichon
Copy link
Member Author

@feiskyer @nilo19 @chewong do you know why azure-file tests are failing?

@chewong
Copy link
Member

chewong commented Mar 19, 2021

Opened kubernetes-sigs/azurefile-csi-driver#600. I can take a look

@chewong
Copy link
Member

chewong commented Mar 19, 2021

kubernetes/test-infra#21459 should fix the azure file failure.
/test pull-kubernetes-e2e-aks-engine-conformance
/test pull-kubernetes-e2e-aks-engine-azure-windows
/test pull-kubernetes-e2e-aks-engine-windows-containerd

@CecileRobertMichon
Copy link
Member Author

/retest

now that kubernetes/test-infra#21459 has merged

@CecileRobertMichon
Copy link
Member Author

/retest

@chewong are the tests expected to pass now?

@chewong
Copy link
Member

chewong commented Mar 24, 2021

I still don't see kubekins-e2e test image getting updated for almost 2 weeks. Let me follow up on slack.

@chewong
Copy link
Member

chewong commented Mar 24, 2021

So the problem is that kubekins-e2e build has been failing for a while (https://testgrid.k8s.io/sig-testing-images#kubekins-e2e). I will take a look once I am free.

@CecileRobertMichon
Copy link
Member Author

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

@chewong
Copy link
Member

chewong commented Mar 26, 2021

Opened kubernetes/test-infra#21543 to fix the kubekins-e2e problem

@feiskyer
Copy link
Member

feiskyer commented Apr 1, 2021

/retest
ping @andrewsykim @cheftako for approval

@chewong
Copy link
Member

chewong commented Apr 1, 2021

The following three failed jobs were renamed:
pull-kubernetes-e2e-aks-engine-azure -> pull-kubernetes-e2e-aks-engine-conformance
pull-kubernetes-e2e-azure-file -> pull-kubernetes-e2e-aks-engine-azure-file
pull-kubernetes-e2e-azure-file-windows -> pull-kubernetes-e2e-aks-engine-azure-file-windows-dockershim

@feiskyer
Copy link
Member

feiskyer commented Apr 6, 2021

@CecileRobertMichon could you do a rebase and retrigger tests again?

@k8s-ci-robot k8s-ci-robot removed the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Apr 6, 2021
@CecileRobertMichon
Copy link
Member Author

/test pull-kubernetes-e2e-aks-engine-conformance
/test pull-kubernetes-e2e-aks-engine-azure-windows
/test pull-kubernetes-e2e-aks-engine-windows-containerd

Copy link
Member

@feiskyer feiskyer left a comment

Choose a reason for hiding this comment

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

/lgtm
ping @andrewsykim @cheftako for approval

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Apr 6, 2021
@k8s-ci-robot
Copy link
Contributor

k8s-ci-robot commented Apr 6, 2021

@CecileRobertMichon: The following tests failed, say /retest to rerun all failed tests:

Test name Commit Details Rerun command
pull-kubernetes-e2e-aks-engine-azure b37379da0987472258f2d65dfdd90402228151d9 link /test pull-kubernetes-e2e-aks-engine-azure
pull-kubernetes-e2e-azure-file b37379da0987472258f2d65dfdd90402228151d9 link /test pull-kubernetes-e2e-azure-file
pull-kubernetes-e2e-azure-file-windows b37379da0987472258f2d65dfdd90402228151d9 link /test pull-kubernetes-e2e-azure-file-windows

Full PR test history. Your PR dashboard. Please help us cut down on flakes by linking to an open issue when you hit one in your PR.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. I understand the commands that are listed here.

@CecileRobertMichon
Copy link
Member Author

/retest

Copy link
Member

@andrewsykim andrewsykim left a comment

Choose a reason for hiding this comment

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

/approve

Thanks @CecileRobertMichon

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: andrewsykim, CecileRobertMichon, nilo19

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 Apr 7, 2021
return availabilitySetNodes.Has(nodeName), nil
cachedNodes := cached.(availabilitySetEntry).nodeNames
// if the node is not in the cache, assume the node has joined after the last cache refresh and attempt to refresh the cache.
if !cachedNodes.Has(nodeName) {
Copy link
Member

Choose a reason for hiding this comment

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

Unit tests for this specific case would be useful I think

// if the node is not in the cache, assume the node has joined after the last cache refresh and attempt to refresh the cache.
if !cachedNodes.Has(nodeName) {
klog.V(2).Infof("Node %s has joined the cluster since the last VM cache refresh, refreshing the cache", nodeName)
cached, err = ss.availabilitySetNodesCache.Get(availabilitySetNodesKey, azcache.CacheReadTypeForceRefresh)
Copy link
Member

Choose a reason for hiding this comment

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

Would this mean we refresh the whole node cache for every new VM in the cluster? Is that expected?

Copy link
Member Author

Choose a reason for hiding this comment

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

tldr: yes. It's a trade-off we can't get both accuracy and performance but this minimizes the damage by adding a node cache.

See discussion in kubernetes-sigs/cloud-provider-azure#537 (comment)

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/important-soon Must be staffed and worked on either currently, or very soon, ideally in time for the next release. 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/M Denotes a PR that changes 30-99 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

6 participants