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

cli: forward request for job validation to nomad leader #14065

Merged
merged 1 commit into from
Aug 10, 2022

Conversation

shoenig
Copy link
Member

@shoenig shoenig commented Aug 9, 2022

This PR changes the behavior of 'nomad job validate' to forward the
request to the nomad leader, rather than responding from any server.

This is because we need the leader when validating Vault tokens, since
the leader is the only server with an active vault client.

Closes #13940

Copy link
Contributor

@lgfa29 lgfa29 left a comment

Choose a reason for hiding this comment

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

LGTM! I think the issue number in the PR message is wrong, it seems like it was supposed to be #13940.

This paragraph in docs could use some updating as well, I don't think that is even true anymore? 😅

func (j *Job) Validate(args *structs.JobValidateRequest, reply *structs.JobValidateResponse) error {
if done, err := j.srv.forward("Job.Validate", args, args, reply); done {
return err
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't think request allows for stale right? But if we would were to allow validation without forwarding (like a local check) we could downgrade Vault validation errors to warnings. But since (I think?) stale requests are not allowed here we're probably good as it is.

Copy link
Member Author

Choose a reason for hiding this comment

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

Nope! The JobValidateRequest rpc embeds a WriteRequest, which has no notion of stale

This PR changes the behavior of 'nomad job validate' to forward the
request to the nomad leader, rather than responding from any server.

This is because we need the leader when validating Vault tokens, since
the leader is the only server with an active vault client.
@github-actions
Copy link

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 Dec 16, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
backport/1.3.x backport to 1.3.x release line
Projects
None yet
Development

Successfully merging this pull request may close these issues.

cli commands not forwarding to leader node for VAULT_TOKEN validation
2 participants