container-transform icon indicating copy to clipboard operation
container-transform copied to clipboard

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

Open minzhang28 opened this issue 7 years ago • 6 comments

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

minzhang28 avatar Mar 02 '17 23:03 minzhang28

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 avatar Mar 21 '17 02:03 youcandanch

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.

youcandanch avatar Mar 21 '17 02:03 youcandanch

@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

micahhausler avatar Mar 31 '17 18:03 micahhausler

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

liorchen avatar May 03 '17 13:05 liorchen

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?

geemorin avatar Jun 03 '17 13:06 geemorin

@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

mhglover avatar Sep 21 '17 15:09 mhglover