-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Conversation
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.
Ember Test Audit comparison
|
// 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' |
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.
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.
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.
With #16743 we can finally start doing that sort of thing. But almost none of the API uses it yet.
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 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.
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