mirror of
https://github.com/status-im/consul.git
synced 2025-03-03 14:50:50 +00:00
update maintenance check to passing before removing
Without this update service using `consul watch` to monitor check changes will never see maintenance mode being disabled. Resolves: https://github.com/hashicorp/consul/issues/11330 Signed-off-by: Jakub Sokołowski <jakub@status.im>
This commit is contained in:
parent
00d74abc4a
commit
c113fd6b6f
3
.changelog/11332.txt
Normal file
3
.changelog/11332.txt
Normal file
@ -0,0 +1,3 @@
|
||||
```release-note:bug
|
||||
agent: update maintenance check to passing before removing
|
||||
```
|
@ -4109,6 +4109,10 @@ func (a *Agent) DisableServiceMaintenance(serviceID structs.ServiceID) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// Update check to trigger an event for watchers
|
||||
a.State.UpdateCheck(checkID, api.HealthPassing, "")
|
||||
// Make sure state change is propagated
|
||||
a.State.SyncChanges()
|
||||
// Deregister the maintenance check
|
||||
a.RemoveCheck(checkID, true)
|
||||
a.logger.Info("Service left maintenance mode", "service", serviceID.String())
|
||||
@ -4146,6 +4150,10 @@ func (a *Agent) DisableNodeMaintenance() {
|
||||
if a.State.Check(structs.NodeMaintCheckID) == nil {
|
||||
return
|
||||
}
|
||||
// Update check to trigger an event for watchers
|
||||
a.State.UpdateCheck(structs.NodeMaintCheckID, api.HealthPassing, "")
|
||||
// Make sure state change is propagated
|
||||
a.State.SyncChanges()
|
||||
a.RemoveCheck(structs.NodeMaintCheckID, true)
|
||||
a.logger.Info("Node left maintenance mode")
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user