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

Support custom fields in application definition #258

Open
kamaradclimber opened this issue Aug 27, 2018 · 1 comment
Open

Support custom fields in application definition #258

kamaradclimber opened this issue Aug 27, 2018 · 1 comment

Comments

@kamaradclimber
Copy link

Use case: our mesos+marathon deployment supports a resource called networkBandwidth to specify the amount of bandwidth usable by the container. Our marathon supports to specify networkBandwidth as any other resource but this is not part of the upstream api.

I'd like to know if you would consider a PR adding the ability to add extra fields in the json generated from MarathonApp instances.

Example:

MarathonApp(
  id='incubator/demo',
  cpus=1,
  mem=128,
  ...
  extra_fields: {
    "networkBandwidth": 1000
  }
)

The idea would be to support the injection of a dict with any field not present in the official api.

What do you think?

@kamaradclimber
Copy link
Author

Thanks to the way the MarathonApp is built (deriving from MarathonObject), we can actually do:

app = MarathonApp(id='/incubator/demo')
app.networkBandwidth = 1000

and the resulting json will contain that field.

Considering it works because the internals uses vars (https://github.com/thefactory/marathon-python/blob/master/marathon/models/base.py#L33), would you recommend to use this technique or would you have a better advice?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant