Check controller_runtime_webhook_requests_total that always exists in both pods #456
+1
−1
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What type of PR is this?
/kind flake
/kind cleanup
What this PR does / why we need it
LWS runs 2 pods and one of them is elected as leader. So that reconciliation logic will only be running in the leader pod and the other will only accept webhook requests.
controller_runtime_reconcile_total
is the measurement of how many times reconciliation function is executed. As a result, if there isn't any leader changes between pods, leader pod's reconciliation is supposed to be always greater than 0 and the other one should always be equal to 0.That means this test should be flaky and it should fail when it gets the metrics from non-leader pod (although I couldn't find any such failures, maybe because at some point leader pod has changed?).
This PR switches to
controller_runtime_webhook_requests_total
metric to check for the presence.Service
resource should distribute the webhook traffic between 2 pods in round robin and it is guaranteed thatcontroller_runtime_webhook_requests_total
should exist in both of the pods unlike tocontroller_runtime_reconcile_total
.Does this PR introduce a user-facing change?