-
Notifications
You must be signed in to change notification settings - Fork 38.7k
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
Fix panic caused by no cloudprovider in test #64709
Fix panic caused by no cloudprovider in test #64709
Conversation
{ | ||
name: "when no cloudprovider is present", | ||
cloudProviderName: "", | ||
expectedVolumeKey: util.AzureVolumeLimitKey, |
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.
How is this specific key picked up when cloud provider is set to empty?
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.
We could have tested any cloudprovider. I just chose to test Azure.
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.
also there's a loop in setVolumeLimits that goes through all the plugins so we are just picking one to test here.
pkg/volume/aws_ebs/aws_ebs.go
Outdated
// if we can't fetch cloudprovider we return a limit assuming | ||
// kubelet could be running without cloudprovider. | ||
if cloud == nil { | ||
return volumeLimits, nil |
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.
In the hindsight, this may not be best idea. Not returning a value from here is probably better because then an external CCM or admin can override it.
We should not panic when no cloudprovider is present
648a754
to
32b6919
Compare
// default values from here will mean, no one can | ||
// override them. | ||
if cloud == nil { | ||
return nil, fmt.Errorf("No cloudprovider present") |
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 is not really an error right? would this work in say local-up-cluster? would be better to pass back map[string]int64{}, nil
no?
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 is not really an error. The caller of this function will just use the returned error to determine that no limit has to be set. Caller could have also used nil value to ascertain that but for logging and messaging purposes, it is best to return an error.
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.
@gnufied i don't see a change for setVolumeLimits (from pkg/kubelet/kubelet_node_status.go) in this PR. That's the one that also needs to change right?
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.
never mind, we just continue looping around there in that method even when there is an error
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.
In what case, the cloud could be nil?
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.
almost any bare metal / single node / local-up-cluster.sh scenarios.
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.
( or even when --cloud-provider=external )
/milestone v1.11 |
/sig storage |
@kubernetes/sig-node-pr-reviews @kubernetes/sig-storage-pr-reviews |
/kind bug |
/lgtm |
/lgtm |
/assign @yujuhong |
[MILESTONENOTIFIER] Milestone Pull Request: Up-to-date for process @dims @gnufied @msau42 @saad-ali @yujuhong Pull Request Labels
|
/approve |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: dims, gnufied, msau42, saad-ali, yujuhong 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 |
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
/test all [submit-queue is verifying that this PR is safe to merge] |
Automatic merge from submit-queue (batch tested with PRs 64344, 64709, 64717, 63631, 58647). If you want to cherry-pick this change to another branch, please follow the instructions here. |
We should not panic when no cloudprovider is present
Fixes #64704
Also added a test to cover the panic.
/sig storage
/sig node