QubitProducts / bamboo

HAProxy auto configuration and auto service discovery for Mesos Marathon
Apache License 2.0
794 stars 215 forks source link

Add MesosDnsId field to Marathon App struct #205

Closed porcupie closed 8 years ago

porcupie commented 8 years ago

Hello,

I added an additional string field MesosDnsId to marathon App struct. Marathon AppId Groups are reversed and appended with hyphens to create a DNS friendly name, similar to how Mesos DNS, Consul and some other tools operate.

Not sure if this is useful or the most efficient go, but I could not figure out how to do this simple string munging within the haproxy template file itself, so I resorted to adding a field to the Marathon App struct. Perhaps there is a better way but I wanted to draft this Pull Request in case others had a similar need.

Example: Marathon App ID: "/sample/group/appname" becomes "appname-group-sample" in mesos dns so I can refer to this field as $app.MesosDnsId inside the haproxy template to write ACL rules like hdr_dom(host) -i {{ $app.MesosDnsId }}.

I will make any other changes needed.

Idea came from a coworker Michael Kuriger.

swagatha-christie commented 8 years ago

By analyzing the blame information on this pull request, we identified @bluepeppers, @activars and @rasputnik to be potential reviewers

coveralls commented 8 years ago

Coverage Status

Coverage increased (+2.6%) to 38.448% when pulling cef6f49bf41991d95818acc0dd9aaf0422d5d797 on porcupie:master into 01da91b0530ac0a7d2ca4fb4af79e161c25753ea on QubitProducts:master.

coveralls commented 8 years ago

Coverage Status

Coverage increased (+4.3%) to 40.18% when pulling d825591625d6e31ab4f440cc52a0c834c7dc81ab on porcupie:master into 01da91b0530ac0a7d2ca4fb4af79e161c25753ea on QubitProducts:master.

lclarkmichalek commented 8 years ago

Looks good - thanks for adding tests. I'm thinking it might be worth documenting this somewhere? Maybe in the readme?

j1n6 commented 8 years ago

👍

porcupie commented 8 years ago

Thanks for taking a look @activars, @bluepeppers . Added some notes to README but was not sure exactly where to put it. Let me know if you'd like more/less information or edits.

coveralls commented 8 years ago

Coverage Status

Coverage increased (+4.3%) to 40.18% when pulling 8b0f970575340f2418b39563f570187b162888a3 on porcupie:master into 01da91b0530ac0a7d2ca4fb4af79e161c25753ea on QubitProducts:master.

j1n6 commented 8 years ago

@porcupie thank you.