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

consul: handle "not found" errors from Consul when deleting tokens #17847

Merged
merged 1 commit into from Jul 7, 2023

Conversation

tgross
Copy link
Member

@tgross tgross commented Jul 7, 2023

In Consul 1.15.0, the Delete Token API was changed so as to return an error when deleting a non-existent ACL token. This means that if Nomad successfully deletes the token but fails to persist that fact, it will get stuck trying to delete a non-existent token forever.

Update the token deletion function to ignore "not found" errors and treat them as successful deletions.

Fixes: #17833
Source for text of error (there's no const in the api package for it): https://github.com/hashicorp/consul/blob/api/v1.22.0/agent/acl_endpoint.go#L470

tgross added a commit that referenced this pull request Jul 7, 2023
In Consul 1.15.0, the Delete Token API was changed so as to return an error when
deleting a non-existent ACL token. This means that if Nomad successfully deletes
the token but fails to persist that fact, it will get stuck trying to delete a
non-existent token forever.

Update the token deletion function to ignore "not found" errors and treat them
as successful deletions.

Fixes: #17847
@tgross tgross force-pushed the consul-token-delete-api branch 2 times, most recently from b19d0a5 to 81deb09 Compare July 7, 2023 19:52
@tgross tgross added this to the 1.6.0 milestone Jul 7, 2023
@tgross tgross marked this pull request as ready for review July 7, 2023 19:53
@tgross tgross requested review from shoenig and jrasell July 7, 2023 19:53
In Consul 1.15.0, the Delete Token API was changed so as to return an error when
deleting a non-existent ACL token. This means that if Nomad successfully deletes
the token but fails to persist that fact, it will get stuck trying to delete a
non-existent token forever.

Update the token deletion function to ignore "not found" errors and treat them
as successful deletions.

Fixes: #17833
Copy link
Member

@shoenig shoenig left a comment

Choose a reason for hiding this comment

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

LGTM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport/1.3.x backport to 1.3.x release line backport/1.4.x backport to 1.4.x release line backport/1.5.x backport to 1.5.x release line theme/consul type/bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Nomad retries indefinitely to revoke non-existant SI token(s)
2 participants