-
Notifications
You must be signed in to change notification settings - Fork 39.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
Enable volume limit feature by default #69225
Conversation
aa9b632
to
3bc352a
Compare
attachKey := v1.ResourceName(util.GetCSIAttachLimitKey(tc.driverName)) | ||
attachLimit := volumeLimits[attachKey] | ||
if attachLimit != tc.expectedVolumeLimit { | ||
t.Errorf("expected volume limit to be %d got %d", tc.inputVolumeLimit, attachLimit) |
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.
The log message is incorrect - expected volume limit is tc.expectedVolumeLimit
not tc.inputVolumeLimit
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 catch.
f62addb
to
d690511
Compare
Can we also add an e2e test? I don't know if this is something that unit tests would have caught. |
existingNode: generateNode( | ||
nil, /*nodeIDs*/ | ||
nil, /*labels*/ | ||
map[v1.ResourceName]resource.Quantity{ |
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.
Could you add a testcase for deletion against a node that previously doesn't contain attach limit info?
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.
Now that we run the test in all cases, I think this should be covered by that
inputNodeID: "", | ||
expectFail: true, | ||
}, | ||
{ |
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.
Could you add a test case with pre-existing attach limit on the node?
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.
done
@@ -627,6 +658,17 @@ func test(t *testing.T, addNodeInfo bool, csiNodeInfoEnabled bool, testcases []t | |||
continue | |||
} | |||
|
|||
// We are testing max volume limits | |||
if tc.inputVolumeLimit > 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.
nit: Is it possible to have the logic below run for every test case, and have getVolumeLimits()
return 0 if the attachKey doesn't exist? IMO, intuitively setting inputVolumeLimit
in a test case means this value is passed into the method being tested as an input, whereas RemoveInfo
doesn't depend on that param.
thanks for addressing! |
Also add tests for it.
eb75532
to
76c1eb2
Compare
test/e2e/storage/volume_limits.go
Outdated
if len(nodeList.Items) == 0 { | ||
framework.Failf("Unable to find ready and schedulable Node") | ||
} | ||
node := nodeList.Items[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.
test description says that it checks all nodes, but we're only checking one.
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.
should the test check all nodes?
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.
fixed
volumeLimits := getVolumeLimit(&node) | ||
if len(volumeLimits) == 0 { | ||
framework.Failf("Expected volume limits to be set") | ||
} |
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 we also launch a pod that uses the entire volume limit? You could potentially reuse this test case and just set a different numVolumes: https://sourcegraph.com/github.com/kubernetes/kubernetes/-/blob/test/e2e/storage/persistent_volumes.go#L319
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 but for gce - it appears that the limit on the selected node starts at 64. So, we will have to create a pod with 64+ volumes
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.
64 1gi volumes should be within our quota...
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.
okay, I think that will also make this test serial because no other workload(guess just with volumes but we don't have that level of granularity) can be scheduled on the node while this test runs on it. I can do that as a follow up PR while fixing #68912
/retest |
Just for the record, as I can't /lgtm: I went through the code and it seems OK to me; and the unit test seems to have good coverage as well. +1 for another test case that extrapolates the volume limit. |
76c1eb2
to
4caa56f
Compare
test/e2e/storage/volume_limits.go
Outdated
) | ||
f := framework.NewDefaultFramework("volume-limits-on-node") | ||
BeforeEach(func() { | ||
framework.SkipUnlessProviderIs("aws", "gce") |
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 include "gke" in this list
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.
fixed
4caa56f
to
e38cfb6
Compare
/lgtm |
/lgtm |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: gnufied, msau42, saad-ali 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 |
/retest Review the full test history for this PR. Silence the bot with an |
…5-upstream-release-1.12 Automated cherry pick of #69225: Enable volume limit feature by default
Also add more tests for it.
Fixes #69224
/sig storage
cc @saad-ali @msau42