Skip to content
This repository has been archived by the owner on Dec 4, 2024. It is now read-only.

Use a separate HAProxy map file for mapping Marathon app IDs to backends #303

Merged
merged 9 commits into from
Sep 8, 2016

Conversation

JayH5
Copy link
Contributor

@JayH5 JayH5 commented Aug 31, 2016

This has a few (small) advantages:

  • The maps HAProxy loads are smaller
  • The maps are easier to read/make sense of
  • Slightly smaller/finer grained checks to see if config needs to be reloaded

@mesosphere-ci
Copy link

Can one of the admins verify this patch?

@JayH5
Copy link
Contributor Author

JayH5 commented Aug 31, 2016

I don't know if there's a tool that is used to regenerate the documentation?

@ajays20078
Copy link
Contributor

It is missing a API endpoint to fetch the app maps. (Lua module to fetch app maps, similar to this) and also documentation for the API endpoint.
https://github.com/mesosphere/marathon-lb#api-endpoints

@JayH5
Copy link
Contributor Author

JayH5 commented Sep 1, 2016

I noticed that, yes. It wouldn't be too hard for me to add something like a :9090/_haproxy_getappmap endpoint, but I wanted to be sure that that was something people needed or wanted?

@brndnmtthws
Copy link
Contributor

I think having the API endpoint is worthwhile. If someone plans to use this, I think there'd be an expectation that they'd be able to debug it somehow.

@brndnmtthws
Copy link
Contributor

test this please

* Generalize getvhostmap.lua to fetch other map files
* Write map files before main config file
* Edit temporary config file to include temporary map files so that
  new map files are validated
* Small refactor - generalize some functions that work with temp files
@JayH5
Copy link
Contributor Author

JayH5 commented Sep 7, 2016

Ready for review again. I've changed a few things:

  • Added the /_haproxy_getappmap endpoint by rewriting getvhostmap.lua to getmaps.lua. (Sorry this is such a re-write.. took a while to wrap my head around the Lua).
  • Reworked how HAProxy config is validated - before the config file was checked but with references to the old map files - now the temporary map files are written first and are set in the temp config before validation.
  • Ran build-docs.sh to regenerate LongHelp.md

If there are integration tests for this stuff I'm not sure how to run them? I built & ran my changes manually and the config works as expected and the endpoints to fetch the maps work.

@brndnmtthws
Copy link
Contributor

test this please

@brndnmtthws brndnmtthws merged commit 75d9b08 into d2iq-archive:master Sep 8, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants