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

Merge apps by label #38

Merged
merged 2 commits into from
Jul 1, 2019
Merged

Conversation

messiaen
Copy link
Contributor

In our system we have several thrift services, which have a cpu and gpu implementation. This means we need to deploy and app for the cpu implementation and another app for the gpu implementation. We would like that fact to be hidden from clients (i.e. be able to access the cpu and gpu implementations of a service at the same address).

For example if we have the following apps running in mesos/marathon, which both implement the same api

my-service-cpu
my-service-gpu

We would like for clients to be able to access both implementations at the same address (e.g nixy.marathon.mesos:12345)

Our solution was to specify a service name (e.g. my-service) via a label, and then add a method to the Config struct (MergeAppsByLabel(label)) which merges apps based on the given label. The idea is that users could call that method in their templates instead of just .Apps so that the different implementations could all have a single upstream definition.

- This allows for example, multiple implementations of a
  service to be accessed using the same address even though they are
  running as different apps within mesos/marathon.
- Users specify a label which can be used as the service name
  across multiple apps, and then call MergeAppsByLabel within their
  template.
- When the apps are merged Labels from each original app are added
  to each Task from that original app. This is necessary if you want
  to have implementation specific labels.  For example, if one
  implementation is faster, we could route more traffic there.

    - This allows for example, multiple implementations of a
      service to be accessed using the same address even though they are
      running as different apps within mesos/marathon.
    - Users specify a label which can be used as the service name
      across multiple apps, and then call MergeAppsByLabel within their
      template.
    - When the apps are merged Labels from each original app are added
      to each Task from that original app. This is necessary if you want
      to have implementation specific labels.  For example, if one
      implementation is faster, we could route more traffic there.
@martensson
Copy link
Owner

Hi @messiaen! Thanks for the added feature, its an interesting case you got there. Could you please also add the "MergeAppsByLabel" to the documentation (README) so others might know/find how to use it? Will then merge with no problem!

@messiaen
Copy link
Contributor Author

@martensson Great! I added some docs to the README, and added and example nginx template.

@martensson martensson merged commit 854e4cb into martensson:master Jul 1, 2019
@martensson
Copy link
Owner

Thanks for the doc and example config @messiaen! 😄

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

Successfully merging this pull request may close these issues.

2 participants