Use consul-template if-statement to check if the listenstore is up #1980
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
We want a consul setting that we can use to shut down the listenstore
when we need to do maintenance.
We initially used a python if statement here, expecting to be able to
render the config file as
However this doesn't work when the service disappears from consul (for
example if we shut down the server). The config file ends up as
and our startup script (run-lb-command) fails because it finds the sentinel
SERVICEDOESNOTEXIST in the config and refuses to continue.
Instead, use a consul-template {{if}} to render this config depending on
the listenstore_up config item.
This usage duplicates the (printf / env ()) syntax used in our KEY
template as it's not possible to call a template inside an if statement
or a variable declaration
This requires an update to the consul settings for LB to switch to using a json boolean (true/false) instead of a string with a python True/False at the same time that we deploy this.