-
Notifications
You must be signed in to change notification settings - Fork 949
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
feature: cli supports --memory-reservation #2860
feature: cli supports --memory-reservation #2860
Conversation
Codecov Report
@@ Coverage Diff @@
## master #2860 +/- ##
==========================================
- Coverage 69.1% 69.07% -0.03%
==========================================
Files 285 286 +1
Lines 17887 17903 +16
==========================================
+ Hits 12360 12366 +6
- Misses 4120 4131 +11
+ Partials 1407 1406 -1
|
b810783
to
268a54a
Compare
Is it necessary to validate memory-reservation in fuction validateResource? I'm not sure there is a limitation of kernel that memory-reservation should be less than memory? |
test/environment/env.go
Outdated
@@ -80,6 +80,11 @@ var ( | |||
return cgroupInfo.Memory.MemoryLimit | |||
} | |||
|
|||
// IsMemoryReservationSupport checks if memory reservation cgroup is avaible |
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.
avaible -> avaiable?
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's a typo
Hi @KevinBetterQ , I was wondering if you could help to develop a new feature |
OK, I think it is a similar call in the code |
268a54a
to
6d46cd1
Compare
apis/opts/memory_reservation.go
Outdated
if memoryReservation == "" { | ||
return 0, nil | ||
} | ||
result, err := units.RAMInBytes(memoryReservation) |
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 about direct return units.RAMInBytes(memoryReservation)
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.
modified
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.
if there is an error, the upper function will always return, will not care about the result. and will return directly to the run execution failure, so there is no need to set this value.
Is that right?
55c3bc2
to
ed5b3d3
Compare
test/cli_run_memory_test.go
Outdated
// test run with invalid memory reservation | ||
cname := "TestRunWithMemoryReservationInvalid" | ||
res := command.PouchRun("run", "-d", | ||
"-m", "500m", |
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 we use less memory here? According to the testing machine, I am not sure that it will impact the case.
06e5afc
to
41c9d02
Compare
Signed-off-by: KevinBetterQ <1093850932@qq.com>
41c9d02
to
fff42a7
Compare
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
Signed-off-by: KevinBetterQ 1093850932@qq.com
Ⅰ. Describe what this PR did
pouch command supports --memory-reservation
Ⅱ. Does this pull request fix one issue?
fixes #2701
Ⅲ. Why don't you add test cases (unit test/integration test)? (你真的觉得不需要加测试吗?)
added
Ⅳ. Describe how to verify it
Ⅴ. Special notes for reviews