-
Notifications
You must be signed in to change notification settings - Fork 4.4k
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
Disabling Maintenance mode does not trigger an event #11330
Comments
And there we have it: Lines 3464 to 3483 in cc2abb7
Lines 3510 to 3517 in cc2abb7
We can clearly see that when disabling maintenance mode for a host RemoveCheck is called without changing the state.
|
I think just calling: a.State.UpdateCheck(checkID, api.HealthPassing, "") Before |
It may be worth verifying that the event is still triggered even if UpdateCheck and RemoveCheck are called in quick succession. (I'm unfamiliar with this part of the code, so I can't comment on whether I'd expect the event to fire still or not.) |
Though now that I look at it adding a test to verify the status was changed to Lines 3358 to 3362 in cc2abb7
I will have to do some kind of State dark magic to check that. In tests I changed before this was done using mock.NewNotify() :consul/agent/checks/check_test.go Lines 894 to 899 in cc2abb7
But not sure how that would work here. |
Yes, good point. I'll verify that on a some host from some test fleet in our infra. |
You might be onto something. I tried with just
But with addition of
I also tried Thanks for the tip. Though I'm still not sure how to change the tests to take this into account. |
As far as I can tell it's impossible to check what was the state of the check after it was removed. I thought I could get it after it was removed from Lines 78 to 80 in cc2abb7
Lines 334 to 338 in cc2abb7
But when I try to print checks after it has been removed: fmt.Printf("%v", a.State.AllChecks()) I get nothing:
|
Well, for now I made a PR without tests changed: #11332 Open to suggestions on how I can check for status change in a check that was removed. |
Without this update service using `consul watch` to monitor check changes will never see maintenance mode being disabled. Resolves: hashicorp#11330 Signed-off-by: Jakub Sokołowski <[email protected]>
Without this update service using `consul watch` to monitor check changes will never see maintenance mode being disabled. Resolves: hashicorp#11330 Signed-off-by: Jakub Sokołowski <[email protected]>
Without this update service using `consul watch` to monitor check changes will never see maintenance mode being disabled. Resolves: hashicorp#11330 Signed-off-by: Jakub Sokołowski <[email protected]>
Without this update service using `consul watch` to monitor check changes will never see maintenance mode being disabled. Resolves: hashicorp#11330 Signed-off-by: Jakub Sokołowski <[email protected]>
Without this update service using `consul watch` to monitor check changes will never see maintenance mode being disabled. Resolves: hashicorp#11330 Signed-off-by: Jakub Sokołowski <[email protected]>
Without this update service using `consul watch` to monitor check changes will never see maintenance mode being disabled. Resolves: hashicorp#11330 Signed-off-by: Jakub Sokołowski <[email protected]>
Without this update service using `consul watch` to monitor check changes will never see maintenance mode being disabled. Resolves: hashicorp#11330 Signed-off-by: Jakub Sokołowski <[email protected]>
Without this update service using `consul watch` to monitor check changes will never see maintenance mode being disabled. Resolves: hashicorp#11330 Signed-off-by: Jakub Sokołowski <[email protected]>
Without this update service using `consul watch` to monitor check changes will never see maintenance mode being disabled. Resolves: hashicorp#11330 Signed-off-by: Jakub Sokołowski <[email protected]>
Without this update service using `consul watch` to monitor check changes will never see maintenance mode being disabled. Resolves: hashicorp#11330 Signed-off-by: Jakub Sokołowski <[email protected]>
Without this update service using `consul watch` to monitor check changes will never see maintenance mode being disabled. Resolves: hashicorp#11330 Signed-off-by: Jakub Sokołowski <[email protected]>
Without this update service using `consul watch` to monitor check changes will never see maintenance mode being disabled. Resolves: hashicorp#11330 Signed-off-by: Jakub Sokołowski <[email protected]>
Without this update service using `consul watch` to monitor check changes will never see maintenance mode being disabled. Resolves: hashicorp#11330 Signed-off-by: Jakub Sokołowski <[email protected]>
Without this update service using `consul watch` to monitor check changes will never see maintenance mode being disabled. Resolves: hashicorp#11330 Signed-off-by: Jakub Sokołowski <[email protected]>
Without this update service using `consul watch` to monitor check changes will never see maintenance mode being disabled. Resolves: hashicorp#11330 Signed-off-by: Jakub Sokołowski <[email protected]>
Overview of the Issue
I was looking at disabling alerts in
consul-alerts
when host is in maintenance mode: AcalephStorage/consul-alerts#213And I found out that while
consul-alerts
does create an entry in the KV store for_node_maintenance
service check when maintenance mode is disabled, it does NOT update that entry once maintenance mode is disabled:So I tried running
consul watch
myself same as theconsul-alerts
service does and I found out that disabling maintenance mode does not trigger an event:I receive one event with
Status
set tocritical
, but no recovery topassing
, since the_node_maintenance
check is removed.For this reason
consul-alerts
never updates its stage of_node_maintenance
check.Reproduction Steps
1.10.1
consul watch -type checks cat
Operating system and Environment details
Ubuntu 20.04.3,
x86_64
The text was updated successfully, but these errors were encountered: