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
Fix aggregator_unavailable_apiservice gauge #96421
Fix aggregator_unavailable_apiservice gauge #96421
Conversation
Hi @dgrisonnet. Thanks for your PR. I'm waiting for a kubernetes member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
/assign @lavalamp |
/assign @deads2k |
/ok-to-test |
staging/src/k8s.io/kube-aggregator/pkg/controllers/status/metrics.go
Outdated
Show resolved
Hide resolved
staging/src/k8s.io/kube-aggregator/pkg/controllers/status/metrics.go
Outdated
Show resolved
Hide resolved
/assign @sttts |
staging/src/k8s.io/kube-aggregator/pkg/controllers/status/metrics.go
Outdated
Show resolved
Hide resolved
31e8bc4
to
635f691
Compare
@sttts I've updated this PR according to our previous discussions, can you please have another look at it? |
1a0a6b5
to
5c2cb0d
Compare
staging/src/k8s.io/kube-aggregator/pkg/controllers/status/metrics.go
Outdated
Show resolved
Hide resolved
staging/src/k8s.io/kube-aggregator/pkg/controllers/status/available_controller.go
Outdated
Show resolved
Hide resolved
staging/src/k8s.io/kube-aggregator/pkg/controllers/status/available_controller.go
Show resolved
Hide resolved
staging/src/k8s.io/kube-aggregator/pkg/controllers/status/available_controller.go
Show resolved
Hide resolved
When an apiservice is deleted, its relative aggregator_unavailable_apiservice metric remains with the value of the last availability observed. Hence, if an apiservice is deleted while being unavailable, the metric remains marked as unavailable. This presents some problems when alerting on unavailable apiservices as deleted apiservices might trigger the alert indefinitely. To solve this issue, the aggregator_unavailable_apiservice metric should only reflect the availability of existing apiservices. This is achievable by using a custom Collector instead of a GaugeVec and create throw-away metrics based on an apiservice lister output. With this approach, on deletion, the apiservice will not be listed anymore, resulting in its availability metric not being exposed. Signed-off-by: Damien Grisonnet <dgrisonn@redhat.com>
5c2cb0d
to
b525f9e
Compare
/lgtm |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: dgrisonnet, sttts The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
@dgrisonnet , does it makes sense to also cherry-pick this PR into release-1.17, release-1.18 and release-.1.19? |
@ialidzhikov, I am not too familiar with k/k backport process but I don't think it makes sense here. Even though the bug exists in past releases, it's a corner case with a fairly low impact so I don't think it is worth cherry-picking. |
This needs backports. |
…6421-upstream-release-1.18 Automated cherry pick of #96421: kube-aggregator: fix apiservice availability gauge
…6421-upstream-release-1.19 Automated cherry pick of #96421: kube-aggregator: fix apiservice availability gauge
What type of PR is this?
/kind bug
What this PR does / why we need it:
When an apiservice is deleted, its relative
aggregator_unavailable_apiservice
metric remains with the value of the last availability observed. Hence, if an apiservice is deleted while being unavailable, the metric remains marked as unavailable.This presents some issues when alerting on unavailable apiservices as deleted apiservices might trigger the alert indefinitely.
To solve this issue, the
aggregator_unavailable_apiservice
metric should only reflect the availability of existing apiservices.This is achievable by using a custom Collector instead of a GaugeVec and create throw-away metrics based on an apiservice lister output. With this approach, on deletion, the apiservice will not be listed anymore, resulting in its availability metric not being exposed.
Which issue(s) this PR fixes:
Fixes #92671
Special notes for your reviewer:
The alert that I previously mentioned is the
AggregatedAPIDown
alert from the kubernetes-mixin project: https://github.com/kubernetes-monitoring/kubernetes-mixin/blob/fe19e65e64183f4a54a4584c792608851f68a1e9/alerts/kube_apiserver.libsonnet#L88-L101In my opinion, this alert is correct and the problem lies into the
aggregator_unavailable_apiservice
metric which is why I opened this PR.Does this PR introduce a user-facing change?:
Additional documentation e.g., KEPs (Kubernetes Enhancement Proposals), usage docs, etc.:
/sig instrumentation