kubernetes-sigs / usage-metrics-collector

High fidelity and scalable capacity and usage metrics for Kubernetes clusters
Apache License 2.0
118 stars 20 forks source link

metrics-prometheus-collector: Add leases to ClusterRole #25

Closed mrueg closed 1 year ago

mrueg commented 1 year ago

metrics-prometheus-collector requires access to leases API for leadership election.

E0126 13:26:43.567658       1 leaderelection.go:367] Failed to update lock: leases.coordination.k8s.io "capacity-metrics-prometheus-collector-lock" is forbidden: User "system:serviceaccount:usage-metrics-collector:metrics-prometheus-collector" cannot update resource "leases" in API group "coordination.k8s.io" in the namespace "usage-metrics-collector"
k8s-ci-robot commented 1 year ago

Hi @mrueg. Thanks for your PR.

I'm waiting for a kubernetes-sigs member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Instructions for interacting with me using PR comments are available [here](https://git.k8s.io/community/contributors/guide/pull-requests.md). If you have questions or suggestions related to my behavior, please file an issue against the [kubernetes/test-infra](https://github.com/kubernetes/test-infra/issues/new?title=Prow%20issue:) repository.
logicalhan commented 1 year ago

/assign @ehashman /triage accepted

ehashman commented 1 year ago

/ok-to-test

ehashman commented 1 year ago

@mrueg can you please PR yourself into kubernetes-sigs membership so we don't need to apply /ok-to-test to your PRs? https://github.com/kubernetes/org/blob/main/config/kubernetes-sigs/org.yaml#L16 As a Kubernetes org member, you get kubernetes-sigs membership as well.

mrueg commented 1 year ago

@ehashman sure, I created https://github.com/kubernetes/org/pull/3987 Thanks for letting me know! I wasn't aware. :+1:

ehashman commented 1 year ago

No worries, should make it a little easier going forward :) just gotta wait on a GH admin to approve.

mrueg commented 1 year ago

I've also added RBAC to create events, since I saw that popping up in the logs as well:

E0126 18:37:41.706864       1 event.go:267] Server rejected event '&v1.Event{TypeMeta:v1.TypeMeta{Kind:"", APIVersion:""}, ObjectMeta:v1.ObjectMeta{Name:"capacity-metrics-prometheus-collector-lock.
...
 'events is forbidden: User "system:serviceaccount:usage-metrics-collector:metrics-prometheus-collector" cannot create resource "events" in API group "" in the namespace "usage-metrics-collector"' (will not retry!)
k8s-ci-robot commented 1 year ago

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: ehashman, mrueg

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: - ~~[OWNERS](https://github.com/kubernetes-sigs/usage-metrics-collector/blob/main/OWNERS)~~ [ehashman] Approvers can indicate their approval by writing `/approve` in a comment Approvers can cancel approval by writing `/approve cancel` in a comment