-
Notifications
You must be signed in to change notification settings - Fork 4.5k
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
Allow service deregistration with node write permission #5217
Allow service deregistration with node write permission #5217
Conversation
5cc4ab6
to
9a4ae88
Compare
It make sense because as long as the user has the ACL to leave the cluster (which effectively remove all services of agent), it should have the rights to remove services the agent is "owning". Having the right on the agent being the correct right to leave, it sounds like a reasonable patch to me. |
9a4ae88
to
9be4c24
Compare
We saw this problem again today : several service instances were registered in the catalog while the agent they were registered on before was trying to deregister them without success (since it had no token with permissions to do so) becode the node had been reinstalled. |
Could someone have a look to this PR? |
Any update on this ? |
9be4c24
to
0b906d4
Compare
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.
Thanks for your work, I left some comments.
@@ -727,7 +727,7 @@ service "service" { | |||
err = msgpackrpc.CallWithCodec(codec, "Catalog.Deregister", | |||
&structs.DeregisterRequest{ | |||
Datacenter: "dc1", | |||
Node: "node", | |||
Node: "nope", |
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.
Why did this file change?
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 the previous behavior this call (write access on node but not on service) would fail. It now succeeds if the token has write access on the node, which is the case here, so I changed the test to target a node the token does not has write access to.
With ACLs enabled if an agent is wiped and restarted without a leave it can no longer deregister the services it had previously registered because it no longer has the tokens the services were registered with. To remedy that we allow service deregistration from tokens with node write permission.
0b906d4
to
ff4150d
Compare
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.
This looks good! Left a tiny comment, something we just noticed.
If you don't get to it, I will make the change so that we can include your PR in the release that we are hopefully cutting tomorrow.
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.
Thank you!
@i0rek 🥇 Thank you so much, this will really help on large infrastructures! (That's actually one of our last pain points) |
We are closing the gap! 🙏 |
@i0rek thx (: |
|
Fixes: #5209
With ACLs enabled if an agent is wiped and restarted without a leave
it can no longer deregister the services it had previously registered
because it no longer has the tokens the services were registered with.
To remedy that we allow service deregistration from tokens with node
write permission.