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 memory option for container #511

Merged
merged 1 commit into from
Jan 8, 2018

Conversation

skoowoo
Copy link
Contributor

@skoowoo skoowoo commented Jan 5, 2018

Signed-off-by: skoo87 [email protected]

1.Describe what this PR did

include memory, memory-swap and memory-swappiness.

2.Does this pull request fix one issue?

3.Describe how you did it

4.Describe how to verify it

5.Special notes for reviews

@codecov-io
Copy link

codecov-io commented Jan 5, 2018

Codecov Report

Merging #511 into master will decrease coverage by 0.2%.
The diff coverage is 0%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #511      +/-   ##
==========================================
- Coverage   17.93%   17.72%   -0.21%     
==========================================
  Files          35       36       +1     
  Lines        1801     1822      +21     
==========================================
  Hits          323      323              
- Misses       1443     1464      +21     
  Partials       35       35
Impacted Files Coverage Δ
daemon/mgr/spec.go 0% <ø> (ø) ⬆️
daemon/mgr/spec_cgroup_memory.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 019edcd...f2522d2. Read the comment docs.

@allencloud allencloud added this to the v0.1-Milestone milestone Jan 5, 2018
@allencloud
Copy link
Collaborator

allencloud commented Jan 8, 2018

Could you help to add HostConfig in the response of API GET /containers/{id}/json? @skoo87
Since I got none about memory limit info in this API: https://github.com/alibaba/pouch/blob/master/apis/server/container_bridge.go#L253-L258:

root@ubuntu:~/go/src/github.com/alibaba/pouch# pouch run -d -m 50m registry.hub.docker.com/library/busybox:latest sleep 100000
dd61cc118217a6d48102a83d3ab8683e09f7e6990722728efbe366b315882792
root@ubuntu:~/go/src/github.com/alibaba/pouch# pouch inspect dd61cc118217a6d48102a83d3ab8683e09f7e6990722728efbe366b315882792
{
  "Args": null,
  "Config": {
    "Cmd": [
      "sleep",
      "100000"
    ],
    "Entrypoint": null,
    "Env": [
      "PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
    ],
    "Image": "registry.hub.docker.com/library/busybox:latest",
    "OnBuild": null,
    "Shell": null
  },
  "Created": "2018-01-08 07:02:10",
  "Id": "dd61cc118217a6d48102a83d3ab8683e09f7e6990722728efbe366b315882792",
  "Image": "registry.hub.docker.com/library/busybox:latest",
  "Mounts": null,
  "Name": "dd61cc",
  "State": {
    "Pid": 3328,
    "StartedAt": "2018-01-08 07:02:10",
    "Status": "running"
  }
}

@skoowoo
Copy link
Contributor Author

skoowoo commented Jan 8, 2018

updated @allencloud

@allencloud
Copy link
Collaborator

LGTM, tested on my local machine.Memory info is located in root@ubuntu:/sys/fs/cgroup/memory/default/183f84796b39898ed2a4fe7887a902332bf3a010ac65482749bae0d31f54f0f8# cat memory.limit_in_bytes 52428800 and hostconfig:

  "HostConfig": {
    "Runtime": "runc",
    "BlkioDeviceReadBps": null,
    "BlkioDeviceReadIOps": null,
    "BlkioDeviceWriteBps": null,
    "BlkioDeviceWriteIOps": null,
    "BlkioWeightDevice": null,
    "DeviceCgroupRules": null,
    "Devices": null,
    "Memory": 52428800,
    "MemorySwappiness": -1,
    "Ulimits": null

@pouchrobot pouchrobot added the LGTM one maintainer or community participant agrees to merge the pull reuqest. label Jan 8, 2018
@allencloud allencloud merged commit e924aed into AliyunContainerService:master Jan 8, 2018
@allencloud allencloud mentioned this pull request Jan 8, 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