Merge pull request #9683 from hashicorp/dnephin/fix-zombie-service-dereg

local: use agent token to deregister services
This commit is contained in:
Daniel Nephin 2021-02-19 18:56:40 -05:00 committed by GitHub
commit 8ec1b06f3a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 2 deletions

3
.changelog/9683.txt Normal file
View file

@ -0,0 +1,3 @@
```release-notes:improvement
client: when a client agent is attempting to dereigster a service, anddoes not have access to the ACL token used to register a service, attempt to use the agent token instead of the default user token. If no agent token is set, fall back to the default user token.
```

View file

@ -243,7 +243,7 @@ func (l *State) serviceToken(id structs.ServiceID) string {
token = s.Token token = s.Token
} }
if token == "" { if token == "" {
token = l.tokens.UserToken() token = l.tokens.AgentToken()
} }
return token return token
} }
@ -457,7 +457,7 @@ func (l *State) checkToken(id structs.CheckID) string {
token = c.Token token = c.Token
} }
if token == "" { if token == "" {
token = l.tokens.UserToken() token = l.tokens.AgentToken()
} }
return token return token
} }