-
Notifications
You must be signed in to change notification settings - Fork 159
Set MaxVolumesPerNode in NodeGetInfo #240
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
Conversation
Hi @Mockery-Li. Thanks for your PR. I'm waiting for a kubernetes-sigs or kubernetes member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. 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. |
/ok-to-test |
pkg/gce-pd-csi-driver/node.go
Outdated
const ( | ||
OneCPU = 1 | ||
EightCPUs = 8 | ||
MemCutoff = 3840 // 3.75GB |
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.
These consts can actually be lower case since we don't export it outside
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 GCP, GB == GiB, so this should be 3750
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.
Yes, it should be GiB and MiB. I tried to create a custom machine, it was *1024.
pkg/gce-pd-csi-driver/node.go
Outdated
machineType := ns.MetadataService.GetMachineType() | ||
if strings.HasPrefix(machineType, "n1-") { | ||
volumeLimits = VolumeLimit128 | ||
} else if machineType == "f1-micro" || machineType == "g1-small" { |
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.
Can you add unit tests for all of these?
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.
OK, I will have a try
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.
For the unit test, I add a function to set machine type for fake metaserver. I'm not sure if it's an appropriate way to do so.
pkg/gce-pd-csi-driver/node.go
Outdated
} else { | ||
return volumeLimits, err | ||
} | ||
volumeLimits = volumeLimit128 | ||
} else { | ||
return volumeLimits, fmt.Errorf("Unexpected machine type: %s", machineType) |
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.
Maybe this can be simplified to a case statement. Where if it's custom or n1, then it's 128. Everything else is 16. I think we don't need to error for unexpected machine type. That will hopefully make this more resilient to any new machine types added in the future.
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.
Yes, it makes sense
This is looking great! Thanks for all your work! Can you squash your commits, and also add a test case here: https://github.com/kubernetes-sigs/gcp-compute-persistent-disk-csi-driver/blob/master/test/e2e/tests/single_zone_e2e_test.go. This test suite runs as part of pull-gcp-compute-persistent-disk-csi-driver-e2e |
Add unit test add e2e test case
5fa0c80
to
8e7c69a
Compare
Test case is added to e2e test. I used the forced-push after rebasing, is it the usual way to do so? |
I don't know why, but for some reason go test is not picking up the new test case :-/ I'm trying out the change locally and am having no luck |
I tested out the driver manually on a cluster, and I see that the NodeGetInfo is returning the correct response:
And the Kubernetes Node object shows the correct entry:
|
/lgtm |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: Mockery-Li, msau42 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 |
Fixed: #19
Get volume limits by sending HTTP request to Google metadata server
Tested for several different machine types. But don't know how to integrate it into the current e2e test, and don't know if it is necessary.
@davidz627 @msau42