Fix external-prometheus integration test flakyness#6575
Merged
Conversation
Another attempt at fixing #6511 Even after #6524, we continued experiencing discrepancies on the linkerd-edges integration test. The problem ended up being the external prometheus instance not being injected. The injector logs revealed this: ```console 2021-07-29T13:57:10.2497460Z time="2021-07-29T13:54:15Z" level=info msg="caches synced" 2021-07-29T13:57:10.2498191Z time="2021-07-29T13:54:15Z" level=info msg="starting admin server on :9995" 2021-07-29T13:57:10.2498935Z time="2021-07-29T13:54:15Z" level=info msg="listening at :8443" 2021-07-29T13:57:10.2499945Z time="2021-07-29T13:54:18Z" level=info msg="received admission review request 2b7b4970-db40-4bda-895b-bb2e95e98265" 2021-07-29T13:57:10.2511751Z time="2021-07-29T13:54:18Z" level=debug msg="admission request: &AdmissionRequest{UID:2b7b4970-db40-4bda-895b-bb2e95e98265,Kind:/v1, Kind=Service,Resource:{ v1 services},SubResource:,Name:metrics-api,Namespace:linkerd-viz... ``` Usually one expects the webhook server to start first ("listening at :8443") and then the admin server, but in this case it happened the other way around. The admin server serves the readiness probe, so k8s was signaled that the injector was ready before it could listen to webhook requests, and given the WebhookFailurePolicy is Ignore by default, sometimes this was causing for the prometheus pod creation event to get missed, and we see in the log above that it starts by processing the pods that are created afterwards, which are the viz ones. In this fix we start first the webhook server, then block on the syncing of the k8s API, which should give enough time for the webhook to be up, and finally we start the admin server.
Codecov Report
@@ Coverage Diff @@
## main #6575 +/- ##
=======================================
Coverage 44.86% 44.86%
=======================================
Files 182 182
Lines 23866 23866
Branches 290 290
=======================================
Hits 10707 10707
Misses 12407 12407
Partials 752 752
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
olix0r
approved these changes
Jul 29, 2021
sannimichaelse
pushed a commit
to sannimichaelse/linkerd2
that referenced
this pull request
Aug 1, 2021
Another attempt at fixing linkerd#6511 Even after linkerd#6524, we continued experiencing discrepancies on the linkerd-edges integration test. The problem ended up being the external prometheus instance not being injected. The injector logs revealed this: ```console 2021-07-29T13:57:10.2497460Z time="2021-07-29T13:54:15Z" level=info msg="caches synced" 2021-07-29T13:57:10.2498191Z time="2021-07-29T13:54:15Z" level=info msg="starting admin server on :9995" 2021-07-29T13:57:10.2498935Z time="2021-07-29T13:54:15Z" level=info msg="listening at :8443" 2021-07-29T13:57:10.2499945Z time="2021-07-29T13:54:18Z" level=info msg="received admission review request 2b7b4970-db40-4bda-895b-bb2e95e98265" 2021-07-29T13:57:10.2511751Z time="2021-07-29T13:54:18Z" level=debug msg="admission request: &AdmissionRequest{UID:2b7b4970-db40-4bda-895b-bb2e95e98265,Kind:/v1, Kind=Service,Resource:{ v1 services},SubResource:,Name:metrics-api,Namespace:linkerd-viz... ``` Usually one expects the webhook server to start first ("listening at :8443") and then the admin server, but in this case it happened the other way around. The admin server serves the readiness probe, so k8s was signaled that the injector was ready before it could listen to webhook requests, and given the WebhookFailurePolicy is Ignore by default, sometimes this was causing for the prometheus pod creation event to get missed, and we see in the log above that it starts by processing the pods that are created afterwards, which are the viz ones. In this fix we start first the webhook server, then block on the syncing of the k8s API, which should give enough time for the webhook to be up, and finally we start the admin server.
sannimichaelse
pushed a commit
to sannimichaelse/linkerd2
that referenced
this pull request
Aug 13, 2021
Another attempt at fixing linkerd#6511 Even after linkerd#6524, we continued experiencing discrepancies on the linkerd-edges integration test. The problem ended up being the external prometheus instance not being injected. The injector logs revealed this: ```console 2021-07-29T13:57:10.2497460Z time="2021-07-29T13:54:15Z" level=info msg="caches synced" 2021-07-29T13:57:10.2498191Z time="2021-07-29T13:54:15Z" level=info msg="starting admin server on :9995" 2021-07-29T13:57:10.2498935Z time="2021-07-29T13:54:15Z" level=info msg="listening at :8443" 2021-07-29T13:57:10.2499945Z time="2021-07-29T13:54:18Z" level=info msg="received admission review request 2b7b4970-db40-4bda-895b-bb2e95e98265" 2021-07-29T13:57:10.2511751Z time="2021-07-29T13:54:18Z" level=debug msg="admission request: &AdmissionRequest{UID:2b7b4970-db40-4bda-895b-bb2e95e98265,Kind:/v1, Kind=Service,Resource:{ v1 services},SubResource:,Name:metrics-api,Namespace:linkerd-viz... ``` Usually one expects the webhook server to start first ("listening at :8443") and then the admin server, but in this case it happened the other way around. The admin server serves the readiness probe, so k8s was signaled that the injector was ready before it could listen to webhook requests, and given the WebhookFailurePolicy is Ignore by default, sometimes this was causing for the prometheus pod creation event to get missed, and we see in the log above that it starts by processing the pods that are created afterwards, which are the viz ones. In this fix we start first the webhook server, then block on the syncing of the k8s API, which should give enough time for the webhook to be up, and finally we start the admin server. Signed-off-by: Sanni Michael <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Another attempt at fixing #6511
Even after #6524, we continued experiencing discrepancies on the
linkerd-edges integration test. The problem ended up being the external
prometheus instance not being injected. The injector logs revealed this:
Usually one expects the webhook server to start first ("listening at
:8443") and then the admin server, but in this case it happened the
other way around. The admin server serves the readiness probe, so k8s
was signaled that the injector was ready before it could listen to
webhook requests, and given the WebhookFailurePolicy is Ignore by
default, sometimes this was causing for the prometheus pod creation
event to get missed, and we see in the log above that it starts by
processing the pods that are created afterwards, which are the viz ones.
In this fix we start first the webhook server, then block on the syncing
of the k8s API, which should give enough time for the webhook to be up,
and finally we start the admin server.