micahhausler / container-transform

Transforms docker-compose, ECS, and Marathon configurations
MIT License
1.41k stars 148 forks source link

Doesn't support soft memory limition (memory reversation) or docker compose V3 #68

Open minzhang28 opened 7 years ago

minzhang28 commented 7 years ago

currently this project only supports docker compose v2 and doesn't tallow us to specify the soft memory limitation.

suggestion: adding supports to docker compose file v3 resource section, which supports both hard and soft limitation

resources:
  limits:
    cpus: '0.001'
    memory: 50M
  reservations:
    cpus: '0.0001'
    memory: 20M
youcandanch commented 7 years ago

For what it's worth, compose v2 backported memory reservation, which ends up looking like:

version: '2'
services:
  memcached:
    image: memcached
    mem_limit: 128m
    mem_reservation: 64m
youcandanch commented 7 years ago

I'd be happy to take a stab at this but probably won't get to it for a few weeks, if someone else has the time. I only really work with Compose/ECS, so I'm not 100% sure what the comparables are in K8/Marathon/Chronos/systemd either, but I'm sure I can kinda muck through it.

micahhausler commented 7 years ago

@antinescience that'd be great if you have time to work on it. I haven't had time to do much OSS lately, but I know k8s has has limits/requests

liorchen commented 7 years ago

any update on this? I'm also waiting for this feature

geemorin commented 7 years ago

Seems there is a pull request for it only its failing on test coverage percentage threshold.

Moreover, i think the compose transformer supports v1 and v2 but outputs only version: '2'. Should it be splitted in 3 different transformers to ouput v1 v2 and v3 outputs?

mhglover commented 7 years ago

@liorchen took a crack at memory reservation and has a pull request in, but it's failing a couple of tests. If I get a chance, I'll see if I can address those, but I wanted to bring them up here in case somebody else can get to them first. Here's an example:

cat container_transform/tests/marathon-group.json | container-transform --input-type marathon --output-type compose | tail -18 | head -9
prometheus:
  cpu_shares: 512.0
  image: micahhausler/prometheus-mesos
  mem_limit: 134217728b
  mem_reservation: '[{''uri'': ''https://gist.githubusercontent.com/you/hash/raw/hash/config.yml'',
    ''extract'': False, ''executable'': False, ''cache'': False}]b'
  network_mode: bridge
  ports:
  - 9090:9090