Skip to content

Commit

Permalink
check: fixes updates for checks in namespaces (#259)
Browse files Browse the repository at this point in the history
/v1/health/node/:node will not return checks in all namespaces by
default, therefore we were incorrectly returning early from
handleUpdateCheck if the check we were looking for was associated
to a service in a different namespace from our Consul token.
  • Loading branch information
t-davies authored May 6, 2024
1 parent 4180027 commit 4ae7b11
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion check.go
Original file line number Diff line number Diff line change
Expand Up @@ -417,7 +417,10 @@ func (c *CheckRunner) UpdateCheck(checkID structs.CheckID, status, output string
func (c *CheckRunner) handleCheckUpdate(check *api.HealthCheck, status, output string) {
// Exit early if the check or node have been deregistered.
// consistent mode reduces convergency time particularly when services have many updates in a short time
checks, _, err := c.client.Health().Node(check.Node, &api.QueryOptions{RequireConsistent: true})
checks, _, err := c.client.Health().Node(check.Node, &api.QueryOptions{
Namespace: check.Namespace,
RequireConsistent: true,
})
if err != nil {
c.logger.Warn("error retrieving existing node entry", "error", err)
return
Expand Down

0 comments on commit 4ae7b11

Please sign in to comment.