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

ui: handle node pool requests to older regions #18021

Merged
merged 2 commits into from
Jul 21, 2023

Conversation

lgfa29
Copy link
Contributor

@lgfa29 lgfa29 commented Jul 20, 2023

When accessing a region running a version of Nomad without node pools an error was thrown because the request is handled by the nodes endpoint which fails because it assumes pools is the node ID.

Fixes #18007

When accessing a region running a version of Nomad without node pools an
error was thrown because the request is handled by the nodes endpoint
which fails because it assumes `pools` is the node ID.
@github-actions
Copy link

github-actions bot commented Jul 20, 2023

Ember Test Audit comparison

main e4df47f change
passes 1498 1498 0
failures 1 1 0
flaky 0 0 0
duration 000ms 000ms -000ms

@lgfa29 lgfa29 added this to the 1.6.x milestone Jul 20, 2023
// doesn't have node pools and the request is handled by the nodes
// endpoint.
const isNodeRequest = error.message.includes(
'node lookup failed: index error: UUID must be 36 characters'
Copy link
Contributor

Choose a reason for hiding this comment

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

Note: pretty specific and therefore fragile in the future! If we have an option to look for a particular status code, I'd opt for that. Guessing not the case here, though.

Copy link
Member

@tgross tgross Jul 21, 2023

Choose a reason for hiding this comment

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

With #16743 we can finally start doing that sort of thing. But almost none of the API uses it yet.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I should have noted this somewhere (either in code or the PR comment), but this line is to protect against old releases, so there's no chance to break in the future (unless we really want to 😬) since this message is baked in the binaries.

To better explain why this check is needed, imagine you use the 1.6.x UI code to access a cluster running Nomad 1.5.x. The 1.6.x UI code will make a request for GET /v1/node/pools, which the 1.5.x server interprets as a read for the node with ID pools, resulting in this error message.

We can change the logic for the next 1.5.x release (1.5.9 at the time of this writing), but we will still need to check for this specific error message to support any versions before that. I also used the exact error message to prevent false positives.

The other important part is that, in practice, this won't happen in a real cluster until we allow running a stand-alone UI. In a real federated cluster, accessing a region running Nomad 1.6.x from the UI of a Nomad 1.5.x region will result in the error handled in #18020 because the request is forwarded via RPCs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport/1.6.x backport to 1.6.x release line
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Panic on job plan with Nomad 1.6.0
3 participants