Skip to content
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

Lease metrics does not support --namespace and --namespace-denylist #2121

Closed
ntoofu opened this issue Jul 20, 2023 · 1 comment · Fixed by #2122
Closed

Lease metrics does not support --namespace and --namespace-denylist #2121

ntoofu opened this issue Jul 20, 2023 · 1 comment · Fixed by #2122
Labels
kind/bug Categorizes issue or PR as related to a bug. needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one.

Comments

@ntoofu
Copy link
Contributor

ntoofu commented Jul 20, 2023

What happened:

Command line options such as --namespaces and --namespaces-denylist does not work against --resources=leases, though Lease is a namespaced resource.

What you expected to happen:

kube-state-metrics returns only metrics of leases in namespaces specified by --namespaces.

How to reproduce it (as minimally and precisely as possible):

  • metrics reports leases in namespaces other than kube-system, even if --namespaces=kube-system is given
$ kube-state-metrics --port=8080 --kubeconfig=$KUBECONFIG --namespaces=kube-system --resources=leases &

$ curl localhost:8080/metrics 2>/dev/null | grep -v 'namespace="kube-system"' | tail -n 3 
kube_lease_renew_time{lease="cilium-md-0-847944c6c6x9n889-799vh",namespace="kube-node-lease"} 1.689881244e+09
kube_lease_renew_time{lease="cilium-tqhs4",namespace="kube-node-lease"} 1.689881247e+09
kube_lease_renew_time{lease="cilium-md-0-847944c6c6x9n889-l8ctn",namespace="kube-node-lease"} 1.689881252e+09

  • metrics reports leases in the kube-system namespace, even if --namespaces-denylist=kube-system is given
$ kube-state-metrics --port=8080 --kubeconfig=$KUBECONFIG --namespaces-denylist=kube-system --resources=leases &

$ curl localhost:8080/metrics 2>/dev/null | grep 'namespace="kube-system"' | tail -n 3                              
kube_lease_renew_time{lease="cilium-operator-resource-lock",namespace="kube-system"} 1.689881395e+09
kube_lease_renew_time{lease="kube-controller-manager",namespace="kube-system"} 1.689881395e+09
kube_lease_renew_time{lease="kube-apiserver-kkvgiharvdf7dkbupwkxj5ggma",namespace="kube-system"} 1.689881388e+09

Anything else we need to know?:

Environment:

  • kube-state-metrics version: kube-state-metrics, version v2.9.2 (branch: main, revision: 3fb1e86c)
  • Kubernetes version (use kubectl version): Server Version: version.Info{Major:"1", Minor:"26", GitVersion:"v1.26.2", GitCommit:"fc04e732bb3e7198d2fa44efa5457c7c6f8c0f5b", GitTreeState:"clean", BuildDate:"2023-02-22T13:32:22Z", GoVersion:"go1.19.6", Compiler:"gc", Platform:"linux/amd64"}
  • Cloud provider or hardware configuration: cluster provisioned with cluster-api-provider-vsphere
  • Other info:
@ntoofu ntoofu added the kind/bug Categorizes issue or PR as related to a bug. label Jul 20, 2023
@k8s-ci-robot k8s-ci-robot added the needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. label Jul 20, 2023
@k8s-ci-robot
Copy link
Contributor

This issue is currently awaiting triage.

If kube-state-metrics contributors determine this is a relevant issue, they will accept it by applying the triage/accepted label and provide further guidance.

The triage/accepted label can be added by org members by writing /triage accepted in a comment.

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Categorizes issue or PR as related to a bug. needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants