Skip to content

Conversation

@Ace-Tang
Copy link
Contributor

Ⅰ. Describe what this PR did

add oom-score-adj and oom-kill-disable flag

Ⅱ. Does this pull request fix one issue?

Ⅲ. Describe how you did it

Ⅳ. Describe how to verify it

Ⅴ. Special notes for reviews

@codecov-io
Copy link

codecov-io commented Mar 21, 2018

Codecov Report

Merging #934 into master will decrease coverage by 0.03%.
The diff coverage is 0%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #934      +/-   ##
==========================================
- Coverage   13.12%   13.09%   -0.04%     
==========================================
  Files         123      123              
  Lines        8197     8219      +22     
==========================================
  Hits         1076     1076              
- Misses       7025     7047      +22     
  Partials       96       96
Impacted Files Coverage Δ
daemon/mgr/spec.go 0% <ø> (ø) ⬆️
daemon/mgr/spec_process.go 0% <0%> (ø) ⬆️
cli/container.go 36.78% <0%> (-1.17%) ⬇️
daemon/mgr/spec_cgroup_memory.go 0% <0%> (ø) ⬆️
cli/common_flags.go 0% <0%> (ø) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 359ad41...cf8b036. Read the comment docs.


resp, err := request.Post("/containers/create", query, body)
c.Assert(err, check.IsNil)
CheckRespStatus(c, resp, 201)
Copy link
Collaborator

Choose a reason for hiding this comment

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

It tested that the container creation works. Please test further to check if the ContainerMeta contains this field with the inspect API.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

this will be test in test/cli_create_test.go

c.Errorf("failed to decode inspect output: %v", err)
}
c.Assert(*result.HostConfig.OomScoreAdj, check.Equals, int64(100))
c.Assert(*result.HostConfig.OomKillDisable, check.Equals, true)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Can we tested an oom container with some way? For example, create a container with less memory, but the application in the container needs more memory than the limit.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

maybe it hard to write test like this in ci test.

cli/container.go Outdated
}

// validate oom score
func validOOMScore(score int64) error {
Copy link
Collaborator

Choose a reason for hiding this comment

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

s/validOOMScore/validateOOMScore?

apis/swagger.yml Outdated
The range is in [-1000, 1000].
type: "integer"
format: "int"
x-nullable: true
Copy link
Collaborator

Choose a reason for hiding this comment

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

I do not think this should be x-nullable: true, since it would be a little bit incompatible with moby 1.12.6's API.

See https://github.com/moby/moby/blob/v1.12.6/vendor/src/github.com/docker/engine-api/types/container/host_config.go#L300

So it should be x-nullable: false

@Ace-Tang
Copy link
Contributor Author

@allencloud , updated.

Signed-off-by: Ace-Tang <[email protected]>
@allencloud
Copy link
Collaborator

LGTM

@pouchrobot pouchrobot added the LGTM one maintainer or community participant agrees to merge the pull reuqest. label Mar 23, 2018
@allencloud allencloud merged commit 998e8d2 into AliyunContainerService:master Mar 23, 2018
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/L

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants