-
Notifications
You must be signed in to change notification settings - Fork 32
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
Add CONSUL_DATACENTER_NAME env #46
Merged
jwreagor
merged 4 commits into
autopilotpattern:master
from
tjcelaya:enhancement/23-data-center-name-in-config-file
Dec 15, 2017
Merged
Changes from 2 commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like configuring via environment variable, I think it makes sense here. Do we even need to do anything with metadata mentioned in #23?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The environment variable make it straightforward to manually set the datacenter and makes testing and iteration easier, but it doesn't incorporate the automatic datacenter detection that seems to be described in #23.
I can address that part of #23 if we can decide on how it would be triggered compared to the method implemented in this PR for manual DC specification.
Options seem to include:
CONSUL_DATACENTER_NAME=*AGREED UPON STATIC VALUE*
is checked specifically inpreStart
and triggers a metadata check if it matches. Anything but the static value would be assumed to be a manually-specified DCCONSUL_DATACENTER_AUTODETECT=triton
would invoke triton-specific attempts to discover the current datacenter and allow for future implementations for other cloud providersCONSUL_DATACENTER_AUTODETECT=1
would attempt to check different methods of discovering the current datacenter, though involve more "magic" (i.e. brittle or potentially-unexpected behavior)CONSUL_DATACENTER_AUTODETECT_TRITON=1
would invoke triton-specific attempts to discover the current datacenter, establishing the pattern for other providers to user their own envsThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree, and the env var satisfies non-Triton use cases. I wasn't entirely set on using metadata but we could marry the two ideas for convenience.
CONSUL_DATACENTER_NAME
to manually set/force the datacenter name./native/usr/sbin/mdata-get
then poll metadata forsdc:datacenter_name
.dc1
if none of the above conditions gave us a custom value.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Falling back to automatic detection seems like the best option for ease-of-use, great suggestion!
I'll include the steps taken in the
README
so users can see how it'll work without having to dig into the source.