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

feature: add cpu period and quota for containers #1067

Merged

Conversation

allencloud
Copy link
Collaborator

Signed-off-by: Allen Sun [email protected]

Ⅰ. Describe what this PR did

This adds --cpu-quota and --cpu-period to container options.

--cpu-period should be in range [1000,1000000], and --cpu-quota should be in [1000, ∞).

Ⅱ. Does this pull request fix one issue?

fixes #1031

Ⅲ. Describe how you did it

none

Ⅳ. Describe how to verify it

none

Ⅴ. Special notes for reviews

none

@allencloud allencloud force-pushed the add-cpu-options branch 6 times, most recently from 8002a71 to ce44269 Compare April 8, 2018 10:05
@codecov-io
Copy link

Codecov Report

Merging #1067 into master will increase coverage by <.01%.
The diff coverage is 0%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1067      +/-   ##
==========================================
+ Coverage   16.48%   16.48%   +<.01%     
==========================================
  Files         158      159       +1     
  Lines        8841     8783      -58     
==========================================
- Hits         1457     1448       -9     
+ Misses       7281     7231      -50     
- Partials      103      104       +1
Impacted Files Coverage Δ
daemon/mgr/spec.go 0% <ø> (ø) ⬆️
pkg/opts/cpu.go 0% <0%> (ø)
daemon/mgr/spec_cgroup_cpu.go 0% <0%> (ø) ⬆️
cli/common_flags.go 0% <0%> (ø) ⬆️
cli/container.go 0% <0%> (ø) ⬆️
pkg/kernel/kernel.go 72.72% <0%> (-7.28%) ⬇️
daemon/mgr/spec_volume.go 0% <0%> (ø) ⬆️
cli/cli.go 0% <0%> (ø) ⬆️
daemon/mgr/container.go 5.21% <0%> (+0.1%) ⬆️
... and 3 more

@@ -28,3 +28,25 @@ func setupCgroupCPUSet(ctx context.Context, meta *ContainerMeta, spec *SpecWrapp
cpu.Mems = meta.HostConfig.CpusetMems
return nil
}

func setupCgroupCPUPeriod(ctx context.Context, meta *ContainerMeta, spec *SpecWrapper) error {
Copy link
Contributor

Choose a reason for hiding this comment

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

as I said in #1031, this kind of spec implement not very good, like this fucntion, if s.Linux.Resources.CPU == nil has been judged twice here, or maybe more times in other function.
These commit has no related with this pr.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Thanks a lot for your comment. I totally agree with you. Spec related construction needs refactoring.

@Ace-Tang
Copy link
Contributor

Ace-Tang commented Apr 8, 2018

LGTM

@pouchrobot pouchrobot added the LGTM one maintainer or community participant agrees to merge the pull reuqest. label Apr 8, 2018
@allencloud allencloud merged commit ea8a704 into AliyunContainerService:master Apr 8, 2018
@allencloud allencloud deleted the add-cpu-options branch April 8, 2018 12:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/feature LGTM one maintainer or community participant agrees to merge the pull reuqest. size/XL
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[feature required] pouch should support cpu-period and cpu-quota
5 participants