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

Add regions endpoint #495

Merged
merged 7 commits into from
Nov 24, 2015
Merged

Add regions endpoint #495

merged 7 commits into from
Nov 24, 2015

Conversation

ryanuber
Copy link
Member

This adds an API call for fetching the list of regions known to Nomad. It also returns a list of the datacenter names nested under each. Related: #243

defer s.peerLock.RUnlock()

regions := make(map[string][]string, len(s.peers))
for region, servers := range s.peers {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

With this implementation, we will get only the regions where the Nomad servers are present. Users might expect the API to return the entire list of regions where the Nomad cluster spans. We might need to change the name of the API or document it to make sure people understand the purpose of the API.

if err := msgpackrpc.CallWithCodec(codec, "Region.List", &arg, &out); err != nil {
t.Fatalf("err: %v", err)
}
if len(out) != 2 || out[0] != "region1" || out[1] != "region2" {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this going to be flaky? Is there any guarantee on order?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good call, tests didn't indicate anything but a quick sort.Strings() should fix this up.

@dadgar
Copy link
Contributor

dadgar commented Nov 24, 2015

LGTM

ryanuber added a commit that referenced this pull request Nov 24, 2015
@ryanuber ryanuber merged commit a96315f into master Nov 24, 2015
@ryanuber ryanuber deleted the f-regions branch November 24, 2015 21:21
@github-actions
Copy link

github-actions bot commented May 2, 2023

I'm going to lock this pull request because it has been closed for 120 days ⏳. This helps our maintainers find and focus on the active contributions.
If you have found a problem that seems related to this change, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 2, 2023
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.

None yet

3 participants