drain: Handle node drain when called using a node identity token. #27115
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.
When a Nomad client is configured with
leave_on_terminateorleave_on_interruptanddrain_on_shutdownand is asked to shutdown, it will make an RPC request toNode.UpdateDrain. When ACLs are enabled, this request is authenticated using the nodes authentication token which in 1.11 is the signed JWT.This RPC was not correctly handling requests made with a node identity token which meant nodes attempting to drain themselves were returned with permissions errors.
The change updates the RPC handler to correctly handle both secret IDs and JWT tokens. It must support both, so that mixed cluster client topologies can be handled. A new test was added to exercise identity calls to the RPC and the test suite updated to use a table, so failures are easier to find in the future.
Testing & Reproduction steps
Can be tested locally using a separate client and server processes; the client should have the following configuration options:
Links
closes #27104
jira https://hashicorp.atlassian.net/browse/NMD-1069
Contributor Checklist
changelog entry using the
make clcommand.ensure regressions will be caught.
and job configuration, please update the Nomad website documentation to reflect this. Refer to
the website README for docs guidelines. Please also consider whether the
change requires notes within the upgrade guide.
Reviewer Checklist
backporting document.
in the majority of situations. The main exceptions are long-lived feature branches or merges where
history should be preserved.
within the public repository.