eBayClassifiedsGroup / marathon_deploy

Pushes a yaml or json file to the Marathon API
MIT License
42 stars 14 forks source link

Add concatenation of templates #2

Closed sielaq closed 8 years ago

sielaq commented 9 years ago

It would be another nice feature of default.yaml
(which also supports macros). Enabled by additional option like --concatenate - multiple times, like --concatenate a.yaml --concatenate b.yaml ....

It would contains common stuff for all like:

healthChecks:
- portIndex: 0
  protocol: TCP
  timeoutSeconds: 30
  intervalSeconds: 10
  gracePeriodSeconds: 30
  maxConsecutiveFailures: 3
- portIndex: 0
  protocol: HTTP
  timeoutSeconds: 30
  intervalSeconds: 10
  gracePeriodSeconds: 30
  maxConsecutiveFailures: 3
  path: /%%SERVICE_NAME%%/health/ping

and it will be concatenated with deploy.yaml - with smart way - if some components already exist in deploy.yaml - then cover the default.yaml

Open question is how "smart" should it be in case of common components, for ex.: default.yaml:

container:
  docker:
    network: BRIDGE
  type: DOCKER

deploy.yaml:

container:
  docker:
    image: foo/bar

A.Should whole container be replaced ? or B Should be merged ?

In the end it would be awesome to have concatenation with multiple yaml files

joncolby commented 9 years ago

I like this idea. To handle duplicate definitions, how about merging (with warning output)? So files which are concatenated override for attributes which must be unique (like container), but things like healthChecks will just be added.