Compare commits

..

485 Commits

Author SHA1 Message Date
Kubernetes Prow Robot bc45a49c9b
Merge pull request #2719 from Rishab87/reason-label
feat: include reason label to `kube_deployment_status_condition`
2025-08-14 08:27:09 -07:00
Rishab87 012b46d220 adding empty string in reasons 2025-08-14 18:32:48 +05:30
Kubernetes Prow Robot 1556ac589f
Merge pull request #2723 from ydFu/patch-1
docs: Update metrics-store-performance-optimization.md
2025-08-13 10:53:09 -07:00
Rishab87 547afad282 adding reasons from deployment_utils.go 2025-08-13 22:35:44 +05:30
Kubernetes Prow Robot 997272f779
Merge pull request #2731 from kubernetes/dependabot/github_actions/actions/checkout-5.0.0
build(deps): Bump actions/checkout from 4.2.2 to 5.0.0
2025-08-11 12:55:07 -07:00
dependabot[bot] bd174abd54
build(deps): Bump actions/checkout from 4.2.2 to 5.0.0
Bumps [actions/checkout](https://github.com/actions/checkout) from 4.2.2 to 5.0.0.
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](11bd71901b...08c6903cd8)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-version: 5.0.0
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-08-11 19:45:26 +00:00
Rishab87 b5820387c0 adding empty reason in allowedList 2025-08-11 20:50:42 +05:30
Rishab87 bc1e7f8965 fixing empty reasons and adding tests 2025-08-11 20:16:08 +05:30
Rishab87 b30335fa54 changing empty reasons to unkown 2025-08-08 21:46:48 +05:30
Ader Fu 9222ba465f
Update metrics-store-performance-optimization.md 2025-08-08 16:54:27 +08:00
Kubernetes Prow Robot 95b29ac8a9
Merge pull request #2714 from Rishab87/fix-md-format
fix: Fixed the format of Markdown files
2025-08-07 06:05:43 -07:00
Rishab87 f8f39bc9fc disabling md041 in PR template 2025-08-07 17:40:54 +05:30
Kubernetes Prow Robot 3a0eec4626
Merge pull request #2720 from mrueg/k8s-1.33
chore: Build with k8s 1.33
2025-08-07 01:07:41 -07:00
Kubernetes Prow Robot d680e8c991
Merge pull request #2705 from rashmichandrashekar/rashmi/ksm-config-override
fix: Config file overrides apply to some fields but not other
2025-08-06 01:09:26 -07:00
Rashmi Chandrashekar 921147623e support overrides 2025-08-05 19:30:00 -07:00
Rishab87 5de7a63748 addressing reviews 2025-08-05 17:23:48 +05:30
Rishab87 0a50cabaf9 added reason label 2025-08-05 16:35:42 +05:30
Manuel Rüger 72ed667151 chore: Build with k8s 1.33 2025-08-04 23:16:39 +02:00
Kubernetes Prow Robot 9add5df58e
Merge pull request #2716 from taraspos/patch-1
fix(customresourcestate): fix index out of range
2025-08-04 11:51:39 -07:00
Kubernetes Prow Robot 61cb551bb5
Merge pull request #2717 from kubernetes/dependabot/go_modules/github.com/prometheus/client_golang-1.23.0
build(deps): Bump github.com/prometheus/client_golang from 1.22.0 to 1.23.0
2025-08-04 07:33:40 -07:00
Rishab87 fc6ab5bf65 addressing reviews & fixing CI errors 2025-08-04 19:58:37 +05:30
Rishab Kumar Jha c309d3a00f
Update README.md
Co-authored-by: Manuel Rüger <manuel@rueg.eu>
2025-08-04 19:53:32 +05:30
dependabot[bot] cb6bdd2046
build(deps): Bump github.com/prometheus/client_golang
Bumps [github.com/prometheus/client_golang](https://github.com/prometheus/client_golang) from 1.22.0 to 1.23.0.
- [Release notes](https://github.com/prometheus/client_golang/releases)
- [Changelog](https://github.com/prometheus/client_golang/blob/main/CHANGELOG.md)
- [Commits](https://github.com/prometheus/client_golang/compare/v1.22.0...v1.23.0)

---
updated-dependencies:
- dependency-name: github.com/prometheus/client_golang
  dependency-version: 1.23.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-08-04 13:29:57 +00:00
Taras dc54dc6580
customresourcestate: fix panic 2025-08-04 14:07:41 +01:00
Rishab87 63a0298d5a fixed md024, md036, md040, md041, md033 rules 2025-08-02 23:42:45 +05:30
Kubernetes Prow Robot 61be81fa1f
Merge pull request #2712 from kubernetes/dependabot/go_modules/sigs.k8s.io/yaml-1.6.0
build(deps): Bump sigs.k8s.io/yaml from 1.5.0 to 1.6.0
2025-07-27 16:14:27 -07:00
dependabot[bot] c106a38fab
build(deps): Bump sigs.k8s.io/yaml from 1.5.0 to 1.6.0
Bumps [sigs.k8s.io/yaml](https://github.com/kubernetes-sigs/yaml) from 1.5.0 to 1.6.0.
- [Release notes](https://github.com/kubernetes-sigs/yaml/releases)
- [Changelog](https://github.com/kubernetes-sigs/yaml/blob/master/RELEASE.md)
- [Commits](https://github.com/kubernetes-sigs/yaml/compare/v1.5.0...v1.6.0)

---
updated-dependencies:
- dependency-name: sigs.k8s.io/yaml
  dependency-version: 1.6.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-07-27 23:06:40 +00:00
Kubernetes Prow Robot 104c83fb9f
Merge pull request #2710 from CatherineF-dev/master
chore: Add CatherineF-dev into SECURITY_CONTACTS
2025-07-24 10:00:27 -07:00
CatherineF-dev 9f6f1cd762
Add CatherineF-dev into SECURITY_CONTACTS 2025-07-21 15:25:25 -04:00
Kubernetes Prow Robot f421b9a69a
Merge pull request #2707 from kubernetes/dependabot/go_modules/github.com/KimMachineGun/automemlimit-0.7.4
build(deps): Bump github.com/KimMachineGun/automemlimit from 0.7.3 to 0.7.4
2025-07-14 05:22:23 -07:00
dependabot[bot] dd2ca7b09b
build(deps): Bump github.com/KimMachineGun/automemlimit
Bumps [github.com/KimMachineGun/automemlimit](https://github.com/KimMachineGun/automemlimit) from 0.7.3 to 0.7.4.
- [Release notes](https://github.com/KimMachineGun/automemlimit/releases)
- [Commits](https://github.com/KimMachineGun/automemlimit/compare/v0.7.3...v0.7.4)

---
updated-dependencies:
- dependency-name: github.com/KimMachineGun/automemlimit
  dependency-version: 0.7.4
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-07-14 11:37:51 +00:00
Kubernetes Prow Robot 6942640a45
Merge pull request #2699 from yshngg/feature/pod-metrics/unscheduled-time
feat(pod): Add new metric for pod unscheduled time tracking
2025-07-11 17:09:31 -07:00
yshngg a483701408 feat(pod): add new metric for pod unscheduled time tracking
The changes introduce a new metric generator `kube_pod_status_unscheduled_time` to record the Unix timestamp when pods transition to unscheduled status. This enhances monitoring capabilities for scheduling issues by capturing exact transition times during `PodScheduled` condition changes.
2025-07-01 16:06:28 +08:00
Kubernetes Prow Robot 56d3b561e6
Merge pull request #2696 from kubernetes/dependabot/go_modules/github.com/oklog/run-1.2.0
build(deps): Bump github.com/oklog/run from 1.1.0 to 1.2.0
2025-06-30 05:14:32 -07:00
Kubernetes Prow Robot dff9a1e8f5
Merge pull request #2697 from kubernetes/release-2.16
chore: Merge v2.16 back into `main`
2025-06-30 05:12:32 -07:00
dependabot[bot] a0889d56c8
build(deps): Bump github.com/oklog/run from 1.1.0 to 1.2.0
Bumps [github.com/oklog/run](https://github.com/oklog/run) from 1.1.0 to 1.2.0.
- [Release notes](https://github.com/oklog/run/releases)
- [Commits](https://github.com/oklog/run/compare/v1.1.0...v1.2.0)

---
updated-dependencies:
- dependency-name: github.com/oklog/run
  dependency-version: 1.2.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-06-30 11:32:37 +00:00
Kubernetes Prow Robot edc9db4649
Merge pull request #2694 from kubernetes/dependabot/go_modules/sigs.k8s.io/yaml-1.5.0
build(deps): Bump sigs.k8s.io/yaml from 1.4.0 to 1.5.0
2025-06-30 04:32:32 -07:00
dependabot[bot] 0a8f32ff12
build(deps): Bump sigs.k8s.io/yaml from 1.4.0 to 1.5.0
Bumps [sigs.k8s.io/yaml](https://github.com/kubernetes-sigs/yaml) from 1.4.0 to 1.5.0.
- [Release notes](https://github.com/kubernetes-sigs/yaml/releases)
- [Changelog](https://github.com/kubernetes-sigs/yaml/blob/master/RELEASE.md)
- [Commits](https://github.com/kubernetes-sigs/yaml/compare/v1.4.0...v1.5.0)

---
updated-dependencies:
- dependency-name: sigs.k8s.io/yaml
  dependency-version: 1.5.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-06-30 11:16:25 +00:00
Kubernetes Prow Robot 291a962840
Merge pull request #2692 from rexagod/prep-216
chore: Prep `v2.16` release
2025-06-25 05:52:30 -07:00
Pranshu Srivastava c6ae6f53f7
chore: Prep `v2.16` release
Signed-off-by: Pranshu Srivastava <rexagod@gmail.com>
2025-06-24 17:04:39 +05:30
Kubernetes Prow Robot 9576360078
Merge pull request #2693 from rexagod/make-examples-fix
fix: Fix `examples` target
2025-06-23 09:19:56 -07:00
Pranshu Srivastava 8b2aa61c70
fix: Fix `examples` target
Signed-off-by: Pranshu Srivastava <rexagod@gmail.com>
2025-06-23 19:27:58 +05:30
Kubernetes Prow Robot d59fe58df9
Merge pull request #2686 from mrueg/authfilter
feat: Add AuthFilter
2025-06-23 06:18:54 -07:00
Manuel Rüger 5e8e4fffa6
Update tests/e2e/auth-filter_test.go
Co-authored-by: Pranshu Srivastava <prasriva@redhat.com>
2025-06-23 14:18:44 +02:00
Manuel Rüger 301240eccc
Update tests/e2e/auth-filter_test.go
Co-authored-by: Pranshu Srivastava <prasriva@redhat.com>
2025-06-23 14:18:35 +02:00
Manuel Rüger a5789613f1 feat: Add AuthFilter
This adds an Authentication/Authorization filter through Kubernetes'
TokenReview / SubjectAccessReview resources.

The client config for kube-state-metrics needs a clusterrole for

* apiGroups: authentication.k8s.io, resources: tokenreviews, verbs: create
* apiGroups: authorization.k8s.io, resources: subjectaccessreviews, verbs: create

The Prometheus client needs a clusterrole for

* nonResourceURLs: "/metrics", verbs: get
2025-06-23 14:17:52 +02:00
Kubernetes Prow Robot 15e6171c37
Merge pull request #2691 from kubernetes/dependabot/go_modules/github.com/prometheus/common-0.65.0
build(deps): Bump github.com/prometheus/common from 0.64.0 to 0.65.0
2025-06-23 04:50:54 -07:00
dependabot[bot] 873c140040
build(deps): Bump github.com/prometheus/common from 0.64.0 to 0.65.0
Bumps [github.com/prometheus/common](https://github.com/prometheus/common) from 0.64.0 to 0.65.0.
- [Release notes](https://github.com/prometheus/common/releases)
- [Changelog](https://github.com/prometheus/common/blob/main/RELEASE.md)
- [Commits](https://github.com/prometheus/common/compare/v0.64.0...v0.65.0)

---
updated-dependencies:
- dependency-name: github.com/prometheus/common
  dependency-version: 0.65.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-06-23 10:30:43 +00:00
Kubernetes Prow Robot 5c130dadad
Merge pull request #2689 from mrueg/k8s-1.32.6
chore: Bump to k8s 1.32.6
2025-06-23 02:26:59 -07:00
Manuel Rüger 2258ba71e8 chore: Bump to k8s 1.32.6 2025-06-19 21:04:03 +02:00
Kubernetes Prow Robot 55d2a7cfac
Merge pull request #2672 from rexagod/sync-caches
fix: Clean up CR reflectors after parent CRD deletion
2025-06-19 09:26:54 -07:00
Kubernetes Prow Robot 97bfa326ab
Merge pull request #2687 from mrueg/makefile-fix-typo
fix: Fix typo in Makefile
2025-06-19 00:48:52 -07:00
Pranshu Srivastava ea6b123caf
fix: close reflectors once their corresponding CRDs are dropped
Signed-off-by: Pranshu Srivastava <rexagod@gmail.com>
2025-06-19 03:07:45 +05:30
Manuel Rüger b9068888d0 Makefile: Fix typo 2025-06-18 22:22:55 +02:00
Kubernetes Prow Robot dbf6e9b4e2
Merge pull request #2677 from mrueg/bump-kind
chore: Bump kind
2025-06-17 06:30:59 -07:00
Kubernetes Prow Robot d84b10a125
Merge pull request #2626 from mrueg/limit-list
feat: Introduce object limits
2025-06-17 06:29:00 -07:00
Kubernetes Prow Robot 775e4586ad
Merge pull request #2683 from kubernetes/dependabot/go_modules/github.com/KimMachineGun/automemlimit-0.7.3
build(deps): Bump github.com/KimMachineGun/automemlimit from 0.7.2 to 0.7.3
2025-06-15 11:52:57 -07:00
dependabot[bot] bea09e59f0
build(deps): Bump github.com/KimMachineGun/automemlimit
Bumps [github.com/KimMachineGun/automemlimit](https://github.com/KimMachineGun/automemlimit) from 0.7.2 to 0.7.3.
- [Release notes](https://github.com/KimMachineGun/automemlimit/releases)
- [Commits](https://github.com/KimMachineGun/automemlimit/compare/v0.7.2...v0.7.3)

---
updated-dependencies:
- dependency-name: github.com/KimMachineGun/automemlimit
  dependency-version: 0.7.3
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-06-15 18:44:43 +00:00
Manuel Rüger 4519b2848b feat: Introduce object limits
This change allows user-controlled limits on how many objects KSM will
list from the API. This is helpful to prevent resource exhaustion on
KSM, in case the API creates too many resources.

The object limit it set globally and applied per resource watched.
2025-05-31 23:29:41 +02:00
Manuel Rüger 99224f2c29 chore: Bump kind 2025-05-31 22:16:44 +02:00
Kubernetes Prow Robot 84e2d8fe69
Merge pull request #2670 from rexagod/add-pathtype-to-ingress-path
feat: add `pathType` to `ingress_path`
2025-05-31 11:44:12 -07:00
Kubernetes Prow Robot 6beab20acd
Merge pull request #2676 from kubernetes/dependabot/go_modules/github.com/go-logr/logr-1.4.3
build(deps): Bump github.com/go-logr/logr from 1.4.2 to 1.4.3
2025-05-31 11:34:11 -07:00
dependabot[bot] bb2ad9d2ea
build(deps): Bump github.com/go-logr/logr from 1.4.2 to 1.4.3
Bumps [github.com/go-logr/logr](https://github.com/go-logr/logr) from 1.4.2 to 1.4.3.
- [Release notes](https://github.com/go-logr/logr/releases)
- [Changelog](https://github.com/go-logr/logr/blob/master/CHANGELOG.md)
- [Commits](https://github.com/go-logr/logr/compare/v1.4.2...v1.4.3)

---
updated-dependencies:
- dependency-name: github.com/go-logr/logr
  dependency-version: 1.4.3
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-05-31 18:24:54 +00:00
Kubernetes Prow Robot 28bf0e817d
Merge pull request #2644 from carlosmorenokm1/fix-pod-status-reason
fix: report correct reason in kube_pod_status_reason metric
2025-05-25 21:02:36 -07:00
Kubernetes Prow Robot 1018969872
Merge pull request #2673 from kubernetes/dependabot/go_modules/github.com/prometheus/common-0.64.0
build(deps): Bump github.com/prometheus/common from 0.63.0 to 0.64.0
2025-05-18 14:15:14 -07:00
dependabot[bot] 043b59ab08
build(deps): Bump github.com/prometheus/common from 0.63.0 to 0.64.0
Bumps [github.com/prometheus/common](https://github.com/prometheus/common) from 0.63.0 to 0.64.0.
- [Release notes](https://github.com/prometheus/common/releases)
- [Changelog](https://github.com/prometheus/common/blob/main/RELEASE.md)
- [Commits](https://github.com/prometheus/common/compare/v0.63.0...v0.64.0)

---
updated-dependencies:
- dependency-name: github.com/prometheus/common
  dependency-version: 0.64.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-05-18 21:06:57 +00:00
Kubernetes Prow Robot 8ec1fb3c15
Merge pull request #2669 from kubernetes/dependabot/github_actions/actions/setup-go-5.5.0
build(deps): Bump actions/setup-go from 5.4.0 to 5.5.0
2025-05-12 03:27:15 -07:00
Pranshu Srivastava e178d8e582
enhancement: add `pathType` to `ingress_path`
This avoids duplicate metrics (and thus, `PrometheusDuplicateTimestamps`) for schemas such as:
```
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: minimal-ingress
  annotations:
    nginx.ingress.kubernetes.io/rewrite-target: /
spec:
  ingressClassName: nginx-example
  rules:
  - http:
      paths:
      - backend:
          service:
            name: cart
            port:
              number: 3000
        path: /nvc/cart
        pathType: Prefix
      - backend:
          service:
            name: cart
            port:
              number: 3000
        path: /nvc/cart
        pathType: Exact
```

Signed-off-by: Pranshu Srivastava <rexagod@gmail.com>
2025-05-12 15:34:00 +05:30
dependabot[bot] 20af6bac6d
build(deps): Bump actions/setup-go from 5.4.0 to 5.5.0
Bumps [actions/setup-go](https://github.com/actions/setup-go) from 5.4.0 to 5.5.0.
- [Release notes](https://github.com/actions/setup-go/releases)
- [Commits](0aaccfd150...d35c59abb0)

---
updated-dependencies:
- dependency-name: actions/setup-go
  dependency-version: 5.5.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-05-12 09:41:04 +00:00
Kubernetes Prow Robot 9ea1495953
Merge pull request #2656 from mrueg/port-away-gopkg.yamlv3
chore: Port away from gopkg.in/yaml.v3
2025-05-07 09:21:24 -07:00
Kubernetes Prow Robot 090535fcd2
Merge pull request #2667 from kubernetes/dependabot/go_modules/github.com/KimMachineGun/automemlimit-0.7.2
build(deps): Bump github.com/KimMachineGun/automemlimit from 0.7.1 to 0.7.2
2025-05-05 02:43:58 -07:00
dependabot[bot] d45250dec2
build(deps): Bump github.com/KimMachineGun/automemlimit
Bumps [github.com/KimMachineGun/automemlimit](https://github.com/KimMachineGun/automemlimit) from 0.7.1 to 0.7.2.
- [Release notes](https://github.com/KimMachineGun/automemlimit/releases)
- [Commits](https://github.com/KimMachineGun/automemlimit/compare/v0.7.1...v0.7.2)

---
updated-dependencies:
- dependency-name: github.com/KimMachineGun/automemlimit
  dependency-version: 0.7.2
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-05-05 09:36:26 +00:00
Manuel Rüger 3b21633bee chore: Port away from gopkg.in/yaml.v3
This is deprecated by upstream and we can use sigs.k8s.io/yaml now.

Signed-off-by: Manuel Rüger <manuel@rueg.eu>
2025-04-22 10:58:08 +02:00
Kubernetes Prow Robot 0b01e3abce
Merge pull request #2654 from kubernetes/dependabot/github_actions/kubernetes-sigs/release-actions-0.3.1
build(deps): Bump kubernetes-sigs/release-actions from 0.3.0 to 0.3.1
2025-04-21 03:29:00 -07:00
dependabot[bot] 012b785665
build(deps): Bump kubernetes-sigs/release-actions from 0.3.0 to 0.3.1
Bumps [kubernetes-sigs/release-actions](https://github.com/kubernetes-sigs/release-actions) from 0.3.0 to 0.3.1.
- [Release notes](https://github.com/kubernetes-sigs/release-actions/releases)
- [Changelog](https://github.com/kubernetes-sigs/release-actions/blob/main/RELEASE.md)
- [Commits](a69972745f...a30d93cf2a)

---
updated-dependencies:
- dependency-name: kubernetes-sigs/release-actions
  dependency-version: 0.3.1
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-04-21 10:08:57 +00:00
Kubernetes Prow Robot 209f3ab5fa
Merge pull request #2652 from kubernetes/dependabot/go_modules/github.com/prometheus/client_model-0.6.2
build(deps): Bump github.com/prometheus/client_model from 0.6.1 to 0.6.2
2025-04-12 16:54:41 -07:00
Kubernetes Prow Robot d060e4f32c
Merge pull request #2639 from kubernetes/dependabot/go_modules/github.com/spf13/viper-1.20.1
build(deps): Bump github.com/spf13/viper from 1.20.0 to 1.20.1
2025-04-12 16:52:41 -07:00
dependabot[bot] aab32a9e1a
build(deps): Bump github.com/spf13/viper from 1.20.0 to 1.20.1
Bumps [github.com/spf13/viper](https://github.com/spf13/viper) from 1.20.0 to 1.20.1.
- [Release notes](https://github.com/spf13/viper/releases)
- [Commits](https://github.com/spf13/viper/compare/v1.20.0...v1.20.1)

---
updated-dependencies:
- dependency-name: github.com/spf13/viper
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-04-12 23:44:47 +00:00
dependabot[bot] e204ab31cb
build(deps): Bump github.com/prometheus/client_model from 0.6.1 to 0.6.2
Bumps [github.com/prometheus/client_model](https://github.com/prometheus/client_model) from 0.6.1 to 0.6.2.
- [Release notes](https://github.com/prometheus/client_model/releases)
- [Commits](https://github.com/prometheus/client_model/compare/v0.6.1...v0.6.2)

---
updated-dependencies:
- dependency-name: github.com/prometheus/client_model
  dependency-version: 0.6.2
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-04-12 23:44:02 +00:00
Kubernetes Prow Robot 38e2fa6e53
Merge pull request #2650 from dgrisonnet/catherine-approver
chore: add CatherineF-dev as an approver
2025-04-10 11:24:51 -07:00
Damien Grisonnet f6e2b5fbda chore: add CatherineF-dev as an approver
Signed-off-by: Damien Grisonnet <dgrisonn@redhat.com>
2025-04-10 19:04:43 +02:00
Kubernetes Prow Robot 3aee5ff2bb
Merge pull request #2648 from kubernetes/dependabot/go_modules/github.com/prometheus/client_golang-1.22.0
build(deps): Bump github.com/prometheus/client_golang from 1.21.1 to 1.22.0
2025-04-09 04:34:39 -07:00
dependabot[bot] 55e124f509
build(deps): Bump github.com/prometheus/client_golang
Bumps [github.com/prometheus/client_golang](https://github.com/prometheus/client_golang) from 1.21.1 to 1.22.0.
- [Release notes](https://github.com/prometheus/client_golang/releases)
- [Changelog](https://github.com/prometheus/client_golang/blob/main/CHANGELOG.md)
- [Commits](https://github.com/prometheus/client_golang/compare/v1.21.1...v1.22.0)

---
updated-dependencies:
- dependency-name: github.com/prometheus/client_golang
  dependency-version: 1.22.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-04-08 08:19:21 +00:00
Kubernetes Prow Robot f0f9898fa1
Merge pull request #2643 from mrueg/golangci-v2
chore: Migrate to golangci-lint v2
2025-04-07 22:18:39 -07:00
Kubernetes Prow Robot a0d9835e78
Merge pull request #2647 from kubernetes/dependabot/go_modules/github.com/fsnotify/fsnotify-1.9.0
build(deps): Bump github.com/fsnotify/fsnotify from 1.8.0 to 1.9.0
2025-04-07 05:40:38 -07:00
dependabot[bot] a09d690396
build(deps): Bump github.com/fsnotify/fsnotify from 1.8.0 to 1.9.0
Bumps [github.com/fsnotify/fsnotify](https://github.com/fsnotify/fsnotify) from 1.8.0 to 1.9.0.
- [Release notes](https://github.com/fsnotify/fsnotify/releases)
- [Changelog](https://github.com/fsnotify/fsnotify/blob/main/CHANGELOG.md)
- [Commits](https://github.com/fsnotify/fsnotify/compare/v1.8.0...v1.9.0)

---
updated-dependencies:
- dependency-name: github.com/fsnotify/fsnotify
  dependency-version: 1.9.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-04-07 10:22:23 +00:00
Carlos Moreno 05187b47e2 fix: report correct values in kube_pod_status_reason metric (added tests) 2025-04-01 18:32:26 -05:00
Carlos Moreno 518db3d3cd fix: report correct values in kube_pod_status_reason metric 2025-03-31 23:01:45 -05:00
Manuel Rüger 0c029b690e chore: Migrate to golangci-lint v2 2025-03-31 14:52:47 +02:00
Kubernetes Prow Robot ffd8f41131
Merge pull request #2641 from ricardbejarano/main
fix: bump golang.org/x/net to v0.38.0 (fixes CVE-2025-22870 & CVE-2025-22872)
2025-03-31 04:22:40 -07:00
Ricard Bejarano 4f62f0fde4
go mod tidy
Signed-off-by: Ricard Bejarano <ricard@bejarano.io>
2025-03-31 11:38:34 +02:00
Ricard Bejarano 1c923dc83b
fix: bump golang.org/x/net to v0.38.0 (fixes CVE-2025-22872) 2025-03-30 11:49:41 +02:00
Ricard Bejarano a6ff8ae41c
fix: bump golang.org/x/net to v0.36.0 (fixes CVE-2025-22870) 2025-03-29 10:17:12 +01:00
Kubernetes Prow Robot b528c28f7e
Merge pull request #2634 from kubernetes/dependabot/github_actions/actions/setup-go-5.4.0
build(deps): Bump actions/setup-go from 5.3.0 to 5.4.0
2025-03-24 03:00:34 -07:00
dependabot[bot] bc2a57140c
build(deps): Bump actions/setup-go from 5.3.0 to 5.4.0
Bumps [actions/setup-go](https://github.com/actions/setup-go) from 5.3.0 to 5.4.0.
- [Release notes](https://github.com/actions/setup-go/releases)
- [Commits](f111f3307d...0aaccfd150)

---
updated-dependencies:
- dependency-name: actions/setup-go
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-03-24 09:52:08 +00:00
Kubernetes Prow Robot 5f116914f1
Merge pull request #2616 from rexagod/2594
feat: Use `dlclark/regexp2` over standard library's package
2025-03-19 01:10:31 -07:00
Pranshu Srivastava 8b631bbff4
feat: Use `dlclark/regexp2` over standard library's package
Signed-off-by: Pranshu Srivastava <rexagod@gmail.com>
2025-03-18 18:57:25 +05:30
Kubernetes Prow Robot bc60722ddd
Merge pull request #2630 from kubernetes/dependabot/go_modules/github.com/prometheus/common-0.63.0
build(deps): Bump github.com/prometheus/common from 0.62.0 to 0.63.0
2025-03-17 18:07:49 -07:00
Kubernetes Prow Robot 456ac8f2e8
Merge pull request #2629 from kubernetes/dependabot/go_modules/github.com/spf13/viper-1.20.0
build(deps): Bump github.com/spf13/viper from 1.19.0 to 1.20.0
2025-03-17 18:05:49 -07:00
dependabot[bot] aa6e88c2d5
build(deps): Bump github.com/spf13/viper from 1.19.0 to 1.20.0
Bumps [github.com/spf13/viper](https://github.com/spf13/viper) from 1.19.0 to 1.20.0.
- [Release notes](https://github.com/spf13/viper/releases)
- [Commits](https://github.com/spf13/viper/compare/v1.19.0...v1.20.0)

---
updated-dependencies:
- dependency-name: github.com/spf13/viper
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-03-18 00:51:07 +00:00
dependabot[bot] b3d26f7a9f
build(deps): Bump github.com/prometheus/common from 0.62.0 to 0.63.0
Bumps [github.com/prometheus/common](https://github.com/prometheus/common) from 0.62.0 to 0.63.0.
- [Release notes](https://github.com/prometheus/common/releases)
- [Changelog](https://github.com/prometheus/common/blob/main/RELEASE.md)
- [Commits](https://github.com/prometheus/common/compare/v0.62.0...v0.63.0)

---
updated-dependencies:
- dependency-name: github.com/prometheus/common
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-03-18 00:51:05 +00:00
Kubernetes Prow Robot 40602cb3e3
Merge pull request #2611 from mrueg/go-1.24
chore: Bump to go-1.24, use go tools
2025-03-17 17:49:49 -07:00
Manuel Rüger a3972f90ab chore: Bump to go-1.24, use go tools 2025-03-16 21:41:32 +01:00
Kubernetes Prow Robot dab65d7cb4
Merge pull request #2628 from kubernetes/dependabot/go_modules/k8s-dependencies-8005f85eb9
build(deps): Bump the k8s-dependencies group with 5 updates
2025-03-12 02:01:46 -07:00
dependabot[bot] 05e45869ff
build(deps): Bump the k8s-dependencies group with 5 updates
Bumps the k8s-dependencies group with 5 updates:

| Package | From | To |
| --- | --- | --- |
| [k8s.io/api](https://github.com/kubernetes/api) | `0.32.2` | `0.32.3` |
| [k8s.io/apimachinery](https://github.com/kubernetes/apimachinery) | `0.32.2` | `0.32.3` |
| [k8s.io/client-go](https://github.com/kubernetes/client-go) | `0.32.2` | `0.32.3` |
| [k8s.io/component-base](https://github.com/kubernetes/component-base) | `0.32.2` | `0.32.3` |
| [k8s.io/sample-controller](https://github.com/kubernetes/sample-controller) | `0.32.2` | `0.32.3` |


Updates `k8s.io/api` from 0.32.2 to 0.32.3
- [Commits](https://github.com/kubernetes/api/compare/v0.32.2...v0.32.3)

Updates `k8s.io/apimachinery` from 0.32.2 to 0.32.3
- [Commits](https://github.com/kubernetes/apimachinery/compare/v0.32.2...v0.32.3)

Updates `k8s.io/client-go` from 0.32.2 to 0.32.3
- [Changelog](https://github.com/kubernetes/client-go/blob/master/CHANGELOG.md)
- [Commits](https://github.com/kubernetes/client-go/compare/v0.32.2...v0.32.3)

Updates `k8s.io/component-base` from 0.32.2 to 0.32.3
- [Commits](https://github.com/kubernetes/component-base/compare/v0.32.2...v0.32.3)

Updates `k8s.io/sample-controller` from 0.32.2 to 0.32.3
- [Commits](https://github.com/kubernetes/sample-controller/compare/v0.32.2...v0.32.3)

---
updated-dependencies:
- dependency-name: k8s.io/api
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: k8s-dependencies
- dependency-name: k8s.io/apimachinery
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: k8s-dependencies
- dependency-name: k8s.io/client-go
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: k8s-dependencies
- dependency-name: k8s.io/component-base
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: k8s-dependencies
- dependency-name: k8s.io/sample-controller
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: k8s-dependencies
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-03-12 08:40:29 +00:00
Kubernetes Prow Robot 3d73ddbd09
Merge pull request #2624 from kubernetes/dependabot/go_modules/github.com/prometheus/client_golang-1.21.1
build(deps): Bump github.com/prometheus/client_golang from 1.21.0 to 1.21.1
2025-03-06 14:19:44 -08:00
dependabot[bot] 5906b6dc9e
build(deps): Bump github.com/prometheus/client_golang
Bumps [github.com/prometheus/client_golang](https://github.com/prometheus/client_golang) from 1.21.0 to 1.21.1.
- [Release notes](https://github.com/prometheus/client_golang/releases)
- [Changelog](https://github.com/prometheus/client_golang/blob/main/CHANGELOG.md)
- [Commits](https://github.com/prometheus/client_golang/compare/v1.21.0...v1.21.1)

---
updated-dependencies:
- dependency-name: github.com/prometheus/client_golang
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-03-06 22:10:30 +00:00
Kubernetes Prow Robot c853e41fee
Merge pull request #2618 from kubernetes/dependabot/go_modules/github.com/google/go-cmp-0.7.0
build(deps): Bump github.com/google/go-cmp from 0.6.0 to 0.7.0
2025-02-24 01:08:29 -08:00
Kubernetes Prow Robot 2c423907a3
Merge pull request #2617 from kubernetes/dependabot/go_modules/github.com/KimMachineGun/automemlimit-0.7.1
build(deps): Bump github.com/KimMachineGun/automemlimit from 0.7.0 to 0.7.1
2025-02-24 01:06:29 -08:00
dependabot[bot] 0129759430
build(deps): Bump github.com/google/go-cmp from 0.6.0 to 0.7.0
Bumps [github.com/google/go-cmp](https://github.com/google/go-cmp) from 0.6.0 to 0.7.0.
- [Release notes](https://github.com/google/go-cmp/releases)
- [Commits](https://github.com/google/go-cmp/compare/v0.6.0...v0.7.0)

---
updated-dependencies:
- dependency-name: github.com/google/go-cmp
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-02-24 08:57:49 +00:00
dependabot[bot] c405dcf1f3
build(deps): Bump github.com/KimMachineGun/automemlimit
Bumps [github.com/KimMachineGun/automemlimit](https://github.com/KimMachineGun/automemlimit) from 0.7.0 to 0.7.1.
- [Release notes](https://github.com/KimMachineGun/automemlimit/releases)
- [Commits](https://github.com/KimMachineGun/automemlimit/compare/v0.7.0...v0.7.1)

---
updated-dependencies:
- dependency-name: github.com/KimMachineGun/automemlimit
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-02-24 08:57:44 +00:00
Kubernetes Prow Robot 7f9b0d1189
Merge pull request #2615 from SuperQ/superq/reclaim
feat: Add PersistentVolume Reclaim Policy into info metric
2025-02-22 13:56:26 -08:00
SuperQ a775fe3458
feat: Add PersistentVolume Reclaim Policy metric
In order to monitor for PVs with different reclaim policies add a
`reclaim_policy` label to the `kube_persistentvolume_info` metric.

Signed-off-by: SuperQ <superq@gmail.com>
2025-02-20 10:37:13 +01:00
Kubernetes Prow Robot 3527ceb4d5
Merge pull request #2613 from kubernetes/dependabot/go_modules/github.com/prometheus/client_golang-1.21.0
build(deps): Bump github.com/prometheus/client_golang from 1.20.5 to 1.21.0
2025-02-19 03:42:26 -08:00
dependabot[bot] 9ce7e6b771
build(deps): Bump github.com/prometheus/client_golang
Bumps [github.com/prometheus/client_golang](https://github.com/prometheus/client_golang) from 1.20.5 to 1.21.0.
- [Release notes](https://github.com/prometheus/client_golang/releases)
- [Changelog](https://github.com/prometheus/client_golang/blob/v1.21.0/CHANGELOG.md)
- [Commits](https://github.com/prometheus/client_golang/compare/v1.20.5...v1.21.0)

---
updated-dependencies:
- dependency-name: github.com/prometheus/client_golang
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-02-19 11:13:44 +00:00
Kubernetes Prow Robot cd49aeac35
Merge pull request #2610 from kubernetes/dependabot/go_modules/github.com/spf13/cobra-1.9.1
build(deps): Bump github.com/spf13/cobra from 1.8.1 to 1.9.1
2025-02-17 04:40:22 -08:00
dependabot[bot] 16db8b7368
build(deps): Bump github.com/spf13/cobra from 1.8.1 to 1.9.1
Bumps [github.com/spf13/cobra](https://github.com/spf13/cobra) from 1.8.1 to 1.9.1.
- [Release notes](https://github.com/spf13/cobra/releases)
- [Commits](https://github.com/spf13/cobra/compare/v1.8.1...v1.9.1)

---
updated-dependencies:
- dependency-name: github.com/spf13/cobra
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-02-17 09:34:11 +00:00
Kubernetes Prow Robot 350a7c472e
Merge pull request #2609 from kubernetes/dependabot/go_modules/k8s-dependencies-648f52ad64
build(deps): Bump the k8s-dependencies group with 5 updates
2025-02-15 00:32:20 -08:00
dependabot[bot] 919ce06ec7
build(deps): Bump the k8s-dependencies group with 5 updates
Bumps the k8s-dependencies group with 5 updates:

| Package | From | To |
| --- | --- | --- |
| [k8s.io/api](https://github.com/kubernetes/api) | `0.32.1` | `0.32.2` |
| [k8s.io/apimachinery](https://github.com/kubernetes/apimachinery) | `0.32.1` | `0.32.2` |
| [k8s.io/client-go](https://github.com/kubernetes/client-go) | `0.32.1` | `0.32.2` |
| [k8s.io/component-base](https://github.com/kubernetes/component-base) | `0.32.1` | `0.32.2` |
| [k8s.io/sample-controller](https://github.com/kubernetes/sample-controller) | `0.32.1` | `0.32.2` |


Updates `k8s.io/api` from 0.32.1 to 0.32.2
- [Commits](https://github.com/kubernetes/api/compare/v0.32.1...v0.32.2)

Updates `k8s.io/apimachinery` from 0.32.1 to 0.32.2
- [Commits](https://github.com/kubernetes/apimachinery/compare/v0.32.1...v0.32.2)

Updates `k8s.io/client-go` from 0.32.1 to 0.32.2
- [Changelog](https://github.com/kubernetes/client-go/blob/master/CHANGELOG.md)
- [Commits](https://github.com/kubernetes/client-go/compare/v0.32.1...v0.32.2)

Updates `k8s.io/component-base` from 0.32.1 to 0.32.2
- [Commits](https://github.com/kubernetes/component-base/compare/v0.32.1...v0.32.2)

Updates `k8s.io/sample-controller` from 0.32.1 to 0.32.2
- [Commits](https://github.com/kubernetes/sample-controller/compare/v0.32.1...v0.32.2)

---
updated-dependencies:
- dependency-name: k8s.io/api
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: k8s-dependencies
- dependency-name: k8s.io/apimachinery
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: k8s-dependencies
- dependency-name: k8s.io/client-go
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: k8s-dependencies
- dependency-name: k8s.io/component-base
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: k8s-dependencies
- dependency-name: k8s.io/sample-controller
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: k8s-dependencies
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-02-15 08:17:23 +00:00
Kubernetes Prow Robot 2a95d4649b
Merge pull request #2606 from kubernetes/dependabot/go_modules/github.com/prometheus/exporter-toolkit-0.14.0
build(deps): Bump github.com/prometheus/exporter-toolkit from 0.13.2 to 0.14.0
2025-02-06 12:17:56 -08:00
dependabot[bot] dc60c09548
build(deps): Bump github.com/prometheus/exporter-toolkit
Bumps [github.com/prometheus/exporter-toolkit](https://github.com/prometheus/exporter-toolkit) from 0.13.2 to 0.14.0.
- [Release notes](https://github.com/prometheus/exporter-toolkit/releases)
- [Changelog](https://github.com/prometheus/exporter-toolkit/blob/master/CHANGELOG.md)
- [Commits](https://github.com/prometheus/exporter-toolkit/compare/v0.13.2...v0.14.0)

---
updated-dependencies:
- dependency-name: github.com/prometheus/exporter-toolkit
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-02-06 20:09:02 +00:00
Kubernetes Prow Robot 4fa35209c1
Merge pull request #2600 from kubernetes/release-2.15
chore: Merge release 2.15 back to main
2025-02-03 22:14:58 -08:00
Kubernetes Prow Robot 4a585c91be
Merge pull request #2599 from mrueg/prep-v2.15.0
chore: Cut v2.15.0
2025-02-03 00:14:57 -08:00
Manuel Rüger 25eda406ea chore: Cut v2.15.0 2025-02-02 23:01:10 +01:00
Kubernetes Prow Robot c7caee60c9
Merge pull request #2553 from L3n41c/fix_gvrfromtype
fix: panic in `util.GVRFromType` for structured types
2025-01-29 04:43:26 -08:00
Kubernetes Prow Robot b6305cb93b
Merge pull request #2598 from mrueg/fix-jsonnet
fix(jsonnet): Fix NoNodePod naming
2025-01-29 04:39:22 -08:00
Kubernetes Prow Robot faf377ea13
Merge pull request #2572 from rexagod/fix-v
fix: make `$VERSION` 3rd-party independant
2025-01-29 04:11:23 -08:00
Manuel Rüger 33250c57f5 jsonnet: Fix NoNodePod naming 2025-01-29 13:05:25 +01:00
Lénaïc Huard c3b1afe61c
Handle the cases where GVRFromType returns neither a GVR nor an error 2025-01-28 21:30:58 +01:00
Kubernetes Prow Robot d4f79cbe7f
Merge pull request #2580 from clavinjune/main
docs(customresourcestate): add example to expose same metrics with different label
2025-01-27 06:31:24 -08:00
Clavianus Juneardo 9cf257a9b3
Merge branch 'kubernetes:main' into main 2025-01-27 19:51:46 +07:00
Clavianus Juneardo afc7bbcd01
docs(customresourcestate): add VPA labels and annotations 2025-01-27 19:50:46 +07:00
Kubernetes Prow Robot 662afca405
Merge pull request #2596 from kubernetes/dependabot/github_actions/actions/setup-go-5.3.0
build(deps): Bump actions/setup-go from 5.2.0 to 5.3.0
2025-01-27 02:07:25 -08:00
dependabot[bot] 21df5706ea
build(deps): Bump actions/setup-go from 5.2.0 to 5.3.0
Bumps [actions/setup-go](https://github.com/actions/setup-go) from 5.2.0 to 5.3.0.
- [Release notes](https://github.com/actions/setup-go/releases)
- [Commits](3041bf56c9...f111f3307d)

---
updated-dependencies:
- dependency-name: actions/setup-go
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-01-27 09:16:39 +00:00
Lénaïc Huard 61134a08b6
Return an error instead of only logging 2025-01-23 15:55:11 +01:00
Clavianus Juneardo 0c69b3567a
docs(customresourcestate): fix naming discrepancies on VPA 2025-01-21 11:04:13 +07:00
Kubernetes Prow Robot 288b3cf855
Merge pull request #2559 from RiRa12621/main
fix(kube_pod_tolerations): deduplicate tolerations before creating metric
2025-01-19 23:58:35 -08:00
Kubernetes Prow Robot 88ef004119
Merge pull request #2593 from kubernetes/dependabot/go_modules/github.com/prometheus/common-0.62.0
build(deps): Bump github.com/prometheus/common from 0.61.0 to 0.62.0
2025-01-17 05:54:34 -08:00
dependabot[bot] 9f3ebac101
build(deps): Bump github.com/prometheus/common from 0.61.0 to 0.62.0
Bumps [github.com/prometheus/common](https://github.com/prometheus/common) from 0.61.0 to 0.62.0.
- [Release notes](https://github.com/prometheus/common/releases)
- [Changelog](https://github.com/prometheus/common/blob/main/RELEASE.md)
- [Commits](https://github.com/prometheus/common/compare/v0.61.0...v0.62.0)

---
updated-dependencies:
- dependency-name: github.com/prometheus/common
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-01-17 13:45:33 +00:00
Kubernetes Prow Robot 3b72e1943b
Merge pull request #2592 from kubernetes/dependabot/go_modules/k8s-dependencies-e08fda7a5c
build(deps): Bump the k8s-dependencies group across 1 directory with 4 updates
2025-01-16 11:46:34 -08:00
Manuel Rüger ee0d05d15a docs: Add k8s 1.32 2025-01-16 19:02:07 +01:00
dependabot[bot] ecf94572bf
build(deps): Bump the k8s-dependencies group across 1 directory with 4 updates
Bumps the k8s-dependencies group with 4 updates in the / directory: [k8s.io/apimachinery](https://github.com/kubernetes/apimachinery), [k8s.io/client-go](https://github.com/kubernetes/client-go), [k8s.io/component-base](https://github.com/kubernetes/component-base) and [k8s.io/sample-controller](https://github.com/kubernetes/sample-controller).


Updates `k8s.io/apimachinery` from 0.31.3 to 0.32.1
- [Commits](https://github.com/kubernetes/apimachinery/compare/v0.31.3...v0.32.1)

Updates `k8s.io/client-go` from 0.31.3 to 0.32.1
- [Changelog](https://github.com/kubernetes/client-go/blob/master/CHANGELOG.md)
- [Commits](https://github.com/kubernetes/client-go/compare/v0.31.3...v0.32.1)

Updates `k8s.io/component-base` from 0.31.3 to 0.32.1
- [Commits](https://github.com/kubernetes/component-base/compare/v0.31.3...v0.32.1)

Updates `k8s.io/sample-controller` from 0.31.3 to 0.32.1
- [Commits](https://github.com/kubernetes/sample-controller/compare/v0.31.3...v0.32.1)

---
updated-dependencies:
- dependency-name: k8s.io/apimachinery
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: k8s-dependencies
- dependency-name: k8s.io/client-go
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: k8s-dependencies
- dependency-name: k8s.io/component-base
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: k8s-dependencies
- dependency-name: k8s.io/sample-controller
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: k8s-dependencies
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-01-16 08:57:40 +00:00
Kubernetes Prow Robot c198a18d28
Merge pull request #2588 from kubernetes/dependabot/go_modules/github.com/KimMachineGun/automemlimit-0.7.0
build(deps): Bump github.com/KimMachineGun/automemlimit from 0.6.1 to 0.7.0
2025-01-08 04:12:30 -08:00
dependabot[bot] 4955306dfa
build(deps): Bump github.com/KimMachineGun/automemlimit
Bumps [github.com/KimMachineGun/automemlimit](https://github.com/KimMachineGun/automemlimit) from 0.6.1 to 0.7.0.
- [Release notes](https://github.com/KimMachineGun/automemlimit/releases)
- [Commits](https://github.com/KimMachineGun/automemlimit/compare/v0.6.1...v0.7.0)

---
updated-dependencies:
- dependency-name: github.com/KimMachineGun/automemlimit
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-01-08 12:03:37 +00:00
Kubernetes Prow Robot 1e06e16967
Merge pull request #2584 from jahantech/ksm-traffic-policy-metrics-cla
feat: Add External traffic policy to kube_service_info
2025-01-07 11:16:29 -08:00
clavinjune 387bd8b244
docs(customresourestate): fix All VerticalPodAutoscaler Metrics section
Signed-off-by: clavinjune <24659468+clavinjune@users.noreply.github.com>
2025-01-07 16:54:54 +07:00
clavinjune ae38bc4e67
docs(customresourestate): fix All VerticalPodAutoscaler Metrics section
Signed-off-by: clavinjune <24659468+clavinjune@users.noreply.github.com>
2025-01-07 16:53:54 +07:00
clavinjune 89f8110d61
docs(customresourestate): add example to re-expose all VPA metrics
Signed-off-by: clavinjune <24659468+clavinjune@users.noreply.github.com>
2025-01-07 16:51:46 +07:00
jahantech 0591d0bd71 feat: Add External traffic policy to kube_service_info 2025-01-02 14:41:08 +00:00
jahantech 279f84b095 feat: Add External traffic policy to kube_service_info 2025-01-02 14:38:47 +00:00
clavinjune 1412eaa183
docs(customresourestate): add kind on the example
Signed-off-by: clavinjune <24659468+clavinjune@users.noreply.github.com>
2024-12-23 17:07:39 +07:00
clavinjune a4d64fb993
docs(customresourestate): add example to expose same metrics with different label
Signed-off-by: clavinjune <24659468+clavinjune@users.noreply.github.com>
2024-12-23 17:02:00 +07:00
Kubernetes Prow Robot d3f0c1853f
Merge pull request #2577 from dashpole/update_om_links
docs: update links to openmetrics to reference the v1.0.0 release
2024-12-16 21:50:52 +01:00
David Ashpole 6cfc844ca0
update links to openmetrics to reference the v1.0.0 release
Signed-off-by: David Ashpole <dashpole@google.com>
2024-12-16 20:24:02 +00:00
Kubernetes Prow Robot b5abea9294
Merge pull request #2576 from kubernetes/dependabot/go_modules/github.com/prometheus/exporter-toolkit-0.13.2
build(deps): Bump github.com/prometheus/exporter-toolkit from 0.13.1 to 0.13.2
2024-12-15 23:34:43 +01:00
Kubernetes Prow Robot 543738ba62
Merge pull request #2574 from kubernetes/dependabot/github_actions/actions/setup-go-5.2.0
build(deps): Bump actions/setup-go from 5.1.0 to 5.2.0
2024-12-15 23:32:43 +01:00
dependabot[bot] 7c2b8b5c09
build(deps): Bump github.com/prometheus/exporter-toolkit
Bumps [github.com/prometheus/exporter-toolkit](https://github.com/prometheus/exporter-toolkit) from 0.13.1 to 0.13.2.
- [Release notes](https://github.com/prometheus/exporter-toolkit/releases)
- [Changelog](https://github.com/prometheus/exporter-toolkit/blob/master/CHANGELOG.md)
- [Commits](https://github.com/prometheus/exporter-toolkit/compare/v0.13.1...v0.13.2)

---
updated-dependencies:
- dependency-name: github.com/prometheus/exporter-toolkit
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-12-15 22:26:06 +00:00
dependabot[bot] ace5a4b236
build(deps): Bump actions/setup-go from 5.1.0 to 5.2.0
Bumps [actions/setup-go](https://github.com/actions/setup-go) from 5.1.0 to 5.2.0.
- [Release notes](https://github.com/actions/setup-go/releases)
- [Commits](41dfa10bad...3041bf56c9)

---
updated-dependencies:
- dependency-name: actions/setup-go
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-12-15 22:25:29 +00:00
Kubernetes Prow Robot 36318bb970
Merge pull request #2573 from davidxia/patch-1
style: fix warning during docker build
2024-12-12 23:02:26 +01:00
David Xia ea3f5fac90
style: fix warning during docker build
by addressing the warning below.

```
make container
...

 2 warnings found (use --debug to expand):
 - FromAsCasing: 'as' and 'FROM' keywords' casing do not match (line 3)
```
2024-12-12 14:19:33 -05:00
Kubernetes Prow Robot fb28420d3c
Merge pull request #2556 from mrueg/housekeeping
chore: Bump versions
2024-12-11 16:14:04 +00:00
Pranshu Srivastava 4bce5ea4bd
regression: make `$VERSION` 3rd-party independant
3rd-party dependencies cannot be installed pre-build since Makefile
variables are initialized earlier than that.

Signed-off-by: Pranshu Srivastava <rexagod@gmail.com>
2024-12-11 20:24:38 +05:30
Lénaïc Huard 4a96a782fc
Log an error instead of panicking 2024-12-10 17:49:40 +01:00
Kubernetes Prow Robot 5e332b307a
Merge pull request #2570 from kubernetes/dependabot/go_modules/github.com/prometheus/common-0.61.0
build(deps): Bump github.com/prometheus/common from 0.60.1 to 0.61.0
2024-12-09 09:58:03 +00:00
dependabot[bot] 69ce9757f5
build(deps): Bump github.com/prometheus/common from 0.60.1 to 0.61.0
Bumps [github.com/prometheus/common](https://github.com/prometheus/common) from 0.60.1 to 0.61.0.
- [Release notes](https://github.com/prometheus/common/releases)
- [Changelog](https://github.com/prometheus/common/blob/main/RELEASE.md)
- [Commits](https://github.com/prometheus/common/compare/v0.60.1...v0.61.0)

---
updated-dependencies:
- dependency-name: github.com/prometheus/common
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-12-09 09:22:54 +00:00
Kubernetes Prow Robot ca0df61115
Merge pull request #2567 from chelseychen/fix-ResolveGVKToGVKPs
fix: Fix CR cache for GVK all specified case
2024-12-05 08:38:00 +00:00
Chelsey Chen 56316019cd Fix CR cache for GVK all specified case 2024-12-05 03:23:04 +00:00
Kubernetes Prow Robot 32e7727ff4
Merge pull request #2528 from mrueg/metrics-best-practices
docs: Add best practices for metrics
2024-11-27 15:48:57 +00:00
Kubernetes Prow Robot 9652811b2f
Merge pull request #2415 from pwschuurman/kep-3335-stable-metrics
feat: Promote kube_statefulset_ordinals_start from ALPHA -> STABLE
2024-11-25 20:51:01 +00:00
Peter Schuurman 098e785d08 Promote kube_statefulset_ordinals_start from ALPHA -> STABLE 2024-11-25 10:55:34 -08:00
Kubernetes Prow Robot c4565c44b9
Merge pull request #2562 from kubernetes/dependabot/go_modules/github.com/stretchr/testify-1.10.0
build(deps): Bump github.com/stretchr/testify from 1.9.0 to 1.10.0
2024-11-25 11:34:56 +00:00
dependabot[bot] ce98457f1b
build(deps): Bump github.com/stretchr/testify from 1.9.0 to 1.10.0
Bumps [github.com/stretchr/testify](https://github.com/stretchr/testify) from 1.9.0 to 1.10.0.
- [Release notes](https://github.com/stretchr/testify/releases)
- [Commits](https://github.com/stretchr/testify/compare/v1.9.0...v1.10.0)

---
updated-dependencies:
- dependency-name: github.com/stretchr/testify
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-11-25 10:02:51 +00:00
Kubernetes Prow Robot 76308fc8b8
Merge pull request #2561 from kubernetes/dependabot/go_modules/k8s-dependencies-58b4af6dfc
build(deps): Bump the k8s-dependencies group with 5 updates
2024-11-22 10:28:58 +00:00
dependabot[bot] b3ac231a32
build(deps): Bump the k8s-dependencies group with 5 updates
Bumps the k8s-dependencies group with 5 updates:

| Package | From | To |
| --- | --- | --- |
| [k8s.io/api](https://github.com/kubernetes/api) | `0.31.2` | `0.31.3` |
| [k8s.io/apimachinery](https://github.com/kubernetes/apimachinery) | `0.31.2` | `0.31.3` |
| [k8s.io/client-go](https://github.com/kubernetes/client-go) | `0.31.2` | `0.31.3` |
| [k8s.io/component-base](https://github.com/kubernetes/component-base) | `0.31.2` | `0.31.3` |
| [k8s.io/sample-controller](https://github.com/kubernetes/sample-controller) | `0.31.2` | `0.31.3` |


Updates `k8s.io/api` from 0.31.2 to 0.31.3
- [Commits](https://github.com/kubernetes/api/compare/v0.31.2...v0.31.3)

Updates `k8s.io/apimachinery` from 0.31.2 to 0.31.3
- [Commits](https://github.com/kubernetes/apimachinery/compare/v0.31.2...v0.31.3)

Updates `k8s.io/client-go` from 0.31.2 to 0.31.3
- [Changelog](https://github.com/kubernetes/client-go/blob/master/CHANGELOG.md)
- [Commits](https://github.com/kubernetes/client-go/compare/v0.31.2...v0.31.3)

Updates `k8s.io/component-base` from 0.31.2 to 0.31.3
- [Commits](https://github.com/kubernetes/component-base/compare/v0.31.2...v0.31.3)

Updates `k8s.io/sample-controller` from 0.31.2 to 0.31.3
- [Commits](https://github.com/kubernetes/sample-controller/compare/v0.31.2...v0.31.3)

---
updated-dependencies:
- dependency-name: k8s.io/api
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: k8s-dependencies
- dependency-name: k8s.io/apimachinery
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: k8s-dependencies
- dependency-name: k8s.io/client-go
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: k8s-dependencies
- dependency-name: k8s.io/component-base
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: k8s-dependencies
- dependency-name: k8s.io/sample-controller
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: k8s-dependencies
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-11-22 10:20:23 +00:00
Rick Rackow 20f30233bd
fix(kube_pod_tolerations): test duplicate toleration 2024-11-21 17:49:07 +01:00
Rick Rackow 170bbd4c62
fix(kube_pod_tolerations): deduplicate tolerations before creating metric 2024-11-21 17:41:18 +01:00
Kubernetes Prow Robot ea5826a92c
Merge pull request #2376 from mrueg/cronjob-add-timezone
feat: Add timezone to kube_cronjob_info / Make kube_cronjob_next_schedule_time timezone-aware
2024-11-14 14:25:17 +00:00
Manuel Rüger dcfaae9890 Add some info about 1:1/1:n relationships 2024-11-14 10:22:03 +01:00
Manuel Rüger 0ee2640bb9 chore: Bump kind to 0.25.0 2024-11-14 10:10:52 +01:00
Manuel Rüger 7657b02cd2 chore: Bump markdown linter to v0.15.0 2024-11-14 10:10:21 +01:00
Manuel Rüger f09d015f43 chore: Dockerfile - Switch to supported distroless image
https://github.com/GoogleContainerTools/distroless says:
Any other tags are considered deprecated and are no longer updated
2024-11-14 10:09:45 +01:00
Manuel Rüger acbf6d390b chore: Update cloudbuild image
and extend timeout to 45m
2024-11-14 10:07:57 +01:00
Manuel Rüger 7ac99685c1 Update docs/design/metrics-best-practices.md
Co-authored-by: Ben Kochie <superq@gmail.com>
2024-11-14 09:57:19 +01:00
Manuel Rüger 690b9627f5 Include more comments from the review 2024-11-14 09:57:19 +01:00
Manuel Rüger 7677b414e0 Update docs/design/metrics-best-practices.md
Co-authored-by: Ben Kochie <superq@gmail.com>
2024-11-14 09:57:19 +01:00
Manuel Rüger cacc980de3 Update docs/design/metrics-best-practices.md
Co-authored-by: Ben Kochie <superq@gmail.com>
2024-11-14 09:57:19 +01:00
Manuel Rüger 3736c9aa82 docs: Add best practices for metrics 2024-11-14 09:57:19 +01:00
Lénaïc Huard 8859a4289d
Fix a panic in GVRFromType for structured types 2024-11-08 20:20:07 +01:00
Kubernetes Prow Robot 17151aca65
Merge pull request #2552 from kubernetes/release-2.14
chore: Merge Release 2.14 back to main
2024-11-08 13:08:43 +00:00
Kubernetes Prow Robot e763ea2aa3
Merge pull request #2538 from mrueg/prep-2.14.0
chore: Cut v2.14.0
2024-11-08 09:52:43 +00:00
Manuel Rüger b4d98d7b40 chore: Cut v2.14.0 2024-11-08 10:44:20 +01:00
Kubernetes Prow Robot 77e564ba5d
Merge pull request #2536 from Haleygo/fix-custom-metric-value-conversion
fix(custom resource state metrics): correctly convert status condition `Unknown` to a valid value
2024-11-08 09:40:43 +00:00
Manuel Rüger cad704d488
Update pkg/customresourcestate/registry_factory.go 2024-11-08 10:32:59 +01:00
Manuel Rüger d7d2d89017
Update docs/metrics/extend/customresourcestate-metrics.md 2024-11-08 10:32:47 +01:00
Kubernetes Prow Robot 0bcfd5bba5
Merge pull request #2548 from mrueg/go-1.23.3
chore: Bump versions
2024-11-08 09:20:43 +00:00
Kubernetes Prow Robot b6499c9af7
Merge pull request #2547 from Henrywu573/myfeature
fix: Remove redundant factories array since it is not written after
2024-11-07 20:02:44 +00:00
Kubernetes Prow Robot 5e7d0f4523
Merge pull request #2542 from Indresh2410/add-kube-job-status-suspended-metric
feat: Add new metric kube_job_status_suspended
2024-11-07 19:56:44 +00:00
Manuel Rüger c5665b69bf chore: Bump versions 2024-11-07 20:00:33 +01:00
Indresh2410 7a54a8ebf0
Add new line 2024-11-07 05:52:47 +00:00
Indresh2410 b2c8fa7837 Address Review Comments 2024-11-07 04:36:30 +00:00
Indresh2410 ba7ff1a0e5 Address Review Comments 2024-11-07 04:36:30 +00:00
Indresh2410 34abbcf202 Address Review Comments 2024-11-07 04:36:30 +00:00
Indresh-Prakash 076987a505 Add kube_job_status_suspended metric 2024-11-07 04:36:30 +00:00
Henry Wu 1734bd8403 Remove redundant factories array since it is not written after
construction.
2024-11-07 00:07:36 +00:00
Kubernetes Prow Robot c87b507116
Merge pull request #2546 from mrueg/fix-ci
chore: Fix broken CI
2024-11-06 19:17:30 +00:00
Manuel Rüger 9c61d7ea81 chore: Fix broken CI 2024-11-06 17:43:35 +01:00
Kubernetes Prow Robot c804368d08
Merge pull request #2545 from mrueg/fix-benchmarks
chore: Improve benchmarks
2024-11-06 11:23:32 +00:00
Manuel Rüger fa27721993
Update .github/workflows/ci.yml
Co-authored-by: Pranshu Srivastava <prasriva@redhat.com>
2024-11-06 11:35:23 +01:00
Manuel Rüger 0303532851 chore: Integrate benchmark output in GHA
The code comes from ivanvc in https://github.com/etcd-io/bbolt/pull/750
2024-11-06 10:29:43 +01:00
Manuel Rüger 02b6a214c6 chore: Run the benchmark for two rounds 2024-11-06 09:43:00 +01:00
Manuel Rüger b0e9be550b fix: Remove log output from benchmark
Without this change Info logs appear in the benchmark

ok      k8s.io/kube-state-metrics/v2/pkg/allowdenylist  0.005s
I1106 08:50:22.006480  144965 builder.go:280] "Active resources" activeStoreNames="certificatesigningrequests,configmaps,cronjobs,daemonsets,deployments,endpoints,horizontalpodautoscalers,ingresses,jobs,leases,limitranges,mutatingwebhookconfigurations,namespaces,networkpolicies,nodes,persistentvolumeclaims,persistentvolumes,poddisruptionbudgets,pods,replicasets,replicationcontrollers,resourcequotas,secrets,services,statefulsets,storageclasses,validatingwebhookconfigurations,volumeattachments"
goos: linux
goarch: amd64
pkg: k8s.io/kube-state-metrics/v2/pkg/app
cpu: Intel(R) Core(TM) i7-1065G7 CPU @ 1.30GHz
BenchmarkKubeStateMetrics/GenerateMetrics-8                    1        1001291639 ns/op        67578008 B/op     582810 allocs/op
2024-11-06 09:43:00 +01:00
Manuel Rüger fac6119d43 chore: Allow setting rounds in benchmark 2024-11-05 23:06:10 +01:00
Kubernetes Prow Robot 0738de0be2
Merge pull request #2539 from mrueg/expose-empty-labels
fix: expose empty labels
2024-11-05 20:41:30 +00:00
Kubernetes Prow Robot dfb688c966
Merge pull request #2510 from rarruda/fix/reduce_locking
perf: use concurrent map when storing metrics
2024-11-05 19:47:30 +00:00
Kubernetes Prow Robot 61a1993fdc
Merge pull request #2540 from leiwingqueen/fix-value-overflow
fix: big memory overflow
2024-11-05 10:07:29 +00:00
Manuel Rüger c67f02f0f3
Apply suggestions from code review 2024-11-05 10:58:10 +01:00
leiwingqueen 7980f03c52 fix convert float64 error 2024-11-05 00:02:19 +08:00
leiwingqueen 37f10f0602 fix lint 2024-11-04 23:33:53 +08:00
Kubernetes Prow Robot ca66c9d344
Merge pull request #2543 from kubernetes/dependabot/go_modules/github.com/fsnotify/fsnotify-1.8.0
build(deps): Bump github.com/fsnotify/fsnotify from 1.7.0 to 1.8.0
2024-11-04 12:47:29 +00:00
dependabot[bot] ea648da9c6
build(deps): Bump github.com/fsnotify/fsnotify from 1.7.0 to 1.8.0
Bumps [github.com/fsnotify/fsnotify](https://github.com/fsnotify/fsnotify) from 1.7.0 to 1.8.0.
- [Release notes](https://github.com/fsnotify/fsnotify/releases)
- [Changelog](https://github.com/fsnotify/fsnotify/blob/main/CHANGELOG.md)
- [Commits](https://github.com/fsnotify/fsnotify/compare/v1.7.0...v1.8.0)

---
updated-dependencies:
- dependency-name: github.com/fsnotify/fsnotify
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-11-04 09:08:25 +00:00
Haley Wang 70088ed1ea
apply review comment 2024-11-04 16:38:57 +08:00
leiwingqueen f94ef65cc7 fix overflow in other occasion 2024-11-04 10:09:18 +08:00
leiwingqueen e5eb2ed132 fix lint error 2024-11-02 22:16:15 +08:00
leiwingqueen 2c346763cf change convertValueToFloat64 function name 2024-11-02 09:55:35 +08:00
leiwingqueen 31f793129f fix big memory overflow 2024-11-01 16:16:08 +08:00
Manuel Rüger 2aa766ee03 serviceaccounts: Expose empty labels 2024-10-31 17:40:32 +01:00
Manuel Rüger 9f15cc1c8c pods: Expose empty labels 2024-10-31 17:40:10 +01:00
Manuel Rüger 63749c5d15 endpoints: Expose empty labels 2024-10-31 14:30:49 +01:00
Manuel Rüger 75e7841c10 endpointslices: Expose empty labels 2024-10-31 14:30:49 +01:00
Kubernetes Prow Robot 3c6bc83911
Merge pull request #2537 from kubernetes/dependabot/go_modules/github.com/prometheus/exporter-toolkit-0.13.1
build(deps): Bump github.com/prometheus/exporter-toolkit from 0.13.0 to 0.13.1
2024-10-30 11:39:25 +00:00
dependabot[bot] c24e50d042
build(deps): Bump github.com/prometheus/exporter-toolkit
Bumps [github.com/prometheus/exporter-toolkit](https://github.com/prometheus/exporter-toolkit) from 0.13.0 to 0.13.1.
- [Release notes](https://github.com/prometheus/exporter-toolkit/releases)
- [Changelog](https://github.com/prometheus/exporter-toolkit/blob/master/CHANGELOG.md)
- [Commits](https://github.com/prometheus/exporter-toolkit/compare/v0.13.0...v0.13.1)

---
updated-dependencies:
- dependency-name: github.com/prometheus/exporter-toolkit
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-10-30 11:29:29 +00:00
Haley Wang 17c69692c4
fix(custom resource state metrics): corrctly convert status condition `Unknown` to a valid value 2024-10-29 13:55:40 +08:00
Kubernetes Prow Robot eb5e34701d
Merge pull request #2535 from L3n41c/fix_gvrfromtype
fix: panic in `util.GVRFromType` for core objects
2024-10-27 12:02:54 +00:00
Lénaïc Huard 110f03d733
Fix a panic in GVRFromType for core objects 2024-10-25 14:11:56 +02:00
Kubernetes Prow Robot 45b7e20ee3
Merge pull request #2531 from kubernetes/dependabot/github_actions/actions/setup-go-5.1.0
build(deps): Bump actions/setup-go from 5.0.2 to 5.1.0
2024-10-25 01:22:52 +01:00
Kubernetes Prow Robot 2db568c4fc
Merge pull request #2533 from kubernetes/dependabot/go_modules/k8s-dependencies-61858d65be
build(deps): Bump the k8s-dependencies group with 5 updates
2024-10-25 01:14:52 +01:00
dependabot[bot] 3b5c6240a9
build(deps): Bump actions/setup-go from 5.0.2 to 5.1.0
Bumps [actions/setup-go](https://github.com/actions/setup-go) from 5.0.2 to 5.1.0.
- [Release notes](https://github.com/actions/setup-go/releases)
- [Commits](0a12ed9d6a...41dfa10bad)

---
updated-dependencies:
- dependency-name: actions/setup-go
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-10-25 00:13:02 +00:00
Kubernetes Prow Robot 32d5ab5ac5
Merge pull request #2534 from kubernetes/dependabot/go_modules/github.com/prometheus/common-0.60.1
build(deps): Bump github.com/prometheus/common from 0.60.0 to 0.60.1
2024-10-25 01:12:52 +01:00
Kubernetes Prow Robot 7574addd80
Merge pull request #2532 from kubernetes/dependabot/github_actions/actions/checkout-4.2.2
build(deps): Bump actions/checkout from 4.2.1 to 4.2.2
2024-10-25 01:10:52 +01:00
dependabot[bot] 51f854f305
build(deps): Bump github.com/prometheus/common from 0.60.0 to 0.60.1
Bumps [github.com/prometheus/common](https://github.com/prometheus/common) from 0.60.0 to 0.60.1.
- [Release notes](https://github.com/prometheus/common/releases)
- [Changelog](https://github.com/prometheus/common/blob/main/RELEASE.md)
- [Commits](https://github.com/prometheus/common/compare/v0.60.0...v0.60.1)

---
updated-dependencies:
- dependency-name: github.com/prometheus/common
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-10-25 00:03:46 +00:00
dependabot[bot] 2dacb29426
build(deps): Bump the k8s-dependencies group with 5 updates
Bumps the k8s-dependencies group with 5 updates:

| Package | From | To |
| --- | --- | --- |
| [k8s.io/api](https://github.com/kubernetes/api) | `0.31.1` | `0.31.2` |
| [k8s.io/apimachinery](https://github.com/kubernetes/apimachinery) | `0.31.1` | `0.31.2` |
| [k8s.io/client-go](https://github.com/kubernetes/client-go) | `0.31.1` | `0.31.2` |
| [k8s.io/component-base](https://github.com/kubernetes/component-base) | `0.31.1` | `0.31.2` |
| [k8s.io/sample-controller](https://github.com/kubernetes/sample-controller) | `0.31.1` | `0.31.2` |


Updates `k8s.io/api` from 0.31.1 to 0.31.2
- [Commits](https://github.com/kubernetes/api/compare/v0.31.1...v0.31.2)

Updates `k8s.io/apimachinery` from 0.31.1 to 0.31.2
- [Commits](https://github.com/kubernetes/apimachinery/compare/v0.31.1...v0.31.2)

Updates `k8s.io/client-go` from 0.31.1 to 0.31.2
- [Changelog](https://github.com/kubernetes/client-go/blob/master/CHANGELOG.md)
- [Commits](https://github.com/kubernetes/client-go/compare/v0.31.1...v0.31.2)

Updates `k8s.io/component-base` from 0.31.1 to 0.31.2
- [Commits](https://github.com/kubernetes/component-base/compare/v0.31.1...v0.31.2)

Updates `k8s.io/sample-controller` from 0.31.1 to 0.31.2
- [Commits](https://github.com/kubernetes/sample-controller/compare/v0.31.1...v0.31.2)

---
updated-dependencies:
- dependency-name: k8s.io/api
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: k8s-dependencies
- dependency-name: k8s.io/apimachinery
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: k8s-dependencies
- dependency-name: k8s.io/client-go
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: k8s-dependencies
- dependency-name: k8s.io/component-base
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: k8s-dependencies
- dependency-name: k8s.io/sample-controller
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: k8s-dependencies
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-10-25 00:03:39 +00:00
dependabot[bot] f3ff773d31
build(deps): Bump actions/checkout from 4.2.1 to 4.2.2
Bumps [actions/checkout](https://github.com/actions/checkout) from 4.2.1 to 4.2.2.
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](eef61447b9...11bd71901b)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-10-25 00:03:10 +00:00
Kubernetes Prow Robot 9652c29fe6
Merge pull request #2529 from kubernetes/dependabot/github_actions/kubernetes-sigs/release-actions-0.3.0
build(deps): Bump kubernetes-sigs/release-actions from 0.2.0 to 0.3.0
2024-10-21 11:41:05 +01:00
Kubernetes Prow Robot 5c43e10fa0
Merge pull request #2530 from kubernetes/dependabot/go_modules/github.com/prometheus/client_golang-1.20.5
build(deps): Bump github.com/prometheus/client_golang from 1.20.4 to 1.20.5
2024-10-21 11:39:05 +01:00
dependabot[bot] f9c945aef5
build(deps): Bump github.com/prometheus/client_golang
Bumps [github.com/prometheus/client_golang](https://github.com/prometheus/client_golang) from 1.20.4 to 1.20.5.
- [Release notes](https://github.com/prometheus/client_golang/releases)
- [Changelog](https://github.com/prometheus/client_golang/blob/main/CHANGELOG.md)
- [Commits](https://github.com/prometheus/client_golang/compare/v1.20.4...v1.20.5)

---
updated-dependencies:
- dependency-name: github.com/prometheus/client_golang
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-10-21 10:03:28 +00:00
dependabot[bot] 0a331e1a60
build(deps): Bump kubernetes-sigs/release-actions from 0.2.0 to 0.3.0
Bumps [kubernetes-sigs/release-actions](https://github.com/kubernetes-sigs/release-actions) from 0.2.0 to 0.3.0.
- [Release notes](https://github.com/kubernetes-sigs/release-actions/releases)
- [Changelog](https://github.com/kubernetes-sigs/release-actions/blob/main/RELEASE.md)
- [Commits](2f8b9ec22a...a69972745f)

---
updated-dependencies:
- dependency-name: kubernetes-sigs/release-actions
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-10-21 09:12:08 +00:00
Kubernetes Prow Robot e14a9d771c
Merge pull request #2503 from mrueg/issue-2408
feat: Move endpoint ports into address metric
2024-10-20 11:23:03 +01:00
Manuel Rüger ea7034553f feat(endpoints): Move ports into address metric
This marks kube_endpoint_ports as deprecated
2024-10-17 23:45:01 +02:00
Kubernetes Prow Robot 75fba81cf3
Merge pull request #2527 from mrueg/rm-deprecated-metric
chore: Remove deprecated endpoint address metric
2024-10-16 13:29:05 +01:00
Manuel Rüger 28129e4d6d chore: Remove deprecated endpoint address metric
This was deprecated in 2022 in https://github.com/kubernetes/kube-state-metrics/pull/1761
2024-10-16 09:42:33 +02:00
Kubernetes Prow Robot e29519112d
Merge pull request #2526 from mrueg/fix-govulncheck
fix: update govulncheck's go version to 1.23
2024-10-16 06:29:03 +01:00
Manuel Rüger d7f7bd5297 fix: Add missed go 1.23 updates 2024-10-15 23:20:19 +02:00
Manuel Rüger 90e7e1178c fix: update govulncheck's go version to 1.23 2024-10-15 23:18:19 +02:00
Kubernetes Prow Robot f3b7593031
Merge pull request #2478 from wallee94/remove-shard-validation-on-sts-create
fix(discovery): configure sharding every time MetricsHandler.Run runs
2024-10-15 09:20:22 +01:00
Kubernetes Prow Robot 77a99a52c5
Merge pull request #2502 from bartlettc22/cr-duplication-fix
fix: de-duplication of custom resource metrics
2024-10-15 09:18:22 +01:00
Manuel Rüger bd6beed33b
Update internal/store/builder_test.go 2024-10-15 09:52:29 +02:00
Kubernetes Prow Robot 0013d73987
Merge pull request #2524 from kubernetes/dependabot/github_actions/actions/checkout-4.2.1
build(deps): Bump actions/checkout from 4.2.0 to 4.2.1
2024-10-14 10:46:21 +01:00
dependabot[bot] 4356a0f66e
build(deps): Bump actions/checkout from 4.2.0 to 4.2.1
Bumps [actions/checkout](https://github.com/actions/checkout) from 4.2.0 to 4.2.1.
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](d632683dd7...eef61447b9)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-10-14 09:28:56 +00:00
Kubernetes Prow Robot a936341496
Merge pull request #2519 from kubernetes/dependabot/go_modules/github.com/prometheus/common-0.60.0
build(deps): Bump github.com/prometheus/common from 0.59.1 to 0.60.0
2024-10-07 12:44:21 +01:00
dependabot[bot] cd29fabd66
build(deps): Bump github.com/prometheus/common from 0.59.1 to 0.60.0
Bumps [github.com/prometheus/common](https://github.com/prometheus/common) from 0.59.1 to 0.60.0.
- [Release notes](https://github.com/prometheus/common/releases)
- [Changelog](https://github.com/prometheus/common/blob/main/RELEASE.md)
- [Commits](https://github.com/prometheus/common/compare/v0.59.1...v0.60.0)

---
updated-dependencies:
- dependency-name: github.com/prometheus/common
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-10-07 09:15:51 +00:00
Chris Bartlett de58db2ed4
restructure testing logic
Co-authored-by: Pranshu Srivastava <prasriva@redhat.com>
2024-10-01 13:35:32 -06:00
Walther Lee 166921b797 fix typo in comments 2024-09-30 10:46:42 -07:00
Walther Lee 7b375e9ef4 undo changes in internal/store/builder.go 2024-09-30 09:21:42 -07:00
Kubernetes Prow Robot 2c5a2499f0
Merge pull request #2509 from kevinwangcn/fix-security-issue
chore: Fix the security issue about sirupsen/logrus
2024-09-30 15:34:04 +01:00
Kubernetes Prow Robot 49b25a87b9
Merge pull request #2515 from kubernetes/dependabot/github_actions/actions/checkout-4.2.0
build(deps): Bump actions/checkout from 4.1.7 to 4.2.0
2024-09-30 15:26:02 +01:00
Kubernetes Prow Robot f7ac762056
Merge pull request #2492 from mrueg/k8s-1.31
chore: Bump to kubernetes 1.31.0
2024-09-30 15:24:04 +01:00
dependabot[bot] ecbb910841
build(deps): Bump actions/checkout from 4.1.7 to 4.2.0
Bumps [actions/checkout](https://github.com/actions/checkout) from 4.1.7 to 4.2.0.
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](692973e3d9...d632683dd7)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-09-30 09:55:48 +00:00
Renato Arruda f2a76390e1 lint 2024-09-26 14:02:08 +02:00
Renato Arruda 3e2d1e9d9a perf: use concurrent map when storing metrics
In busy/large clusters, will prevent timeouts from long living
locks/concurrency issues, as the writing to the map takes overly long,
blocking the metrics-reading thread and as the lock doesn't get released
in a timely manner, timing out the request.

Inpired by previous PR at https://github.com/kubernetes/kube-state-metrics/pull/1028
2024-09-25 12:02:36 +02:00
Kevin Wang ba9eb94f51
chore: Fix the security issue about sirupsen/logrus 2024-09-24 18:27:24 -04:00
Walther Lee 294163d5d6 Merge branch 'main' into remove-shard-validation-on-sts-create 2024-09-24 12:18:42 -07:00
Walther Lee fb46163add fix ciclomatic complexity lint in TestVariableVKsDiscoveryAndResolution 2024-09-24 12:17:58 -07:00
Manuel Rüger f7ec4da618 chore: Bump to kubernetes 1.31
Breaking change for node metrics, as kube-proxy field is deprecated and
contains invalid information.

See also
https://kubernetes.io/blog/2024/07/19/kubernetes-1-31-upcoming-changes/#deprecation-of-status-nodeinfo-kubeproxyversion-field-for-nodes-kep-4004-https-github-com-kubernetes-enhancements-issues-4004
2024-09-24 13:25:41 +02:00
Kubernetes Prow Robot f50205a4df
Merge pull request #2508 from mrueg/switch-to-slog
chore: Migrate to slog for exporter-toolkit
2024-09-24 11:56:03 +01:00
Manuel Rüger 4b420cb6f7 chore: Migrate to slog 2024-09-23 22:12:23 +02:00
Kubernetes Prow Robot 826134a3ff
Merge pull request #2506 from kubernetes/dependabot/go_modules/github.com/gobuffalo/flect-1.0.3
build(deps): Bump github.com/gobuffalo/flect from 1.0.2 to 1.0.3
2024-09-23 12:28:00 +01:00
dependabot[bot] 9322447ced
build(deps): Bump github.com/gobuffalo/flect from 1.0.2 to 1.0.3
Bumps [github.com/gobuffalo/flect](https://github.com/gobuffalo/flect) from 1.0.2 to 1.0.3.
- [Release notes](https://github.com/gobuffalo/flect/releases)
- [Commits](https://github.com/gobuffalo/flect/compare/v1.0.2...v1.0.3)

---
updated-dependencies:
- dependency-name: github.com/gobuffalo/flect
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-09-23 11:04:56 +00:00
Kubernetes Prow Robot 0b64d71e6b
Merge pull request #2505 from kubernetes/dependabot/go_modules/github.com/prometheus/client_golang-1.20.4
build(deps): Bump github.com/prometheus/client_golang from 1.20.3 to 1.20.4
2024-09-23 12:04:00 +01:00
dependabot[bot] f2ab628d2b
build(deps): Bump github.com/prometheus/client_golang
Bumps [github.com/prometheus/client_golang](https://github.com/prometheus/client_golang) from 1.20.3 to 1.20.4.
- [Release notes](https://github.com/prometheus/client_golang/releases)
- [Changelog](https://github.com/prometheus/client_golang/blob/main/CHANGELOG.md)
- [Commits](https://github.com/prometheus/client_golang/compare/v1.20.3...v1.20.4)

---
updated-dependencies:
- dependency-name: github.com/prometheus/client_golang
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-09-23 09:23:49 +00:00
Chris Bartlett 24c2194e7e fix: deduplication of cr enabled resources 2024-09-18 17:22:38 -06:00
Walther Lee 9aad0c02f3 fix resource duplication in store builder
Signed-off-by: Walther Lee <walthere.lee@gmail.com>
2024-09-13 12:30:56 -07:00
Walther Lee 012121e50e update func docstring
Signed-off-by: Walther Lee <walthere.lee@gmail.com>
2024-09-12 12:39:53 -07:00
Walther Lee 1a1ca73eca decouple BuildWriters from ConfigureSharding
Signed-off-by: Walther Lee <walthere.lee@gmail.com>
2024-09-12 12:38:08 -07:00
Walther Lee 8195dbe969 Merge branch 'main' into remove-shard-validation-on-sts-create 2024-09-12 10:45:56 -07:00
Kubernetes Prow Robot 3d969c5ce9
Merge pull request #2493 from mrueg/bump-go
chore: Bump go to 1.23.1
2024-09-12 11:19:12 +01:00
Kubernetes Prow Robot 76ef24190d
Merge pull request #2485 from richabanker/no-job-conditions-fix
fix: set kube_job_status_failed metric even when there are no job.Status.Conditions present
2024-09-12 08:55:13 +01:00
Manuel Rüger f34cd69cee chore: Bump go to 1.23.1 2024-09-09 20:15:30 +02:00
Kubernetes Prow Robot aebbb39082
Merge pull request #2498 from SamuAlfageme/fix-readme-codeblocks
docs: fix unformatted code blocks in README
2024-09-09 17:44:45 +01:00
Samuel Alfageme Sainz 3a10a4ee2e Fix unformatted code blocks in README 2024-09-09 18:32:14 +02:00
Kubernetes Prow Robot 52ae178b7d
Merge pull request #2497 from kubernetes/dependabot/go_modules/github.com/prometheus/common-0.59.1
build(deps): Bump github.com/prometheus/common from 0.58.0 to 0.59.1
2024-09-09 10:46:28 +01:00
dependabot[bot] 3dced14afe
build(deps): Bump github.com/prometheus/common from 0.58.0 to 0.59.1
Bumps [github.com/prometheus/common](https://github.com/prometheus/common) from 0.58.0 to 0.59.1.
- [Release notes](https://github.com/prometheus/common/releases)
- [Changelog](https://github.com/prometheus/common/blob/main/RELEASE.md)
- [Commits](https://github.com/prometheus/common/compare/v0.58.0...v0.59.1)

---
updated-dependencies:
- dependency-name: github.com/prometheus/common
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-09-09 09:37:14 +00:00
Kubernetes Prow Robot 24b0f7fffa
Merge pull request #2496 from kubernetes/dependabot/go_modules/github.com/prometheus/client_golang-1.20.3
build(deps): Bump github.com/prometheus/client_golang from 1.20.2 to 1.20.3
2024-09-09 10:36:27 +01:00
dependabot[bot] 12a2291287
build(deps): Bump github.com/prometheus/client_golang
Bumps [github.com/prometheus/client_golang](https://github.com/prometheus/client_golang) from 1.20.2 to 1.20.3.
- [Release notes](https://github.com/prometheus/client_golang/releases)
- [Changelog](https://github.com/prometheus/client_golang/blob/v1.20.3/CHANGELOG.md)
- [Commits](https://github.com/prometheus/client_golang/compare/v1.20.2...v1.20.3)

---
updated-dependencies:
- dependency-name: github.com/prometheus/client_golang
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-09-09 09:27:47 +00:00
Walther Lee 4aced25f69 fix race condition in metrics handler
Signed-off-by: Walther Lee <walthere.lee@gmail.com>
2024-09-05 14:02:13 -07:00
Kubernetes Prow Robot db01d3eb02
Merge pull request #2494 from kubernetes/dependabot/go_modules/github.com/prometheus/exporter-toolkit-0.12.0
build(deps): Bump github.com/prometheus/exporter-toolkit from 0.11.0 to 0.12.0
2024-09-03 21:36:26 +01:00
dependabot[bot] 805b70a086
build(deps): Bump github.com/prometheus/exporter-toolkit
Bumps [github.com/prometheus/exporter-toolkit](https://github.com/prometheus/exporter-toolkit) from 0.11.0 to 0.12.0.
- [Release notes](https://github.com/prometheus/exporter-toolkit/releases)
- [Changelog](https://github.com/prometheus/exporter-toolkit/blob/master/CHANGELOG.md)
- [Commits](https://github.com/prometheus/exporter-toolkit/compare/v0.11.0...v0.12.0)

---
updated-dependencies:
- dependency-name: github.com/prometheus/exporter-toolkit
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-09-03 20:26:09 +00:00
Kubernetes Prow Robot e6f359db36
Merge pull request #2491 from kubernetes/dependabot/go_modules/github.com/prometheus/common-0.57.0
build(deps): Bump github.com/prometheus/common from 0.55.0 to 0.57.0
2024-08-30 21:10:44 +01:00
dependabot[bot] 218f051024
build(deps): Bump github.com/prometheus/common from 0.55.0 to 0.57.0
Bumps [github.com/prometheus/common](https://github.com/prometheus/common) from 0.55.0 to 0.57.0.
- [Release notes](https://github.com/prometheus/common/releases)
- [Changelog](https://github.com/prometheus/common/blob/main/RELEASE.md)
- [Commits](https://github.com/prometheus/common/compare/v0.55.0...v0.57.0)

---
updated-dependencies:
- dependency-name: github.com/prometheus/common
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-08-30 19:54:52 +00:00
Richa Banker 643739d04a Add unit test 2024-08-28 15:42:48 -07:00
Richa Banker 20589ac310 Set metric even when there are no job.Status.Conditions present 2024-08-28 15:40:09 -07:00
Walther Lee 082aba26c0 update discovery to reconfigure sharding
Signed-off-by: Walther Lee <walthere.lee@gmail.com>
2024-08-27 14:14:07 -07:00
Kubernetes Prow Robot c864c93606
Merge pull request #2486 from kubernetes/dependabot/go_modules/github.com/prometheus/client_golang-1.20.2
build(deps): Bump github.com/prometheus/client_golang from 1.20.1 to 1.20.2
2024-08-26 10:46:27 +01:00
dependabot[bot] 4d82424e9e
build(deps): Bump github.com/prometheus/client_golang
Bumps [github.com/prometheus/client_golang](https://github.com/prometheus/client_golang) from 1.20.1 to 1.20.2.
- [Release notes](https://github.com/prometheus/client_golang/releases)
- [Changelog](https://github.com/prometheus/client_golang/blob/main/CHANGELOG.md)
- [Commits](https://github.com/prometheus/client_golang/compare/v1.20.1...v1.20.2)

---
updated-dependencies:
- dependency-name: github.com/prometheus/client_golang
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-08-26 09:25:58 +00:00
Kubernetes Prow Robot 8e4a2ec7c9
Merge pull request #2470 from mrueg/better-align
chore: Memory align structs
2024-08-25 08:22:08 +01:00
Kubernetes Prow Robot 518a39aae1
Merge pull request #2469 from mrueg/bump-e2e-k8s
chore: Bump e2e kind node to 1.30
2024-08-24 23:32:08 +01:00
Kubernetes Prow Robot 029b6d3a97
Merge pull request #2484 from kubernetes/dependabot/go_modules/tools/github.com/jsonnet-bundler/jsonnet-bundler-0.6.0
build(deps): Bump github.com/jsonnet-bundler/jsonnet-bundler from 0.5.1 to 0.6.0 in /tools
2024-08-23 19:04:23 +01:00
dependabot[bot] 1e8fd2c107
build(deps): Bump github.com/jsonnet-bundler/jsonnet-bundler in /tools
Bumps [github.com/jsonnet-bundler/jsonnet-bundler](https://github.com/jsonnet-bundler/jsonnet-bundler) from 0.5.1 to 0.6.0.
- [Release notes](https://github.com/jsonnet-bundler/jsonnet-bundler/releases)
- [Changelog](https://github.com/jsonnet-bundler/jsonnet-bundler/blob/master/CHANGELOG.md)
- [Commits](https://github.com/jsonnet-bundler/jsonnet-bundler/compare/v0.5.1...v0.6.0)

---
updated-dependencies:
- dependency-name: github.com/jsonnet-bundler/jsonnet-bundler
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-08-23 17:56:28 +00:00
Kubernetes Prow Robot 48ade3d36b
Merge pull request #2481 from kubernetes/dependabot/go_modules/github.com/prometheus/client_golang-1.20.1
build(deps): Bump github.com/prometheus/client_golang from 1.20.0 to 1.20.1
2024-08-21 22:04:29 +01:00
dependabot[bot] 1408e45721
build(deps): Bump github.com/prometheus/client_golang
Bumps [github.com/prometheus/client_golang](https://github.com/prometheus/client_golang) from 1.20.0 to 1.20.1.
- [Release notes](https://github.com/prometheus/client_golang/releases)
- [Changelog](https://github.com/prometheus/client_golang/blob/v1.20.1/CHANGELOG.md)
- [Commits](https://github.com/prometheus/client_golang/compare/v1.20.0...v1.20.1)

---
updated-dependencies:
- dependency-name: github.com/prometheus/client_golang
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-08-21 20:55:13 +00:00
Kubernetes Prow Robot f7304dc8d8
Merge pull request #2479 from Daividao/fix-outdated-registryfactory-comments
docs: Fix outdated RegistryFactory.MetricFamilyGenerators comments
2024-08-19 09:09:56 -07:00
Daividao 8359c102fa Fix outdated RegistryFactory.MetricFamilyGenerators comments 2024-08-17 16:21:24 -07:00
Walther Lee dec7a1b93e fix(discovery): configure sharding every time MetricsHandler.Run runs
Signed-off-by: Walther Lee <walthere.lee@gmail.com>
2024-08-16 10:16:09 -07:00
Kubernetes Prow Robot 2762759041
Merge pull request #2477 from kubernetes/dependabot/go_modules/github.com/prometheus/client_golang-1.20.0
build(deps): Bump github.com/prometheus/client_golang from 1.19.1 to 1.20.0
2024-08-14 14:07:17 -07:00
dependabot[bot] 894862eb6a
build(deps): Bump github.com/prometheus/client_golang
Bumps [github.com/prometheus/client_golang](https://github.com/prometheus/client_golang) from 1.19.1 to 1.20.0.
- [Release notes](https://github.com/prometheus/client_golang/releases)
- [Changelog](https://github.com/prometheus/client_golang/blob/v1.20.0/CHANGELOG.md)
- [Commits](https://github.com/prometheus/client_golang/compare/v1.19.1...v1.20.0)

---
updated-dependencies:
- dependency-name: github.com/prometheus/client_golang
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-08-14 15:52:12 +00:00
Manuel Rüger 0a86b24b08 chore: Memory align structs
pkg/metric_generator/generator.go:32:22: 16 bytes saved: struct with 96 pointer bytes could be 80
pkg/metrics_store/metrics_store.go:31:19: 40 bytes saved: struct with 64 pointer bytes could be 24
pkg/options/options.go:42:14: 24 bytes saved: struct of size 384 could be 360
internal/store/builder.go:67:14: 8 bytes saved: struct of size 200 could be 192
internal/store/pod.go:1351:16: 8 bytes saved: struct with 16 pointer bytes could be 8
internal/store/pod.go:1477:20: 8 bytes saved: struct with 16 pointer bytes could be 8
internal/store/testutils.go:32:30: 16 bytes saved: struct with 136 pointer bytes could be 120
pkg/metricshandler/metrics_handler.go:46:21: 8 bytes saved: struct of size 104 could be 96
internal/discovery/types.go:39:19: 32 bytes saved: struct with 88 pointer bytes could be 56
pkg/customresourcestate/config.go:51:15: 16 bytes saved: struct with 112 pointer bytes could be 96
pkg/customresourcestate/config.go:134:16: 8 bytes saved: struct with 88 pointer bytes could be 80
pkg/customresourcestate/config.go:150:13: 8 bytes saved: struct with 40 pointer bytes could be 32
pkg/customresourcestate/config_metrics_types.go:29:18: 8 bytes saved: struct with 64 pointer bytes could be 56
pkg/customresourcestate/config_metrics_types.go:42:17: 8 bytes saved: struct with 40 pointer bytes could be 32
pkg/customresourcestate/registry_factory.go:125:21: 8 bytes saved: struct with 40 pointer bytes could be 32
pkg/customresourcestate/registry_factory.go:212:20: 16 bytes saved: struct with 88 pointer bytes could be 72
pkg/customresourcestate/registry_factory.go:377:23: 8 bytes saved: struct with 104 pointer bytes could be 96
pkg/customresourcestate/registry_factory.go:497:21: 8 bytes saved: struct with 64 pointer bytes could be 56
pkg/customresourcestate/registry_factory.go:549:13: 8 bytes saved: struct with 24 pointer bytes could be 16
2024-08-08 19:03:28 +02:00
Manuel Rüger 089ed4551f chore: Bump e2e kind node to 1.30 2024-08-08 18:55:08 +02:00
Kubernetes Prow Robot f8aa7d9bb9
Merge pull request #2466 from mrueg/drop-dynamic-client
chore: Add unused linter
2024-08-06 00:36:50 -07:00
Manuel Rüger ab06f81c00 chore: Remove further unused 2024-08-05 19:35:51 +02:00
Manuel Rüger 2548615cd7 chore: Add unused linter to golangci 2024-08-05 18:28:11 +02:00
Manuel Rüger a652104dec chore: Remove unused dynamicClient 2024-08-05 18:27:27 +02:00
Kubernetes Prow Robot b1c2e0c1cf
Merge pull request #2467 from CatherineF-dev/patch-12
fix: e2e test failure
2024-08-05 09:26:59 -07:00
CatherineF-dev b43702ed14
Update e2e.sh 2024-08-05 12:17:18 -04:00
CatherineF-dev cdce0e3278
Rename deployment-no-node-pods.yaml to deployment-unscheduled-pods-fetching.yaml 2024-08-05 12:06:35 -04:00
CatherineF-dev 311d3f749a
Rename deployment-no-node-pods-service.yaml to deployment-unscheduled-pods-fetching-service.yaml 2024-08-05 12:06:22 -04:00
CatherineF-dev 720ea8cd89
Update deployment-no-node-pods-service.yaml 2024-08-05 12:05:51 -04:00
CatherineF-dev aeade61698
Update kube-state-metrics.libsonnet 2024-08-05 12:05:17 -04:00
CatherineF-dev f44bafd9af
Fix e2e test failure 2024-08-05 11:52:04 -04:00
Kubernetes Prow Robot 312b298239
Merge pull request #2454 from jeffmccune/jeff/kp
fix: syntax errors in kube-state-metrics.libsonnet
2024-08-05 08:44:59 -07:00
Jeff McCune 3aebcf71a9
fix: syntax errors in kube-state-metrics.libsonnet
Previously customizing kube-prometheus [1] failed with the following
error.

    ❯ ./build.sh example.jsonnet
    + set -o pipefail
    + rm -rf manifests
    + mkdir -p manifests/setup
    + jsonnet -J vendor -m manifests example.jsonnet
    + xargs '-I{}' sh -c 'cat {} | gojsontoyaml > {}.yaml' -- '{}'
    RUNTIME ERROR: vendor/github.com/kubernetes/kube-state-metrics/jsonnet/kube-state-metrics/kube-state-metrics.libsonnet:392:21-22 Expected token OPERATOR but got "{"
            vendor/kube-prometheus/components/kube-state-metrics.libsonnet:51:19-124        function <anonymous>
            vendor/kube-prometheus/main.libsonnet:136:21-64 object <anonymous>
            vendor/kube-prometheus/platforms/platforms.libsonnet:37:22-40   +:
            example.jsonnet:33:90-109       thunk from <$>
            <std>:1539:24-25        thunk from <function <anonymous>>
            <std>:1539:5-33 function <anonymous>
            example.jsonnet:33:73-110       $
            example.jsonnet:33:1-112
            example.jsonnet:33:1-112
            During evaluation

With this patch, the build succeeds:

    ❯ bash build.sh example.jsonnet ; echo $?
    + set -o pipefail
    + rm -rf manifests
    + mkdir -p manifests/setup
    + jsonnet -J vendor -m manifests example.jsonnet
    + xargs '-I{}' sh -c 'cat {} | gojsontoyaml > {}.yaml' -- '{}'
    + find manifests -type f '!' -name '*.yaml' -delete
    + rm -f kustomization
    0

[1]: https://github.com/prometheus-operator/kube-prometheus/blob/main/docs/customizing.md
2024-08-05 08:41:49 -07:00
Kubernetes Prow Robot 45b5a26c3e
Merge pull request #2465 from mrueg/newreflectorwithoptions
chore: Replace NewReflector with NewReflectorWithOptions func
2024-08-05 08:09:00 -07:00
Kubernetes Prow Robot 5878458d97
Merge pull request #2464 from mrueg/avoid-naked-return
chore: Avoid naked return
2024-08-05 08:06:59 -07:00
Manuel Rüger 74d226ccf0 chore: Replace NewReflector with NewReflectorWithOptions func 2024-08-05 16:44:43 +02:00
Manuel Rüger cc79a58411 chore: Avoid naked return 2024-08-05 16:34:30 +02:00
Kubernetes Prow Robot d1e717911b
Merge pull request #2456 from mrueg/dockerfile
fix(Dockerfile): Install tools so VERSION gets set
2024-07-27 10:30:24 -07:00
Manuel Rüger 0dd960eb31 Dockerfile: Install tools so VERSION gets set 2024-07-26 13:56:17 +02:00
Kubernetes Prow Robot e96dfc0a39
Merge pull request #2388 from CatherineF-dev/patch-11
fix: use --track-unscheduled-pods to select unscheduled pods in Daemonset sharding
2024-07-24 10:16:50 -07:00
Catherine Fang aeb9e355b5 Fix Nodetype 2024-07-24 10:01:05 -04:00
CatherineF-dev e18b5573ac format 2024-07-23 20:21:17 -04:00
Catherine Fang eda1984438 Rename --enable-unscheduled-pods-fetching to --track-unscheduled-pods 2024-07-23 20:21:17 -04:00
Catherine Fang 19a0544f44 update doc 2024-07-23 20:20:18 -04:00
CatherineF-dev c9ceded724 Update docs/developer/cli-arguments.md
Co-authored-by: Manuel Rüger <manuel@rueg.eu>
2024-07-23 20:19:09 -04:00
CatherineF-dev bb5a37c6e9 Update jsonnet/kube-state-metrics/kube-state-metrics.libsonnet
Co-authored-by: Manuel Rüger <manuel@rueg.eu>
2024-07-23 20:19:09 -04:00
CatherineF-dev 4a524950f1 Update pkg/options/types.go
Co-authored-by: Alex Kennedy <alexzanderkennedy@gmail.com>
2024-07-23 20:19:09 -04:00
Catherine Fang 85f8a2c4cc rename to --enable-unscheduled-pods-fetching 2024-07-23 20:19:09 -04:00
Catherine Fang 49e1170f67 rename to --fetch-unscheduled-pods 2024-07-23 20:18:53 -04:00
CatherineF-dev b27845d535 use --enable-no-node-scrape
Co-authored-by: Alex Kennedy <alexzanderkennedy@gmail.com>
2024-07-23 20:18:35 -04:00
Catherine Fang 8f3c5c432b Add e2e test 2024-07-23 20:18:00 -04:00
Catherine Fang b45913db59 Fix --nodeName= doesn't select unscheduable pods
pods
2024-07-23 20:17:48 -04:00
Kubernetes Prow Robot a3e9266c8f
Merge pull request #2451 from ricardoapl/generate-sbom-command-not-found
ci: missing line break escape on sbom workflow
2024-07-19 09:29:57 -07:00
Kubernetes Prow Robot 38c2689093
Merge pull request #2450 from kubernetes/release-2.13
chore: Merge release branch back to main
2024-07-19 08:21:06 -07:00
Ricardo Lopes 8753dfd5b7 Fix missing line break escape on sbom workflow
Signed-off-by: Ricardo Lopes <ricardoapl.dev@gmail.com>
2024-07-19 16:08:44 +01:00
Kubernetes Prow Robot 76c5888e34
Merge pull request #2419 from mrueg/prep-2.13.0
chore: Prep release v2.13.0
2024-07-19 06:21:55 -07:00
Manuel Rüger b8c1166153 *: Cut 2.13.0 2024-07-18 12:56:53 +02:00
Manuel Rüger b4f4dff5c5 Bump dependencies 2024-07-18 12:55:12 +02:00
Kubernetes Prow Robot 7104d579e9
Merge pull request #2444 from sanadhis/chore-add-kustomization
chore: add kustomization to standard example
2024-07-16 08:23:48 -07:00
sanadhis 2e4b3e4965
chore: add kustomization to standard example 2024-07-16 16:16:19 +02:00
Kubernetes Prow Robot 5972617294
Merge pull request #2447 from SuperQ/auto_memlimit
perf: Add automatic detection of memory limits
2024-07-16 05:50:59 -07:00
SuperQ eea0524d54
Add automatic detection of memory limits
Add automatic detection of container and system memory limits to control
the Go `GOMEMLIMIT` garbage collector feature. This helps reduced OOMs
by triggering GC when the process approaches system limits.

Signed-off-by: SuperQ <superq@gmail.com>
2024-07-16 12:09:22 +02:00
Kubernetes Prow Robot f7618dfc32
Merge pull request #2442 from rexagod/readyz
fix: add `readyz` endpoint
2024-07-15 05:15:10 -07:00
Pranshu Srivastava dbb0276a42
fixup! fixup! fix: add `readyz` endpoint 2024-07-15 17:32:22 +05:30
Kubernetes Prow Robot a1fb0ce267
Merge pull request #2448 from kubernetes/dependabot/github_actions/actions/setup-go-5.0.2
build(deps): Bump actions/setup-go from 5.0.1 to 5.0.2
2024-07-15 02:55:09 -07:00
dependabot[bot] b954ff66f6
build(deps): Bump actions/setup-go from 5.0.1 to 5.0.2
Bumps [actions/setup-go](https://github.com/actions/setup-go) from 5.0.1 to 5.0.2.
- [Release notes](https://github.com/actions/setup-go/releases)
- [Commits](cdcb360436...0a12ed9d6a)

---
updated-dependencies:
- dependency-name: actions/setup-go
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-07-15 09:48:21 +00:00
Pranshu Srivastava b980579e08
fixup! fix: add `readyz` endpoint 2024-07-05 18:27:48 +05:30
Pranshu Srivastava dae1f062c0
fix: add `readyz` endpoint
Discourage the usage of `/metrics` for any probe, and use `/readyz` in
place of the earlier telemetry metrics endpoint to secure the exposition
data.

Signed-off-by: Pranshu Srivastava <rexagod@gmail.com>
2024-07-04 01:10:28 +05:30
Kubernetes Prow Robot 85d1423b5b
Merge pull request #2438 from kubernetes/dependabot/go_modules/github.com/prometheus/common-0.55.0
build(deps): Bump github.com/prometheus/common from 0.54.0 to 0.55.0
2024-07-01 03:43:50 -07:00
Kubernetes Prow Robot 6e1ca9923d
Merge pull request #2437 from kubernetes/dependabot/github_actions/amannn/action-semantic-pull-request-5.5.3
build(deps): Bump amannn/action-semantic-pull-request from 5.5.2 to 5.5.3
2024-07-01 03:41:39 -07:00
dependabot[bot] d01ed2f8de
build(deps): Bump github.com/prometheus/common from 0.54.0 to 0.55.0
Bumps [github.com/prometheus/common](https://github.com/prometheus/common) from 0.54.0 to 0.55.0.
- [Release notes](https://github.com/prometheus/common/releases)
- [Changelog](https://github.com/prometheus/common/blob/main/RELEASE.md)
- [Commits](https://github.com/prometheus/common/compare/v0.54.0...v0.55.0)

---
updated-dependencies:
- dependency-name: github.com/prometheus/common
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-07-01 09:27:22 +00:00
dependabot[bot] f6c5a4bb2c
build(deps): Bump amannn/action-semantic-pull-request
Bumps [amannn/action-semantic-pull-request](https://github.com/amannn/action-semantic-pull-request) from 5.5.2 to 5.5.3.
- [Release notes](https://github.com/amannn/action-semantic-pull-request/releases)
- [Changelog](https://github.com/amannn/action-semantic-pull-request/blob/main/CHANGELOG.md)
- [Commits](cfb60706e1...0723387faa)

---
updated-dependencies:
- dependency-name: amannn/action-semantic-pull-request
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-07-01 09:23:40 +00:00
Kubernetes Prow Robot dc86adec12
Merge pull request #2411 from mrueg/clomonitor-readme
docs: Add SSF Best practices badge and community section
2024-06-28 08:10:05 -07:00
Kubernetes Prow Robot d862cacaa6
Merge pull request #2418 from rexagod/livez
feat: add `livez` endpoint
2024-06-25 03:13:41 -07:00
Pranshu Srivastava 6f8f7d1f7b
fixup! enhancement: add `livez` endpoint 2024-06-25 15:00:20 +05:30
Pranshu Srivastava eb80c09755
enhancement: add `livez` endpoint
Add a `livez` endpoint to identify network outages. This helps in
restarting the binary if such as case is observed.

Signed-off-by: Pranshu Srivastava <rexagod@gmail.com>

Signed-off-by: Pranshu Srivastava <rexagod@gmail.com>
2024-06-25 14:35:16 +05:30
Kubernetes Prow Robot f4ab888d57
Merge pull request #2430 from kubernetes/dependabot/go_modules/k8s-dependencies-f351cbf957
build(deps): Bump k8s.io/klog/v2 from 2.130.0 to 2.130.1 in the k8s-dependencies group
2024-06-24 22:17:40 -07:00
dependabot[bot] 1483f22ce4
build(deps): Bump k8s.io/klog/v2 in the k8s-dependencies group
Bumps the k8s-dependencies group with 1 update: [k8s.io/klog/v2](https://github.com/kubernetes/klog).


Updates `k8s.io/klog/v2` from 2.130.0 to 2.130.1
- [Release notes](https://github.com/kubernetes/klog/releases)
- [Changelog](https://github.com/kubernetes/klog/blob/main/RELEASE.md)
- [Commits](https://github.com/kubernetes/klog/compare/v2.130.0...v2.130.1)

---
updated-dependencies:
- dependency-name: k8s.io/klog/v2
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: k8s-dependencies
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-06-24 09:54:21 +00:00
Kubernetes Prow Robot 086af0cbaf
Merge pull request #2398 from ricardoapl/publish-openvex-on-release
ci: publish openvex on release
2024-06-18 07:32:39 -07:00
Kubernetes Prow Robot 2aa41eef9a
Merge pull request #2426 from kubernetes/dependabot/github_actions/kubernetes-sigs/release-actions-0.2.0
build(deps): Bump kubernetes-sigs/release-actions from 0.1.4 to 0.2.0
2024-06-18 07:28:38 -07:00
Ricardo Lopes 4269ab10ab Apply consistent format across workflow files
Signed-off-by: Ricardo Lopes <ricardoapl.dev@gmail.com>
2024-06-18 09:16:02 +01:00
Ricardo Lopes fba4a75753 Fix permissions for uploading to release
Signed-off-by: Ricardo Lopes <ricardoapl.dev@gmail.com>
2024-06-18 09:16:02 +01:00
Ricardo Lopes 2bd0b60b5a Avoid trigger OpenVEX on pre-release
Signed-off-by: Ricardo Lopes <ricardoapl.dev@gmail.com>
2024-06-18 09:16:02 +01:00
Ricardo Lopes 9dfddac86a Publish OpenVEX data on release
Signed-off-by: Ricardo Lopes <ricardoapl.dev@gmail.com>
2024-06-18 09:16:02 +01:00
dependabot[bot] 5ac3eff94b
build(deps): Bump kubernetes-sigs/release-actions from 0.1.4 to 0.2.0
Bumps [kubernetes-sigs/release-actions](https://github.com/kubernetes-sigs/release-actions) from 0.1.4 to 0.2.0.
- [Release notes](https://github.com/kubernetes-sigs/release-actions/releases)
- [Changelog](https://github.com/kubernetes-sigs/release-actions/blob/main/RELEASE.md)
- [Commits](841d76a188...2f8b9ec22a)

---
updated-dependencies:
- dependency-name: kubernetes-sigs/release-actions
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-06-17 10:26:19 +00:00
Kubernetes Prow Robot c99e26a229
Merge pull request #2425 from kubernetes/dependabot/github_actions/actions/checkout-4.1.7
build(deps): Bump actions/checkout from 4.1.3 to 4.1.7
2024-06-17 03:25:43 -07:00
Kubernetes Prow Robot f954f30419
Merge pull request #2423 from kubernetes/dependabot/go_modules/github.com/spf13/cobra-1.8.1
build(deps): Bump github.com/spf13/cobra from 1.8.0 to 1.8.1
2024-06-17 03:23:28 -07:00
Kubernetes Prow Robot 124117ff27
Merge pull request #2412 from grafana/fix/add-server-timeouts
fix(server): Add read and write timeouts
2024-06-17 03:21:13 -07:00
Kubernetes Prow Robot 5d387b0f89
Merge pull request #2422 from kubernetes/dependabot/go_modules/k8s-dependencies-8f95eb128b
build(deps): Bump the k8s-dependencies group with 6 updates
2024-06-17 03:18:53 -07:00
dependabot[bot] dba6d4d7e4
build(deps): Bump actions/checkout from 4.1.3 to 4.1.7
Bumps [actions/checkout](https://github.com/actions/checkout) from 4.1.3 to 4.1.7.
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](https://github.com/actions/checkout/compare/v4.1.3...692973e3d937129bcbf40652eb9f2f61becf3332)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-06-17 09:41:29 +00:00
dependabot[bot] 9f61037781
build(deps): Bump github.com/spf13/cobra from 1.8.0 to 1.8.1
Bumps [github.com/spf13/cobra](https://github.com/spf13/cobra) from 1.8.0 to 1.8.1.
- [Release notes](https://github.com/spf13/cobra/releases)
- [Commits](https://github.com/spf13/cobra/compare/v1.8.0...v1.8.1)

---
updated-dependencies:
- dependency-name: github.com/spf13/cobra
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-06-17 09:12:47 +00:00
dependabot[bot] 8760088b49
build(deps): Bump the k8s-dependencies group with 6 updates
Bumps the k8s-dependencies group with 6 updates:

| Package | From | To |
| --- | --- | --- |
| [k8s.io/api](https://github.com/kubernetes/api) | `0.30.1` | `0.30.2` |
| [k8s.io/apimachinery](https://github.com/kubernetes/apimachinery) | `0.30.1` | `0.30.2` |
| [k8s.io/client-go](https://github.com/kubernetes/client-go) | `0.30.1` | `0.30.2` |
| [k8s.io/component-base](https://github.com/kubernetes/component-base) | `0.30.1` | `0.30.2` |
| [k8s.io/klog/v2](https://github.com/kubernetes/klog) | `2.120.1` | `2.130.0` |
| [k8s.io/sample-controller](https://github.com/kubernetes/sample-controller) | `0.30.1` | `0.30.2` |


Updates `k8s.io/api` from 0.30.1 to 0.30.2
- [Commits](https://github.com/kubernetes/api/compare/v0.30.1...v0.30.2)

Updates `k8s.io/apimachinery` from 0.30.1 to 0.30.2
- [Commits](https://github.com/kubernetes/apimachinery/compare/v0.30.1...v0.30.2)

Updates `k8s.io/client-go` from 0.30.1 to 0.30.2
- [Changelog](https://github.com/kubernetes/client-go/blob/master/CHANGELOG.md)
- [Commits](https://github.com/kubernetes/client-go/compare/v0.30.1...v0.30.2)

Updates `k8s.io/component-base` from 0.30.1 to 0.30.2
- [Commits](https://github.com/kubernetes/component-base/compare/v0.30.1...v0.30.2)

Updates `k8s.io/klog/v2` from 2.120.1 to 2.130.0
- [Release notes](https://github.com/kubernetes/klog/releases)
- [Changelog](https://github.com/kubernetes/klog/blob/main/RELEASE.md)
- [Commits](https://github.com/kubernetes/klog/compare/v2.120.1...v2.130.0)

Updates `k8s.io/sample-controller` from 0.30.1 to 0.30.2
- [Commits](https://github.com/kubernetes/sample-controller/compare/v0.30.1...v0.30.2)

---
updated-dependencies:
- dependency-name: k8s.io/api
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: k8s-dependencies
- dependency-name: k8s.io/apimachinery
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: k8s-dependencies
- dependency-name: k8s.io/client-go
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: k8s-dependencies
- dependency-name: k8s.io/component-base
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: k8s-dependencies
- dependency-name: k8s.io/klog/v2
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: k8s-dependencies
- dependency-name: k8s.io/sample-controller
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: k8s-dependencies
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-06-17 09:12:42 +00:00
Kubernetes Prow Robot 89f0db6dd2
Merge pull request #2395 from ricardoapl/fix-github-token-permissions
ci: least privileged GITHUB_TOKEN permissions
2024-06-14 03:13:26 -07:00
pokom cd460fef29 Update cli-arguments.md 2024-06-11 06:48:22 -04:00
Kubernetes Prow Robot 669b5018f2
Merge pull request #2381 from ricardoapl/generate-sbom-workflow
ci: generate sbom on release
2024-06-10 09:01:52 -07:00
Kubernetes Prow Robot 3a81bf3528
Merge pull request #2416 from kubernetes/dependabot/go_modules/github.com/prometheus/common-0.54.0
build(deps): Bump github.com/prometheus/common from 0.53.0 to 0.54.0
2024-06-10 04:17:55 -07:00
dependabot[bot] 698f76a8d5
build(deps): Bump github.com/prometheus/common from 0.53.0 to 0.54.0
Bumps [github.com/prometheus/common](https://github.com/prometheus/common) from 0.53.0 to 0.54.0.
- [Release notes](https://github.com/prometheus/common/releases)
- [Changelog](https://github.com/prometheus/common/blob/main/RELEASE.md)
- [Commits](https://github.com/prometheus/common/compare/v0.53.0...v0.54.0)

---
updated-dependencies:
- dependency-name: github.com/prometheus/common
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-06-10 10:01:12 +00:00
Mark ee3913967e
Update docs/developer/cli-arguments.md
Co-authored-by: Manuel Rüger <manuel@rueg.eu>
2024-06-07 14:13:44 -04:00
pokom 28dbd26540 Create variables for default values of new flags 2024-06-07 13:14:57 -04:00
pokom b4f032ecfd Add additional flags for IdleTimeouts 2024-06-06 13:11:00 -04:00
pokom e97933bcb9 fix(server): Add read and write timeouts
There are a few documented scenarios where `kube-state-metrics` will
lock up(#995, #1028). I believe a much simpler solution to ensure
`kube-state-metrics` doesn't lock up and require a restart to server
`/metrics` requests is to add default read and write timeouts and to
allow them to be configurable. At Grafana, we've experienced a few
scenarios where `kube-state-metrics` running in larger clusters falls
behind and starts getting scraped multiple times. When this occurs,
`kube-state-metrics` becomes completely unresponsive and requires a
reboot. This is somewhat easily reproduceable(I'll provide a script in
an issue) and causes other critical workloads(KEDA, VPA) to fail in
weird ways.

Adds two flags:
- `server-read-timeout`
- `server-write-timeout`

Updates the metrics http server to set the `ReadTimeout` and
`WriteTimeout` to the configured values.
2024-06-05 14:18:43 -04:00
Manuel Rüger 738e6befae Add SSF Best practices badge and community section 2024-06-04 19:54:21 +02:00
Kubernetes Prow Robot 7995d5fd23
Merge pull request #2402 from ricardoapl/add-dependencies-policy
docs: add policy for consuming and upgrading dependencies
2024-06-04 09:33:40 -07:00
Kubernetes Prow Robot f28abc9258
Merge pull request #2347 from pkoutsovasilis/pkoutsovasilis/autosharding_field_selector
fix(pod autosharding): transition from labelselector to fieldselector
2024-06-04 05:23:23 -07:00
Kubernetes Prow Robot a4ddfe6ed9
Merge pull request #2410 from kubernetes/dependabot/go_modules/github.com/spf13/viper-1.19.0
build(deps): Bump github.com/spf13/viper from 1.18.2 to 1.19.0
2024-06-03 03:39:35 -07:00
Kubernetes Prow Robot ab03a29d46
Merge pull request #2409 from kubernetes/dependabot/go_modules/tools/github.com/hairyhenderson/gomplate/v3-3.11.8
build(deps): Bump github.com/hairyhenderson/gomplate/v3 from 3.11.7 to 3.11.8 in /tools
2024-06-03 03:37:16 -07:00
dependabot[bot] c38f24b2aa
build(deps): Bump github.com/spf13/viper from 1.18.2 to 1.19.0
Bumps [github.com/spf13/viper](https://github.com/spf13/viper) from 1.18.2 to 1.19.0.
- [Release notes](https://github.com/spf13/viper/releases)
- [Commits](https://github.com/spf13/viper/compare/v1.18.2...v1.19.0)

---
updated-dependencies:
- dependency-name: github.com/spf13/viper
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-06-03 09:58:53 +00:00
dependabot[bot] bb0a33c7a6
build(deps): Bump github.com/hairyhenderson/gomplate/v3 in /tools
Bumps [github.com/hairyhenderson/gomplate/v3](https://github.com/hairyhenderson/gomplate) from 3.11.7 to 3.11.8.
- [Release notes](https://github.com/hairyhenderson/gomplate/releases)
- [Changelog](https://github.com/hairyhenderson/gomplate/blob/main/CHANGELOG.md)
- [Commits](https://github.com/hairyhenderson/gomplate/compare/v3.11.7...v3.11.8)

---
updated-dependencies:
- dependency-name: github.com/hairyhenderson/gomplate/v3
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-06-03 09:44:31 +00:00
Ricardo Lopes 9917008f7e docs: lint markdown
Signed-off-by: Ricardo Lopes <ricardoapl.dev@gmail.com>
2024-05-28 10:31:31 +01:00
Ricardo Lopes 8c75a8b589 docs: add policy for consuming and upgrading dependencies
Signed-off-by: Ricardo Lopes <ricardoapl.dev@gmail.com>
2024-05-27 11:52:06 +01:00
Kubernetes Prow Robot 85762cdf97
Merge pull request #2401 from kubernetes/dependabot/github_actions/amannn/action-semantic-pull-request-5.5.2
build(deps): Bump amannn/action-semantic-pull-request from 5.4.0 to 5.5.2
2024-05-27 03:35:54 -07:00
dependabot[bot] d01fb796da
build(deps): Bump amannn/action-semantic-pull-request
Bumps [amannn/action-semantic-pull-request](https://github.com/amannn/action-semantic-pull-request) from 5.4.0 to 5.5.2.
- [Release notes](https://github.com/amannn/action-semantic-pull-request/releases)
- [Changelog](https://github.com/amannn/action-semantic-pull-request/blob/main/CHANGELOG.md)
- [Commits](e9fabac35e...cfb60706e1)

---
updated-dependencies:
- dependency-name: amannn/action-semantic-pull-request
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-05-27 09:16:49 +00:00
Kubernetes Prow Robot d8dd6e0704
Merge pull request #2396 from ricardoapl/pin-github-actions
chore: pin dependencies in GitHub Actions by hash
2024-05-24 07:55:10 -07:00
Ricardo Lopes b6697e5166 ci: rename asset to pass CLOMonitor checks
Signed-off-by: Ricardo Lopes <ricardoapl.dev@gmail.com>
2024-05-24 09:18:22 +01:00
Ricardo Lopes b983ed5f42 Pin dependencies in GitHub Actions by hash
Signed-off-by: Ricardo Lopes <ricardoapl.dev@gmail.com>
2024-05-22 17:14:24 +01:00
Ricardo Lopes 8867e6ece9 Restrict permissions for GITHUB_TOKEN
Signed-off-by: Ricardo Lopes <ricardoapl.dev@gmail.com>
2024-05-22 15:49:26 +01:00
Kubernetes Prow Robot 7caed2384c
Merge pull request #2394 from kubernetes/dependabot/go_modules/k8s-dependencies-ac34a464a8
build(deps): Bump the k8s-dependencies group with 5 updates
2024-05-20 04:17:27 -07:00
dependabot[bot] 2b2d1dc133
build(deps): Bump the k8s-dependencies group with 5 updates
Bumps the k8s-dependencies group with 5 updates:

| Package | From | To |
| --- | --- | --- |
| [k8s.io/api](https://github.com/kubernetes/api) | `0.30.0` | `0.30.1` |
| [k8s.io/apimachinery](https://github.com/kubernetes/apimachinery) | `0.30.0` | `0.30.1` |
| [k8s.io/client-go](https://github.com/kubernetes/client-go) | `0.30.0` | `0.30.1` |
| [k8s.io/component-base](https://github.com/kubernetes/component-base) | `0.30.0` | `0.30.1` |
| [k8s.io/sample-controller](https://github.com/kubernetes/sample-controller) | `0.30.0` | `0.30.1` |


Updates `k8s.io/api` from 0.30.0 to 0.30.1
- [Commits](https://github.com/kubernetes/api/compare/v0.30.0...v0.30.1)

Updates `k8s.io/apimachinery` from 0.30.0 to 0.30.1
- [Commits](https://github.com/kubernetes/apimachinery/compare/v0.30.0...v0.30.1)

Updates `k8s.io/client-go` from 0.30.0 to 0.30.1
- [Changelog](https://github.com/kubernetes/client-go/blob/master/CHANGELOG.md)
- [Commits](https://github.com/kubernetes/client-go/compare/v0.30.0...v0.30.1)

Updates `k8s.io/component-base` from 0.30.0 to 0.30.1
- [Commits](https://github.com/kubernetes/component-base/compare/v0.30.0...v0.30.1)

Updates `k8s.io/sample-controller` from 0.30.0 to 0.30.1
- [Commits](https://github.com/kubernetes/sample-controller/compare/v0.30.0...v0.30.1)

---
updated-dependencies:
- dependency-name: k8s.io/api
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: k8s-dependencies
- dependency-name: k8s.io/apimachinery
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: k8s-dependencies
- dependency-name: k8s.io/client-go
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: k8s-dependencies
- dependency-name: k8s.io/component-base
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: k8s-dependencies
- dependency-name: k8s.io/sample-controller
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: k8s-dependencies
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-05-20 09:15:39 +00:00
Kubernetes Prow Robot fa083b53d0
Merge pull request #2385 from jwilder/jwilder/cves
build: bump deps to fix CVEs
2024-05-13 08:26:30 -07:00
Kubernetes Prow Robot 63a7bc9bc7
Merge pull request #2389 from kubernetes/dependabot/go_modules/github.com/prometheus/client_golang-1.19.1
build(deps): Bump github.com/prometheus/client_golang from 1.19.0 to 1.19.1
2024-05-13 03:04:58 -07:00
dependabot[bot] 93e8d99a7d
build(deps): Bump github.com/prometheus/client_golang
Bumps [github.com/prometheus/client_golang](https://github.com/prometheus/client_golang) from 1.19.0 to 1.19.1.
- [Release notes](https://github.com/prometheus/client_golang/releases)
- [Changelog](https://github.com/prometheus/client_golang/blob/main/CHANGELOG.md)
- [Commits](https://github.com/prometheus/client_golang/compare/v1.19.0...v1.19.1)

---
updated-dependencies:
- dependency-name: github.com/prometheus/client_golang
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-05-13 09:07:30 +00:00
Jason Wilder a5e168f269 build: bump deps to fix CVEs
Updates all deps flagging for fixed CVEs and updates go to 1.22.2.

Fixes CVE-2022-21698 CVE-2022-46146 CVE-2021-43565 CVE-2022-27191
    CVE-2023-48795 CVE-2022-27664 CVE-2022-41723 CVE-2023-39325
    CVE-2023-3978 CVE-2023-44487 CVE-2023-45288 CVE-2022-29526
    CVE-2021-38561 CVE-2022-32149 CVE-2024-24786 CVE-2022-28948
2024-05-02 14:38:13 -06:00
Kubernetes Prow Robot 2b8eea4e27
Merge pull request #2379 from mrueg/k8s-1.30.0
feat: Support k8s 1.30
2024-05-02 11:47:13 -07:00
Ricardo Lopes 2a23510019 ci: trigger on release but not on pre-release
Signed-off-by: Ricardo Lopes <ricardoapl.dev@gmail.com>
2024-04-25 16:22:16 +01:00
Ricardo Lopes 7fc6c5dd2e ci: fetch tag name on release
Signed-off-by: Ricardo Lopes <ricardoapl.dev@gmail.com>
2024-04-25 15:44:33 +01:00
Ricardo Lopes a0f5ebef42 ci: generate sbom on release
Signed-off-by: Ricardo Lopes <ricardoapl.dev@gmail.com>
2024-04-24 17:17:59 +01:00
Kubernetes Prow Robot 9e6e70d328
Merge pull request #2370 from ricardoapl/kube_persistentvolume_volume_mode
feat: add kube_persistentvolume_volume_mode metric
2024-04-22 14:23:52 -07:00
Manuel Rüger 569e820c65 feat: Make cronjob timezone aware 2024-04-22 23:16:49 +02:00
Manuel Rüger 6d8f7573aa feat: Support k8s 1.30 2024-04-22 20:16:33 +02:00
Kubernetes Prow Robot 8b8c93c62a
Merge pull request #2378 from kubernetes/dependabot/go_modules/github.com/prometheus/common-0.53.0
build(deps): Bump github.com/prometheus/common from 0.52.3 to 0.53.0
2024-04-22 02:39:33 -07:00
dependabot[bot] 86846679a3
build(deps): Bump github.com/prometheus/common from 0.52.3 to 0.53.0
Bumps [github.com/prometheus/common](https://github.com/prometheus/common) from 0.52.3 to 0.53.0.
- [Release notes](https://github.com/prometheus/common/releases)
- [Commits](https://github.com/prometheus/common/compare/v0.52.3...v0.53.0)

---
updated-dependencies:
- dependency-name: github.com/prometheus/common
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-04-22 09:27:11 +00:00
Manuel Rüger be6fc00d98 feat: Add timezone to kube_cronjob_info 2024-04-22 10:16:59 +02:00
Ricardo Lopes b1b8d24cbf refactor: remove unused var
Signed-off-by: Ricardo Lopes <ricardoapl.dev@gmail.com>
2024-04-17 09:52:05 +01:00
Ricardo Lopes ef4fceac06 refactor: reduce cyclomatic complexity
Signed-off-by: Ricardo Lopes <ricardoapl.dev@gmail.com>
2024-04-17 09:51:05 +01:00
Ricardo Lopes 610918ea24 fixup! feat: add kube_persistentvolume_volume_mode metric
Signed-off-by: Ricardo Lopes <ricardoapl.dev@gmail.com>
2024-04-15 17:32:12 +01:00
Ricardo Lopes a40944b47b feat: add kube_persistentvolume_volume_mode metric
Signed-off-by: Ricardo Lopes <ricardoapl.dev@gmail.com>
2024-04-15 17:26:55 +01:00
Kubernetes Prow Robot ba23b77203
Merge pull request #2369 from kubernetes/dependabot/go_modules/github.com/prometheus/common-0.52.3
build(deps): Bump github.com/prometheus/common from 0.52.2 to 0.52.3
2024-04-15 06:05:57 -07:00
dependabot[bot] ff78ed0f07
build(deps): Bump github.com/prometheus/common from 0.52.2 to 0.52.3
Bumps [github.com/prometheus/common](https://github.com/prometheus/common) from 0.52.2 to 0.52.3.
- [Release notes](https://github.com/prometheus/common/releases)
- [Commits](https://github.com/prometheus/common/compare/v0.52.2...v0.52.3)

---
updated-dependencies:
- dependency-name: github.com/prometheus/common
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-04-15 09:56:36 +00:00
Kubernetes Prow Robot 9e855147a2
Merge pull request #2362 from mrueg/go-1.22
chore: Build with go 1.22
2024-04-08 08:48:28 -07:00
Kubernetes Prow Robot 1be8dafc30
Merge pull request #2365 from kubernetes/dependabot/go_modules/github.com/prometheus/common-0.52.2
build(deps): Bump github.com/prometheus/common from 0.51.1 to 0.52.2
2024-04-08 03:05:43 -07:00
dependabot[bot] e8a9bcfed9
build(deps): Bump github.com/prometheus/common from 0.51.1 to 0.52.2
Bumps [github.com/prometheus/common](https://github.com/prometheus/common) from 0.51.1 to 0.52.2.
- [Release notes](https://github.com/prometheus/common/releases)
- [Commits](https://github.com/prometheus/common/compare/v0.51.1...v0.52.2)

---
updated-dependencies:
- dependency-name: github.com/prometheus/common
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-04-08 09:44:16 +00:00
Kubernetes Prow Robot 623952925d
Merge pull request #2364 from kubernetes/dependabot/go_modules/github.com/prometheus/client_model-0.6.1
build(deps): Bump github.com/prometheus/client_model from 0.6.0 to 0.6.1
2024-04-08 02:43:31 -07:00
dependabot[bot] 07364ba2c1
build(deps): Bump github.com/prometheus/client_model from 0.6.0 to 0.6.1
Bumps [github.com/prometheus/client_model](https://github.com/prometheus/client_model) from 0.6.0 to 0.6.1.
- [Release notes](https://github.com/prometheus/client_model/releases)
- [Commits](https://github.com/prometheus/client_model/compare/v0.6.0...v0.6.1)

---
updated-dependencies:
- dependency-name: github.com/prometheus/client_model
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-04-08 09:08:20 +00:00
Manuel Rüger 0c030421ca chore: Update prometheus to 2.51.1 2024-04-05 00:20:04 +02:00
Manuel Rüger 851c01d0fd chore: Bump markdownlint-cli2 to 0.13.0 2024-04-05 00:20:04 +02:00
Manuel Rüger fd2a1f83f3 chore: Build with go 1.22 2024-04-05 00:20:04 +02:00
Manuel Rüger d7d561f999
Merge pull request #2363 from ovidiutirla/fix-ci-after-docs-reorg
chore: use string verb to format logging messages in tests
2024-04-04 22:33:39 +02:00
Ovidiu Tirla b72faf3af9 chore: use string verb to format logging messages in tests
The %w makes the CI to fail, replacing it back to %s
2024-04-04 18:41:47 +00:00
Kubernetes Prow Robot ea8a7f8c33
Merge pull request #2358 from ovidiutirla/reorg-docs
docs: reorganize documentation directory structure
2024-04-04 10:40:51 -07:00
Ovidiu Tirla 071c523e20
chore: update log message
Co-authored-by: Pranshu Srivastava <prasriva@redhat.com>
2024-04-04 19:25:02 +02:00
Kubernetes Prow Robot 20895032eb
Merge pull request #2361 from mrueg/template-more
chore: Replace VERSION file with data.yaml
2024-04-03 19:22:10 -07:00
Manuel Rüger 7aa1659a35 chore: Replace VERSION file with data.yaml 2024-04-04 00:54:23 +02:00
Kubernetes Prow Robot d4ae486023
Merge pull request #2360 from kubernetes/release-2.12
chore: Sync `release-2.12` with `main`
2024-04-03 05:54:06 -07:00
Ovidiu Tirla 1669ae6c77 test: lookup recursively for docs in e2e test 2024-04-03 12:32:14 +00:00
Ovidiu Tirla 66601c2be4 chore: fix doccheck to lookup recursively 2024-04-03 12:32:14 +00:00
Ovidiu Tirla 3fc953561f docs: reorganize documentation directory structure 2024-04-03 12:32:14 +00:00
Kubernetes Prow Robot 1e8b837eb1
Merge pull request #2335 from rexagod/release-2.12
chore: Cut v2.12.0
2024-04-02 08:08:11 -07:00
Pranshu Srivastava 48050aea65
chore: Cut v2.12 2024-04-02 15:32:28 +05:30
Kubernetes Prow Robot 3478fe9ddd
Merge pull request #2352 from mrueg/prom-common-0.51
chore: Bump prometheus/common library
2024-04-01 17:13:53 -07:00
Kubernetes Prow Robot 3f44ad0f7b
Merge pull request #2344 from mrueg/template-readme
docs: Template the README file
2024-03-31 18:17:33 -07:00
Manuel Rüger 97b10ea5e7 docs: Template the README file 2024-03-31 20:11:46 +02:00
Manuel Rüger 768a0a4338 chore: Bump prometheus/common library 2024-03-28 20:45:36 +01:00
Kubernetes Prow Robot fa5eb67feb
Merge pull request #2270 from rexagod/2248
fix: fallback to `gauge` for `protofmt`-based negotiations
2024-03-27 11:30:53 -07:00
Pranshu Srivastava 2a06c45061
fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup! fix: fallback to `gauge` for `protofmt`-based negotiations 2024-03-27 23:53:23 +05:30
Kubernetes Prow Robot 0a8b3b4aad
Merge pull request #2350 from kubernetes/dependabot/go_modules/github.com/stretchr/testify-1.9.0
build(deps): Bump github.com/stretchr/testify from 1.8.4 to 1.9.0
2024-03-26 11:46:35 -07:00
Pranshu Srivastava 8e7b38d516
fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup! fix: fallback to `gauge` for `protofmt`-based negotiations 2024-03-26 23:47:53 +05:30
dependabot[bot] f9f1d5036a
build(deps): Bump github.com/stretchr/testify from 1.8.4 to 1.9.0
Bumps [github.com/stretchr/testify](https://github.com/stretchr/testify) from 1.8.4 to 1.9.0.
- [Release notes](https://github.com/stretchr/testify/releases)
- [Commits](https://github.com/stretchr/testify/compare/v1.8.4...v1.9.0)

---
updated-dependencies:
- dependency-name: github.com/stretchr/testify
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-03-26 14:56:34 +00:00
Kubernetes Prow Robot fea5dfd26d
Merge pull request #2343 from mrueg/bump-1.29
chore: Bump kubernetes 1.29 deps
2024-03-26 07:55:20 -07:00
Kubernetes Prow Robot a3489c0ace
Merge pull request #2052 from rexagod/prefixed-star-paths
feat: Allow prefixing wildcard `labelsFromPath`
2024-03-26 07:51:19 -07:00
Kubernetes Prow Robot 97c710b40d
Merge pull request #2291 from tetianakravchenko/add_metric_kube_pod_container_status_last_terminated_timestamp
feat: add kube_pod_container_status_last_terminated_timestamp metric
2024-03-25 07:12:39 -07:00
Panos Koutsovasilis 097ae84c0c feat: [pod autosharding] transition from labelselector to fieldselector 2024-03-22 00:00:05 +02:00
Manuel Rüger 9ba2547ca7 chore: Fix test 2024-03-18 16:39:06 +01:00
Manuel Rüger 3cf239076f chore: Group k8s deps on dependabot 2024-03-18 16:39:06 +01:00
Manuel Rüger 0cb296564b chore: Bump to kubernetes 1.29 2024-03-18 16:12:17 +01:00
Kubernetes Prow Robot 9ba1c37021
Merge pull request #2334 from rexagod/release-2.11-sync
chore: Sync `release-2.11`
2024-03-14 05:31:25 -07:00
Pranshu Srivastava ce23b82cd8
*: Cut v2.11.0
Blocked by #2316.

Signed-off-by: Pranshu Srivastava <rexagod@gmail.com>
2024-03-07 13:23:10 +05:30
Tetiana Kravchenko 393430ed86 fix the description of the 'kube_pod_container_status_last_terminated_timestamp' metric
Signed-off-by: Tetiana Kravchenko <tetiana.kravchenko@elastic.co>
2024-03-04 11:40:34 +01:00
Tetiana Kravchenko dbdb77c920 fix benchmark test; add missing kube_pod_container_status_last_terminated_timestamp in pod tests
Signed-off-by: Tetiana Kravchenko <tetiana.kravchenko@elastic.co>
2024-01-22 16:32:52 +01:00
Tetiana Kravchenko 8876d40ecd add kube_pod_container_status_last_terminated_timestamp to the unit tests
Signed-off-by: Tetiana Kravchenko <tetiana.kravchenko@elastic.co>
2024-01-22 15:36:58 +01:00
Pranshu Srivastava e0c3e8384a
fixup! fixup! fixup! fixup! fixup! fixup! fixup! fix: fallback to `gauge` for `protofmt`-based negotiations 2024-01-15 02:09:52 +05:30
Pranshu Srivastava b6496c7fb4
fixup! fixup! fixup! fixup! fixup! fixup! fix: fallback to `gauge` for `protofmt`-based negotiations 2024-01-15 00:04:41 +05:30
Pranshu Srivastava 883296e946
fixup! fixup! fixup! fixup! fixup! fix: fallback to `gauge` for `protofmt`-based negotiations 2024-01-15 00:04:41 +05:30
Pranshu Srivastava 0e23fdbe5a
fixup! fixup! fixup! fixup! fix: fallback to `gauge` for `protofmt`-based negotiations 2024-01-15 00:04:41 +05:30
Pranshu Srivastava 67f184cb13
fixup! fixup! fixup! fix: fallback to `gauge` for `protofmt`-based negotiations 2024-01-15 00:04:40 +05:30
Pranshu Srivastava bfa611dc51
fixup! fixup! fix: fallback to `gauge` for `protofmt`-based negotiations 2024-01-15 00:04:40 +05:30
Pranshu Srivastava 4be2ddf3f7
fixup! fix: fallback to `gauge` for `protofmt`-based negotiations 2024-01-15 00:04:40 +05:30
Pranshu Srivastava ee2f53a2f1
fix: fallback to `gauge` for `protofmt`-based negotiations
Fallback to `gauge` metric type when the negotiated content-type is
`protofmt`-based, since Prometheus' protobuf machinery does not
recognize all OpenMetrics types (`info` and `statesets` in this
context).

Signed-off-by: Pranshu Srivastava <rexagod@gmail.com>
2024-01-15 00:04:39 +05:30
Tetiana Kravchenko 51ccb665c4 feat: add kube_pod_container_status_last_terminated_timestamp metric
Signed-off-by: Tetiana Kravchenko <tetiana.kravchenko@elastic.co>
2023-12-28 15:04:49 +01:00
Pranshu Srivastava a379639a52
feat: Allow prefixing * paths
Allow prefixing * paths, for instance, foo_*: [foo, bar, baz], will
result in foo_baz being the key for all object resolutions under baz.

Signed-off-by: Pranshu Srivastava <rexagod@gmail.com>
2023-08-29 16:44:01 +05:30
184 changed files with 5985 additions and 2059 deletions

View File

@ -9,10 +9,10 @@ assignees: ''
<!-- Please only use this template for submitting feature requests -->
**What would you like to be added**:
**What would you like to be added:**
**Why is this needed**:
**Why is this needed:**
**Describe the solution you'd like**
**Describe the solution you'd like:**
**Additional context**
**Additional context:**

View File

@ -5,9 +5,10 @@
4. If the PR is unfinished, see how to mark it: https://git.k8s.io/community/contributors/guide/pull-requests.md#marking-unfinished-pull-requests
-->
**What this PR does / why we need it**:
<!-- markdownlint-disable-next-line MD041 -->
**What this PR does / why we need it:**
**How does this change affect the cardinality of KSM**: *(increases, decreases or does not change cardinality)*
**How does this change affect the cardinality of KSM:** *(increases, decreases or does not change cardinality)*
**Which issue(s) this PR fixes** *(optional, in `fixes #<issue number>(, fixes #<issue_number>, ...)` format, will close the issue(s) when PR gets merged)*:
**Which issue(s) this PR fixes:** *(optional, in `fixes #<issue number>(, fixes #<issue_number>, ...)` format, will close the issue(s) when PR gets merged)*
Fixes #

View File

@ -2,10 +2,10 @@ version: 2
updates:
- package-ecosystem: "gomod"
directory: "/"
schedule:
interval: "weekly"
- package-ecosystem: "gomod"
directory: "tools"
groups:
k8s-dependencies:
patterns:
- "k8s.io*"
schedule:
interval: "weekly"
- package-ecosystem: "github-actions"

View File

@ -20,8 +20,8 @@ env:
E2E_SETUP_KIND: yes
E2E_SETUP_KUBECTL: yes
SUDO: sudo
GO_VERSION: "^1.21"
GOLANGCI_LINT_VERSION: "v1.54.2"
GO_VERSION: "^1.24"
GOLANGCI_LINT_VERSION: "v2.0.2"
jobs:
ci-go-lint:
@ -29,18 +29,14 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Check out code into the Go module directory
uses: actions/checkout@v4
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
- name: Set up Go 1.x
uses: actions/setup-go@v5
uses: actions/setup-go@d35c59abb061a4a6fb18e82ac0862c26744d6ab5 # v5.5.0
with:
go-version: ${{ env.GO_VERSION }}
id: go
- name: Setup environment
run: |
make install-tools
- name: Lint
run: |
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin ${{ env.GOLANGCI_LINT_VERSION }}
@ -51,18 +47,14 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Check out code into the Go module directory
uses: actions/checkout@v4
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
- name: Set up Go 1.x
uses: actions/setup-go@v5
uses: actions/setup-go@d35c59abb061a4a6fb18e82ac0862c26744d6ab5 # v5.5.0
with:
go-version: ${{ env.GO_VERSION }}
id: go
- name: Setup environment
run: |
make install-tools
- name: Validate generated manifests
run: |
make validate-manifests
@ -72,18 +64,14 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Check out code into the Go module directory
uses: actions/checkout@v4
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
- name: Set up Go 1.x
uses: actions/setup-go@v5
uses: actions/setup-go@d35c59abb061a4a6fb18e82ac0862c26744d6ab5 # v5.5.0
with:
go-version: ${{ env.GO_VERSION }}
id: go
- name: Setup environment
run: |
make install-tools
- name: Validate go modules
run: |
make validate-modules
@ -93,19 +81,15 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Check out code into the Go module directory
uses: actions/checkout@v4
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
- name: Set up Go 1.x
uses: actions/setup-go@v5
uses: actions/setup-go@d35c59abb061a4a6fb18e82ac0862c26744d6ab5 # v5.5.0
with:
go-version: ${{ env.GO_VERSION }}
id: go
- name: Setup environment
run: |
make install-tools
- name: Check that all metrics are documented
- name: Check that all metrics are documented and templates have no delta
run: |
make doccheck
@ -114,18 +98,14 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Check out code into the Go module directory
uses: actions/checkout@v4
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
- name: Set up Go 1.x
uses: actions/setup-go@v5
uses: actions/setup-go@d35c59abb061a4a6fb18e82ac0862c26744d6ab5 # v5.5.0
with:
go-version: ${{ env.GO_VERSION }}
id: go
- name: Setup environment
run: |
make install-tools
- name: Unit tests
run: |
make test-unit
@ -135,7 +115,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Check out code into the Go module directory
uses: actions/checkout@v4
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
- name: Setup promtool
run: |
@ -150,39 +130,41 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Check out code into the Go module directory
uses: actions/checkout@v4
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
- name: Set up Go 1.x
uses: actions/setup-go@v5
uses: actions/setup-go@d35c59abb061a4a6fb18e82ac0862c26744d6ab5 # v5.5.0
with:
go-version: ${{ env.GO_VERSION }}
id: go
- name: Setup environment
run: |
make install-tools
- name: Benchmark tests
run: |
make test-benchmark-compare
BENCHSTAT_OUTPUT_FILE=result.txt make test-benchmark-compare
- run: |
echo "\`\`\`" >> "$GITHUB_STEP_SUMMARY"
cat result.txt >> "$GITHUB_STEP_SUMMARY"
echo "\`\`\`" >> "$GITHUB_STEP_SUMMARY"
cat <<EOL >> "$GITHUB_STEP_SUMMARY"
<hr />
The table shows the median and 95% confidence interval (CI) summaries for each benchmark comparing the HEAD and the BASE, and an A/B comparison under "vs base". The last column shows the statistical p-value with ten runs (n=10).
The last row has the Geometric Mean (geomean) for the given rows in the table.
Refer to <a href="https://pkg.go.dev/golang.org/x/perf/cmd/benchstat">benchstat's documentation</a> for more help.
EOL
ci-build-kube-state-metrics:
name: ci-build-kube-state-metrics
runs-on: ubuntu-latest
steps:
- name: Check out code into the Go module directory
uses: actions/checkout@v4
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
- name: Set up Go 1.x
uses: actions/setup-go@v5
uses: actions/setup-go@d35c59abb061a4a6fb18e82ac0862c26744d6ab5 # v5.5.0
with:
go-version: ${{ env.GO_VERSION }}
id: go
- name: Setup environment
run: |
make install-tools
- name: Build
run: |
make build
@ -192,18 +174,14 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Check out code into the Go module directory
uses: actions/checkout@v4
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
- name: Set up Go 1.x
uses: actions/setup-go@v5
uses: actions/setup-go@d35c59abb061a4a6fb18e82ac0862c26744d6ab5 # v5.5.0
with:
go-version: ${{ env.GO_VERSION }}
id: go
- name: Setup environment
run: |
make install-tools
- name: End-to-end tests
run: |
make e2e

View File

@ -6,7 +6,7 @@ on:
- cron: '0 0 * * 1'
env:
GO_VERSION: "^1.21"
GO_VERSION: "^1.24"
permissions:
contents: read
@ -15,10 +15,10 @@ jobs:
ci-security-checks:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
name: Checkout code
- name: Set up Go 1.x
uses: actions/setup-go@v5
uses: actions/setup-go@d35c59abb061a4a6fb18e82ac0862c26744d6ab5 # v5.5.0
with:
go-version: ${{ env.GO_VERSION }}
- name: Install govulncheck binary

View File

@ -3,17 +3,35 @@ name: openvex
on:
workflow_dispatch:
release:
types: [published]
types:
- released
permissions:
contents: read
jobs:
vexctl:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout code
uses: actions/checkout@v4
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
- name: Set environment variables
run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
- uses: openvex/generate-vex@c59881b41451d7ccba5c3b74cd195382b8971fcd
# Refer: https://github.com/openvex/vexctl#operational-model
name: Run vexctl
with:
product: pkg:golang/k8s.io/kube-state-metrics/v2@${{ env.RELEASE_VERSION }}
file: kube-state-metrics.openvex.json
- name: Upload OpenVEX document to GitHub Release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh release upload ${{ env.RELEASE_VERSION }} kube-state-metrics.openvex.json

41
.github/workflows/sbom.yaml vendored Normal file
View File

@ -0,0 +1,41 @@
name: Generate SBOM with Kubernetes BOM
on:
release:
types:
- released
permissions:
contents: read
jobs:
sbom:
runs-on: ubuntu-latest
permissions:
contents: write
env:
OUTPUT: sbom.spdx
TAG: ${{ github.event.release.tag_name }}
steps:
- name: Fetch source code into GITHUB_WORKSPACE
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
- name: Install Kubernetes BOM
uses: kubernetes-sigs/release-actions/setup-bom@a30d93cf2aa029e1e4c8a6c79f766aebf429fddb # v0.3.1
- name: Generate SBOM
run: |
bom generate \
--dirs=. \
--image=registry.k8s.io/kube-state-metrics/kube-state-metrics:$TAG \
--namespace=https://github.com/kubernetes/kube-state-metrics/releases/download/$TAG/$OUTPUT \
--output=$OUTPUT
- name: Upload SBOM to GitHub Release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh release upload $TAG $OUTPUT

View File

@ -18,6 +18,6 @@ jobs:
name: Validate PR title for semantic commit message
runs-on: ubuntu-latest
steps:
- uses: amannn/action-semantic-pull-request@v5
- uses: amannn/action-semantic-pull-request@0723387faaf9b38adef4775cd42cfd5155ed6017 # v5.5.3
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

View File

@ -1,15 +1,10 @@
run:
deadline: 5m
version: "2"
linters:
disable-all: true
default: none
enable:
- gocritic
- gocyclo
- gofmt
- goimports
- gosec
- gosimple
- govet
- ineffassign
- misspell
@ -17,22 +12,49 @@ linters:
- revive
- staticcheck
- unconvert
- unused
exclusions:
generated: lax
rules:
- linters:
- promlinter
path: _test\.go
- linters:
- gosec
text: 'G104:'
- linters:
- revive
text: 'package-comments:|var-naming:'
# This needs to stay as long as we support exposing v1.endpoints metrics
- linters:
- staticcheck
text: 'SA1019: v1.Endpoint'
path: 'internal/store/endpoint.*.go|internal/store/builder.go'
# TODO: Use functions with context https://github.com/kubernetes/kube-state-metrics/issues/2721
- linters:
- staticcheck
text: 'SA1019: .*List|Watch'
path: 'pkg/sharding/listwatch.go|pkg/watch/watch.go'
linters-settings:
goimports:
local-prefixes: k8s.io/kube-state-metrics,k8s.io/kube-state-metrics/v2
paths:
- third_party$
- builtin$
- examples$
issues:
exclude-use-default: false
exclude-rules:
# We don't check metrics naming in the tests.
- path: _test\.go
linters:
- promlinter
# TODO(mrueg) Improve error handling
- text: "G104:"
linters:
- gosec
- text: "package-comments:"
linters:
- revive
max-issues-per-linter: 0
max-same-issues: 0
formatters:
enable:
- gofmt
- goimports
settings:
goimports:
local-prefixes:
- k8s.io/kube-state-metrics
- k8s.io/kube-state-metrics/v2
exclusions:
generated: lax
paths:
- third_party$
- builtin$
- examples$

View File

@ -8,10 +8,12 @@
"style": "asterisk"
},
"MD013": false, // https://github.com/markdownlint/markdownlint/blob/main/docs/RULES.md#md013---line-length
"MD024": false, // https://github.com/markdownlint/markdownlint/blob/main/docs/RULES.md#md024---multiple-headers-with-the-same-content
"MD033": false, // https://github.com/markdownlint/markdownlint/blob/main/docs/RULES.md#md033---inline-html
"MD036": false, // https://github.com/markdownlint/markdownlint/blob/main/docs/RULES.md#md036---emphasis-used-instead-of-a-header
"MD040": false, // https://github.com/markdownlint/markdownlint/blob/main/docs/RULES.md#md040---fenced-code-blocks-should-have-a-language-specified
"MD041": false // https://github.com/markdownlint/markdownlint/blob/main/docs/RULES.md#md041---first-line-in-file-should-be-a-top-level-header
"MD033": {
"allowed_elements": [
"details",
"summary",
"br"
]
}
}
}

View File

@ -9,7 +9,7 @@ To add new statements to publish data about a vulnerability,
download [vexctl](https://github.com/openvex/vexctl)
and append new statements using `vexctl add`. For example:
```
```bash
vexctl add --in-place main.openvex.json pkg:oci/test CVE-2014-1234567 fixed
```

View File

@ -1,6 +1,88 @@
# Changelog
## v2.16.0 / 2025-06-23
**Note:**
* This release builds with Golang `v1.24.4`
* This release builds with `k8s.io/client-go`: `v0.32.6`
* [FEATURE] Add a `reclaim_policy` label to the `kube_persistentvolume_info` metric by @SuperQ in <https://github.com/kubernetes/kube-state-metrics/pull/2615>
* [FEATURE] Use dlclark/regexp2 over standard library's package to support lookarounds by @rexagod in <https://github.com/kubernetes/kube-state-metrics/pull/2616>
* [BUGFIX] Report correct values in `kube_pod_status_reason` metric by @carlosmorenokm1 in <https://github.com/kubernetes/kube-state-metrics/pull/2644>
* [FEATURE] Add add `pathType` to `kube_ingress_path` by @rexagod in <https://github.com/kubernetes/kube-state-metrics/pull/2670>
* [FEATURE] Introduce object limits by @mrueg in <https://github.com/kubernetes/kube-state-metrics/pull/2626>
* [BUGFIX] Close reflectors once their corresponding CRDs are dropped by @rexagod in <https://github.com/kubernetes/kube-state-metrics/pull/2672>
* [FEATURE] Incorporate `WithAuthenticationAndAuthorization` to support endpoint authn/z by @mrueg in <https://github.com/kubernetes/kube-state-metrics/pull/2686>
## v2.15.0 / 2025-02-03
**Note:**
* This release builds with Golang `v1.23.5`
* This release builds with `k8s.io/client-go`: `v0.32.1`
* [BUGFIX] Fix CR cache for GVK all specified case by @chelseychen in <https://github.com/kubernetes/kube-state-metrics/pull/2567>
* [BUGFIX] Deduplicate tolerations before creating metric by @RiRa12621 in <https://github.com/kubernetes/kube-state-metrics/pull/2559>
* [BUGFIX] Make `$VERSION` 3rd-party independant by @rexagod in <https://github.com/kubernetes/kube-state-metrics/pull/2572>
* [BUGFIX] Fix NoNodePod naming in jsonnet by @mrueg in <https://github.com/kubernetes/kube-state-metrics/pull/2598>
* [BUGFIX] Panic in `util.GVRFromType` for structured types by @L3n41c in <https://github.com/kubernetes/kube-state-metrics/pull/2553>
* [FEATURE] Add external traffic policy to kube_service_info by @jahantech in <https://github.com/kubernetes/kube-state-metrics/pull/2584>
* [FEATURE] Promote kube_statefulset_ordinals_start from ALPHA -> STABLE by @pwschuurman in <https://github.com/kubernetes/kube-state-metrics/pull/2415>
* [FEATURE] Add timezone to kube_cronjob_info / Make kube_cronjob_next_schedule_time timezone-aware by @mrueg in <https://github.com/kubernetes/kube-state-metrics/pull/2376>
## v2.14.0 / 2024-11-08
**Note:**
* This release builds with Golang `v1.23.3`
* This release builds with `k8s.io/client-go`: `v0.31.2`
* This release removes `kube_endpoint_address_not_ready` and `kube_endpoint_address_available` which have been deprecated in 2022. Please use `kube_endpoint_address`as a replacement.
* [BUGFIX] Use --track-unscheduled-pods to select unscheduled pods in Daemonset sharding by @CatherineF-dev in <https://github.com/kubernetes/kube-state-metrics/pull/2388>
* [BUGFIX] Install tools so VERSION gets set by @mrueg in <https://github.com/kubernetes/kube-state-metrics/pull/2456>
* [BUGFIX] Syntax errors in kube-state-metrics.libsonnet by @jeffmccune in <https://github.com/kubernetes/kube-state-metrics/pull/2454>
* [BUGFIX] Set kube_job_status_failed metric even when there are no job.Status.Conditions present by @richabanker in <https://github.com/kubernetes/kube-state-metrics/pull/2485>
* [BUGFIX] de-duplication of custom resource metrics by @bartlettc22 in <https://github.com/kubernetes/kube-state-metrics/pull/2502>
* [BUGFIX] Configure sharding every time MetricsHandler.Run runs by @wallee94 in <https://github.com/kubernetes/kube-state-metrics/pull/2478>
* [BUGFIX] Panic in `util.GVRFromType` for core objects by @L3n41c in <https://github.com/kubernetes/kube-state-metrics/pull/2535>
* [BUGFIX] Big memory value overflow by @leiwingqueen in <https://github.com/kubernetes/kube-state-metrics/pull/2540>
* [BUGFIX] Expose empty labels by @mrueg in <https://github.com/kubernetes/kube-state-metrics/pull/2539>
* [BUGFIX] CustomResourceMetrics: Convert status condition Unknown to a valid value by @Haleygo in <https://github.com/kubernetes/kube-state-metrics/pull/2536>
* [CHANGE] Remove deprecated endpoint address metric by @mrueg in <https://github.com/kubernetes/kube-state-metrics/pull/2527>
* [FEATURE] Add new metric kube_job_status_suspended by @Indresh2410 in <https://github.com/kubernetes/kube-state-metrics/pull/2542>
* [FEATURE] Move endpoint ports into address metric by @mrueg in <https://github.com/kubernetes/kube-state-metrics/pull/2503>
* [ENHANCEMENT] Use concurrent map when storing metrics by @rarruda in <https://github.com/kubernetes/kube-state-metrics/pull/2510>
## v2.13.0 / 2024-07-18
**Note:**
* This release builds with Golang `v1.22.5`.
* This release builds with `k8s.io/client-go`: `v0.30.3`.
* This release adds read and write timeouts for requests. The defaults might have an impact on scrapes that take a long time.
* [BUGFIX] Pod autosharding: transition from labelselector to fieldselector by @pkoutsovasilis in <https://github.com/kubernetes/kube-state-metrics/pull/2347>
* [ENHANCEMENT] Add automatic detection of memory limits by @SuperQ in <https://github.com/kubernetes/kube-state-metrics/pull/2447>
* [FEATURE] Add `readyz` endpoint by @rexagod in <https://github.com/kubernetes/kube-state-metrics/pull/2442>
* [FEATURE] Add `livez` endpoint by @rexagod in <https://github.com/kubernetes/kube-state-metrics/pull/2418>
* [FEATURE] Add kube_persistentvolume_volume_mode metric by @ricardoapl in <https://github.com/kubernetes/kube-state-metrics/pull/2370>
* [FEATURE] Add read and write timeouts by @Pokom in <https://github.com/kubernetes/kube-state-metrics/pull/2412>
## v2.12.0 / 2024-04-02
**Note:**
* This release addresses a critical issue where scraping the exposition data for certain types caused metrics-backends to crash: <https://github.com/kubernetes/kube-state-metrics/issues/2248>.
* This release builds with `k8s.io/client-go`: `v0.29.3`.
* [BUGFIX] Fallback to `gauge` for `protobuf`-based negotiations by @rexagod in <https://github.com/kubernetes/kube-state-metrics/pull/2270>
* [ENHANCEMENT] Add `kube_pod_container_status_last_terminated_timestamp`by @tetianakravchenko in <https://github.com/kubernetes/kube-state-metrics/pull/2291>
* [FEATURE] Allow prefixing expandable paths by @rexagod in <https://github.com/kubernetes/kube-state-metrics/pull/2052>
## v2.11.0 / 2024-03-04
### Note
**Note:**
This release builds with Golang `v1.21.8`.
@ -14,11 +96,10 @@ This release builds with Golang `v1.21.8`.
* [FEATURE] Support filtering annotations allow-list by `*` by @xonvanetta in <https://github.com/kubernetes/kube-state-metrics/pull/2234>
* [ENHANCEMENT] Support scraping pod metrics that are still in scheduling status and have no assigned nodes by @mickeyzzc in <https://github.com/kubernetes/kube-state-metrics/pull/2217>
* [FEATURE] Add backend resource info for `kube_ingress_path` by @rohitphatak in <https://github.com/kubernetes/kube-state-metrics/pull/2109>
* [FEATURE] Add `kube_secret_owner` by @jrcichra in <https://github.com/kubernetes/kube-state-metrics/pull/2298>
## v2.10.1 / 2023-10-09
### Note
**Note:**
* This release addresses a regression introduced in [#2105](https://github.com/kubernetes/kube-state-metrics/pull/2105).
@ -27,7 +108,7 @@ This release builds with Golang `v1.21.8`.
## v2.10.0 / 2023-08-31
### Note
**Note:**
* Label and annotation metrics aren't exposed by default anymore to reduce the memory usage of the default configuration of kube-state-metrics. Before this change, they used to only include the name and namespace of the objects which is not relevant to users not opting in these metrics.
@ -60,7 +141,7 @@ This release does not incorporate any user-facing changes. Re-running release pr
The changes mentioned below are only the user-facing ones. For a list of the complete set of changes, refer the changelog associated with the release tag.
### Note
**Note:**
* The deprecated experimental VerticalPodAutoscaler metrics are no longer supported, and have been removed. We recommend to use CustomResourceState metrics to gather metrics from custom resources like the Vertical Pod Autoscaler.
* #2004 regulated label names to adhere with [OTel-Prometheus standards](https://github.com/open-telemetry/opentelemetry-specification/blob/8946dfc6a2302f78b0224fcc3f4dfb816a7bb1f4/specification/compatibility/prometheus_and_openmetrics.md?plain=1#L224-L229), so existing label names that do not follow the same may be replaced by the ones that do. Please refer to the PR for more details.

View File

@ -1,6 +1,6 @@
ARG GOVERSION=1.21
ARG GOVERSION=1.24
ARG GOARCH
FROM golang:${GOVERSION} as builder
FROM golang:${GOVERSION} AS builder
ARG GOARCH
ENV GOARCH=${GOARCH}
WORKDIR /go/src/k8s.io/kube-state-metrics/
@ -8,7 +8,7 @@ COPY . /go/src/k8s.io/kube-state-metrics/
RUN make build-local
FROM gcr.io/distroless/static:latest-${GOARCH}
FROM gcr.io/distroless/static-debian12:latest-${GOARCH}
COPY --from=builder /go/src/k8s.io/kube-state-metrics/kube-state-metrics /
USER nobody

View File

@ -2,7 +2,7 @@
kube-state-metrics is welcoming contributions from the community. If you are interested in intensifying your contributions and becoming a maintainer, this doc describes the necessary steps.
As part of the Kubernetes project, we use the community membership process as described [here](https://github.com/kubernetes/community/blob/master/community-membership.md). We do not adhere strictly to the numbers of contributions and reviews. Still as becoming a maintainer is a trust-based process and we desire positive outcomes for the project, we look for a long-term interest and engagement.
As part of the Kubernetes project, we rely on the [community membership process](https://github.com/kubernetes/community/blob/master/community-membership.md). We do not adhere strictly to the numbers of contributions and reviews. Still as becoming a maintainer is a trust-based process and we desire positive outcomes for the project, we look for a long-term interest and engagement.
## Adding a new reviewer

View File

@ -2,12 +2,10 @@ FLAGS =
TESTENVVAR =
REGISTRY ?= gcr.io/k8s-staging-kube-state-metrics
TAG_PREFIX = v
VERSION = $(shell cat VERSION)
VERSION = $(shell grep '^version:' data.yaml | grep -oE "[0-9]+.[0-9]+.[0-9]+")
TAG ?= $(TAG_PREFIX)$(VERSION)
LATEST_RELEASE_BRANCH := release-$(shell grep -ohE "[0-9]+.[0-9]+" VERSION)
LATEST_RELEASE_BRANCH := release-$(shell echo $(VERSION) | grep -ohE "[0-9]+.[0-9]+")
BRANCH = $(strip $(shell git rev-parse --abbrev-ref HEAD))
DOCKER_CLI ?= docker
PROMTOOL_CLI ?= promtool
PKGS = $(shell go list ./... | grep -v /vendor/ | grep -v /tests/e2e)
ARCH ?= $(shell go env GOARCH)
BUILD_DATE = $(shell date -u +'%Y-%m-%dT%H:%M:%SZ')
@ -15,14 +13,21 @@ GIT_COMMIT ?= $(shell git rev-parse --short HEAD)
OS ?= $(shell uname -s | tr A-Z a-z)
ALL_ARCH = amd64 arm arm64 ppc64le s390x
PKG = github.com/prometheus/common
PROMETHEUS_VERSION = 2.46.0
GO_VERSION = 1.21.8
PROMETHEUS_VERSION = 3.4.1
GO_VERSION = 1.24.4
IMAGE = $(REGISTRY)/kube-state-metrics
MULTI_ARCH_IMG = $(IMAGE)-$(ARCH)
USER ?= $(shell id -u -n)
HOST ?= $(shell hostname)
MARKDOWNLINT_CLI2_VERSION = 0.9.2
MARKDOWNLINT_CLI2_VERSION = 0.18.1
DOCKER_CLI ?= docker
PROMTOOL_CLI ?= promtool
GOMPLATE_CLI ?= go tool github.com/hairyhenderson/gomplate/v4/cmd/gomplate
GOJSONTOYAML_CLI ?= go tool github.com/brancz/gojsontoyaml
EMBEDMD_CLI ?= go tool github.com/campoy/embedmd
JSONNET_CLI ?= go tool github.com/google/go-jsonnet/cmd/jsonnet
JB_CLI ?= go tool github.com/jsonnet-bundler/jsonnet-bundler/cmd/jb
export DOCKER_CLI_EXPERIMENTAL=enabled
@ -48,19 +53,19 @@ lint: shellcheck licensecheck lint-markdown-format
lint-fix: fix-markdown-format
golangci-lint run --fix -v
doccheck: generate
doccheck: generate validate-template
@echo "- Checking if the generated documentation is up to date..."
@git diff --exit-code
@echo "- Checking if the documentation is in sync with the code..."
@grep -hoE -d skip '\| kube_[^ |]+' docs/* --exclude=README.md | sed -E 's/\| //g' | sort -u > documented_metrics
@grep -rhoE '\| kube_[^ |]+' docs/metrics/* --exclude=README.md | sed -E 's/\| //g' | sort -u > documented_metrics
@find internal/store -type f -not -name '*_test.go' -exec sed -nE 's/.*"(kube_[^"]+)".*/\1/p' {} \; | sort -u > code_metrics
@diff -u0 code_metrics documented_metrics || (echo "ERROR: Metrics with - are present in code but missing in documentation, metrics with + are documented but not found in code."; exit 1)
@echo OK
@rm -f code_metrics documented_metrics
@echo "- Checking for orphan documentation files"
@cd docs; for doc in *.md; do if [ "$$doc" != "README.md" ] && ! grep -q "$$doc" *.md; then echo "ERROR: No link to documentation file $${doc} detected"; exit 1; fi; done
@cd docs; for doc in $$(find metrics/* -name '*.md' | sed 's/.*\///'); do if [ "$$doc" != "README.md" ] && ! grep -q "$$doc" *.md; then echo "ERROR: No link to documentation file $${doc} detected"; exit 1; fi; done
@echo OK
build-local:
@ -87,12 +92,18 @@ lint-markdown-format:
fix-markdown-format:
${DOCKER_CLI} run -v "${PWD}:/workdir" davidanson/markdownlint-cli2:v${MARKDOWNLINT_CLI2_VERSION} --fix --config .markdownlint-cli2.jsonc
generate-template:
${GOMPLATE_CLI} -d config=./data.yaml --file README.md.tpl > README.md
validate-template: generate-template
git diff --no-ext-diff --quiet --exit-code README.md
# Runs benchmark tests on the current git ref and the last release and compares
# the two.
test-benchmark-compare:
@git fetch
./tests/compare_benchmarks.sh main
./tests/compare_benchmarks.sh ${LATEST_RELEASE_BRANCH}
./tests/compare_benchmarks.sh main 2
./tests/compare_benchmarks.sh ${LATEST_RELEASE_BRANCH} 2
all: all-container
@ -129,10 +140,10 @@ clean:
e2e:
./tests/e2e.sh
generate: build-local
generate: build-local generate-template
@echo ">> generating docs"
@./scripts/generate-help-text.sh
embedmd -w `find . -path ./vendor -prune -o -name "*.md" -print`
${EMBEDMD_CLI} -w `find . -path ./vendor -prune -o -name "*.md" -print`
validate-manifests: examples
@git diff --exit-code
@ -141,35 +152,31 @@ mixin: examples/prometheus-alerting-rules/alerts.yaml
examples/prometheus-alerting-rules/alerts.yaml: jsonnet $(shell find jsonnet | grep ".libsonnet") scripts/mixin.jsonnet scripts/vendor
mkdir -p examples/prometheus-alerting-rules
jsonnet -J scripts/vendor scripts/mixin.jsonnet | gojsontoyaml > examples/prometheus-alerting-rules/alerts.yaml
${JSONNET_CLI} -J scripts/vendor scripts/mixin.jsonnet | ${GOJSONTOYAML_CLI} > examples/prometheus-alerting-rules/alerts.yaml
examples: examples/standard examples/autosharding examples/daemonsetsharding mixin
examples/standard: jsonnet $(shell find jsonnet | grep ".libsonnet") scripts/standard.jsonnet scripts/vendor VERSION
examples/standard: jsonnet $(shell find jsonnet | grep ".libsonnet") scripts/standard.jsonnet scripts/vendor
mkdir -p examples/standard
jsonnet -J scripts/vendor -m examples/standard --ext-str version="$(VERSION)" scripts/standard.jsonnet | xargs -I{} sh -c 'cat {} | gojsontoyaml > `echo {} | sed "s/\(.\)\([A-Z]\)/\1-\2/g" | tr "[:upper:]" "[:lower:]"`.yaml' -- {}
${JSONNET_CLI} -J scripts/vendor -m examples/standard --ext-str version="$(VERSION)" scripts/standard.jsonnet | xargs -I{} sh -c 'cat {} | ${GOJSONTOYAML_CLI} > `echo {} | sed "s/\(.\)\([A-Z]\)/\1-\2/g" | tr "[:upper:]" "[:lower:]"`.yaml' -- {}
find examples -type f ! -name '*.yaml' -delete
examples/autosharding: jsonnet $(shell find jsonnet | grep ".libsonnet") scripts/autosharding.jsonnet scripts/vendor VERSION
examples/autosharding: jsonnet $(shell find jsonnet | grep ".libsonnet") scripts/autosharding.jsonnet scripts/vendor
mkdir -p examples/autosharding
jsonnet -J scripts/vendor -m examples/autosharding --ext-str version="$(VERSION)" scripts/autosharding.jsonnet | xargs -I{} sh -c 'cat {} | gojsontoyaml > `echo {} | sed "s/\(.\)\([A-Z]\)/\1-\2/g" | tr "[:upper:]" "[:lower:]"`.yaml' -- {}
${JSONNET_CLI} -J scripts/vendor -m examples/autosharding --ext-str version="$(VERSION)" scripts/autosharding.jsonnet | xargs -I{} sh -c 'cat {} | ${GOJSONTOYAML_CLI} > `echo {} | sed "s/\(.\)\([A-Z]\)/\1-\2/g" | tr "[:upper:]" "[:lower:]"`.yaml' -- {}
find examples -type f ! -name '*.yaml' -delete
examples/daemonsetsharding: jsonnet $(shell find jsonnet | grep ".libsonnet") scripts/daemonsetsharding.jsonnet scripts/vendor VERSION
examples/daemonsetsharding: jsonnet $(shell find jsonnet | grep ".libsonnet") scripts/daemonsetsharding.jsonnet scripts/vendor
mkdir -p examples/daemonsetsharding
jsonnet -J scripts/vendor -m examples/daemonsetsharding --ext-str version="$(VERSION)" scripts/daemonsetsharding.jsonnet | xargs -I{} sh -c 'cat {} | gojsontoyaml > `echo {} | sed "s/\(.\)\([A-Z]\)/\1-\2/g" | tr "[:upper:]" "[:lower:]"`.yaml' -- {}
${JSONNET_CLI} -J scripts/vendor -m examples/daemonsetsharding --ext-str version="$(VERSION)" scripts/daemonsetsharding.jsonnet | xargs -I{} sh -c 'cat {} | ${GOJSONTOYAML_CLI} > `echo {} | sed "s/\(.\)\([A-Z]\)/\1-\2/g" | tr "[:upper:]" "[:lower:]"`.yaml' -- {}
find examples -type f ! -name '*.yaml' -delete
scripts/vendor: scripts/jsonnetfile.json scripts/jsonnetfile.lock.json
cd scripts && jb install
install-tools:
@echo Installing tools from tools.go
grep '^\s*_' tools/tools.go | awk '{print $$2}' | xargs -tI % go install -mod=readonly -modfile=tools/go.mod %
cd scripts && ${JB_CLI} install
install-promtool:
@echo Installing promtool
@wget -qO- "https://github.com/prometheus/prometheus/releases/download/v${PROMETHEUS_VERSION}/prometheus-${PROMETHEUS_VERSION}.${OS}-${ARCH}.tar.gz" |\
tar xvz --strip-components=1 prometheus-${PROMETHEUS_VERSION}.${OS}-${ARCH}/promtool
.PHONY: all build build-local all-push all-container container container-* do-push-* sub-push-* push push-multi-arch test-unit test-rules test-benchmark-compare clean e2e validate-modules shellcheck licensecheck lint lint-fix generate embedmd
.PHONY: all build build-local all-push all-container container container-* do-push-* sub-push-* push push-multi-arch test-unit test-rules test-benchmark-compare clean e2e validate-modules shellcheck licensecheck lint lint-fix generate generate-template validate-template embedmd

1
OWNERS
View File

@ -5,6 +5,7 @@ reviewers:
- mrueg
- rexagod
approvers:
- CatherineF-dev
- dgrisonnet
- mrueg
- rexagod

View File

@ -4,6 +4,7 @@
[![Go Report Card](https://goreportcard.com/badge/github.com/kubernetes/kube-state-metrics)](https://goreportcard.com/report/github.com/kubernetes/kube-state-metrics)
[![Go Reference](https://pkg.go.dev/badge/github.com/kubernetes/kube-state-metrics.svg)](https://pkg.go.dev/github.com/kubernetes/kube-state-metrics)
[![govulncheck](https://github.com/kubernetes/kube-state-metrics/actions/workflows/govulncheck.yml/badge.svg)](https://github.com/kubernetes/kube-state-metrics/actions/workflows/govulncheck.yml)
[![OpenSSF Best Practices](https://www.bestpractices.dev/projects/8696/badge)](https://www.bestpractices.dev/projects/8696)
[![OpenSSF Scorecard](https://api.securityscorecards.dev/projects/github.com/kubernetes/kube-state-metrics/badge)](https://api.securityscorecards.dev/projects/github.com/kubernetes/kube-state-metrics)
kube-state-metrics (KSM) is a simple service that listens to the Kubernetes API
@ -29,6 +30,9 @@ the raw metrics. Note that the metrics exposed on the `/metrics` endpoint
reflect the current state of the Kubernetes cluster. When Kubernetes objects
are deleted they are no longer visible on the `/metrics` endpoint.
> [!NOTE]
> This README is generated from a [template](./README.md.tpl). Please make your changes there and run `make generate-template`.
## Table of Contents
* [Versioning](#versioning)
@ -37,6 +41,7 @@ are deleted they are no longer visible on the `/metrics` endpoint.
* [Resource group version compatibility](#resource-group-version-compatibility)
* [Container Image](#container-image)
* [Metrics Documentation](#metrics-documentation)
* [ECMAScript regular expression support for allow and deny lists](#ecmascript-regular-expression-support-for-allow-and-deny-lists)
* [Conflict resolution in label names](#conflict-resolution-in-label-names)
* [Kube-state-metrics self metrics](#kube-state-metrics-self-metrics)
* [Resource recommendation](#resource-recommendation)
@ -56,15 +61,15 @@ are deleted they are no longer visible on the `/metrics` endpoint.
* [Helm Chart](#helm-chart)
* [Development](#development)
* [Developer Contributions](#developer-contributions)
* [Community](#community)
### Versioning
#### Kubernetes Version
kube-state-metrics uses [`client-go`](https://github.com/kubernetes/client-go) to talk with
Kubernetes clusters. The supported Kubernetes cluster version is determined by `client-go`.
The compatibility matrix for client-go and Kubernetes cluster can be found
[here](https://github.com/kubernetes/client-go#compatibility-matrix).
Kubernetes clusters. The supported Kubernetes cluster version is determined by
[`client-go`](https://github.com/kubernetes/client-go#compatibility-matrix).
All additional compatibility is only best effort, or happens to still/already be supported.
#### Compatibility matrix
@ -74,12 +79,12 @@ Generally, it is recommended to use the latest release of kube-state-metrics. If
| kube-state-metrics | Kubernetes client-go Version |
|--------------------|:----------------------------:|
| **v2.7.0** | v1.25 |
| **v2.8.2** | v1.26 |
| **v2.9.2** | v1.26 |
| **v2.10.1** | v1.27 |
| **v2.11.0** | v1.28 |
| **main** | v1.28 |
| **v2.12.0** | v1.29 |
| **v2.13.0** | v1.30 |
| **v2.14.0** | v1.31 |
| **v2.15.0** | v1.32 |
| **v2.16.0** | v1.32 |
| **main** | v1.33 |
#### Resource group version compatibility
@ -91,8 +96,8 @@ release.
The latest container image can be found at:
* `registry.k8s.io/kube-state-metrics/kube-state-metrics:v2.11.0` (arch: `amd64`, `arm`, `arm64`, `ppc64le` and `s390x`)
* View all multi-architecture images at [here](https://explore.ggcr.dev/?image=registry.k8s.io%2Fkube-state-metrics%2Fkube-state-metrics:v2.11.0)
* `registry.k8s.io/kube-state-metrics/kube-state-metrics:v2.16.0` (arch: `amd64`, `arm`, `arm64`, `ppc64le` and `s390x`)
* [Multi-architecture images](https://explore.ggcr.dev/?image=registry.k8s.io%2Fkube-state-metrics%2Fkube-state-metrics:v2.16.0)
### Metrics Documentation
@ -124,6 +129,10 @@ e.g. by standardizing Kubernetes labels using an
[Admission Webhook](https://kubernetes.io/docs/reference/access-authn-authz/extensible-admission-controllers/)
that ensures that there are no possible conflicts.
#### ECMAScript regular expression support for allow and deny lists
Starting from [#2616](https://github.com/kubernetes/kube-state-metrics/pull/2616/files), kube-state-metrics supports ECMAScript's `regexp` for allow and deny lists. This was incorporated as a workaround for the limitations of the `regexp` package in Go, which does not support lookarounds due to their non-linear time complexity. Please note that while lookarounds are now supported for allow and deny lists, regular expressions' evaluation time is capped at a minute to prevent performance issues.
### Kube-state-metrics self metrics
kube-state-metrics exposes its own general process metrics under `--telemetry-host` and `--telemetry-port` (default 8081).
@ -134,7 +143,7 @@ at the logs of kube-state-metrics.
Example of the above mentioned metrics:
```
```prometheus
kube_state_metrics_list_total{resource="*v1.Node",result="success"} 1
kube_state_metrics_list_total{resource="*v1.Node",result="error"} 52
kube_state_metrics_watch_total{resource="*v1beta1.Ingress",result="success"} 1
@ -142,7 +151,7 @@ kube_state_metrics_watch_total{resource="*v1beta1.Ingress",result="success"} 1
kube-state-metrics also exposes some http request metrics, examples of those are:
```
```prometheus
http_request_duration_seconds_bucket{handler="metrics",method="get",le="2.5"} 30
http_request_duration_seconds_bucket{handler="metrics",method="get",le="5"} 30
http_request_duration_seconds_bucket{handler="metrics",method="get",le="10"} 30
@ -153,20 +162,20 @@ http_request_duration_seconds_count{handler="metrics",method="get"} 30
kube-state-metrics also exposes build and configuration metrics:
```
```prometheus
kube_state_metrics_build_info{branch="main",goversion="go1.15.3",revision="6c9d775d",version="v2.0.0-beta"} 1
kube_state_metrics_shard_ordinal{shard_ordinal="0"} 0
kube_state_metrics_total_shards 1
```
`kube_state_metrics_build_info` is used to expose version and other build information. For more usage about the info pattern,
please check the blog post [here](https://www.robustperception.io/exposing-the-software-version-to-prometheus).
please check this [blog post](https://www.robustperception.io/exposing-the-software-version-to-prometheus).
Sharding metrics expose `--shard` and `--total-shards` flags and can be used to validate
run-time configuration, see [`/examples/prometheus-alerting-rules`](./examples/prometheus-alerting-rules).
kube-state-metrics also exposes metrics about it config file and the Custom Resource State config file:
```
```prometheus
kube_state_metrics_config_hash{filename="crs.yml",type="customresourceconfig"} 2.38272279311849e+14
kube_state_metrics_config_hash{filename="config.yml",type="config"} 2.65285922340846e+14
kube_state_metrics_last_config_reload_success_timestamp_seconds{filename="crs.yml",type="customresourceconfig"} 1.6704882592037103e+09
@ -193,7 +202,7 @@ Note that if CPU limits are set too low, kube-state-metrics' internal queues wil
In a 100 node cluster scaling test the latency numbers were as follows:
```
```text
"Perc50": 259615384 ns,
"Perc90": 475000000 ns,
"Perc99": 906666666 ns.
@ -201,7 +210,7 @@ In a 100 node cluster scaling test the latency numbers were as follows:
### A note on costing
By default, kube-state-metrics exposes several metrics for events across your cluster. If you have a large number of frequently-updating resources on your cluster, you may find that a lot of data is ingested into these metrics. This can incur high costs on some cloud providers. Please take a moment to [configure what metrics you'd like to expose](docs/cli-arguments.md), as well as consult the documentation for your Kubernetes environment in order to avoid unexpectedly high costs.
By default, kube-state-metrics exposes several metrics for events across your cluster. If you have a large number of frequently-updating resources on your cluster, you may find that a lot of data is ingested into these metrics. This can incur high costs on some cloud providers. Please take a moment to [configure what metrics you'd like to expose](docs/developer/cli-arguments.md), as well as consult the documentation for your Kubernetes environment in order to avoid unexpectedly high costs.
### kube-state-metrics vs. metrics-server
@ -257,7 +266,7 @@ Each kube-state-metrics pod uses FieldSelector (spec.nodeName) to watch/list pod
A daemonset kube-state-metrics example:
```
```yaml
apiVersion: apps/v1
kind: DaemonSet
spec:
@ -277,9 +286,9 @@ spec:
fieldPath: spec.nodeName
```
To track metrics for unassigned pods, you need to add an additional deployment and set `--node=""`, as shown in the following example:
To track metrics for unassigned pods, you need to add an additional deployment and set `--track-unscheduled-pods`, as shown in the following example:
```
```yaml
apiVersion: apps/v1
kind: Deployment
spec:
@ -290,7 +299,7 @@ spec:
name: kube-state-metrics
args:
- --resources=pods
- --node=""
- --track-unscheduled-pods
```
Other metrics can be sharded via [Horizontal sharding](#horizontal-sharding).
@ -299,8 +308,8 @@ Other metrics can be sharded via [Horizontal sharding](#horizontal-sharding).
Install this project to your `$GOPATH` using `go get`:
```
go get k8s.io/kube-state-metrics
```bash
go get k8s.io/kube-state-metrics/v2
```
#### Building the Docker container
@ -308,7 +317,7 @@ go get k8s.io/kube-state-metrics
Simply run the following command in this root folder, which will create a
self-contained, statically-linked binary and build a Docker image:
```
```bash
make container
```
@ -331,7 +340,7 @@ To have Prometheus discover kube-state-metrics instances it is advised to create
**Note:** Google Kubernetes Engine (GKE) Users - GKE has strict role permissions that will prevent the kube-state-metrics roles and role bindings from being created. To work around this, you can give your GCP identity the cluster-admin role by running the following one-liner:
```
```bash
kubectl create clusterrolebinding cluster-admin-binding --clusterrole=cluster-admin --user=$(gcloud info --format='value(config.account)')
```
@ -339,6 +348,16 @@ Note that your GCP identity is case sensitive but `gcloud info` as of Google Clo
After running the above, if you see `Clusterrolebinding "cluster-admin-binding" created`, then you are able to continue with the setup of this service.
#### Healthcheck Endpoints
The following healthcheck endpoints are available (`self` refers to the telemetry port, while `main` refers to the exposition port):
* `/healthz` (exposed on `main`): Returns a 200 status code if the application is running. We recommend to use this for the startup probe.
* `/livez` (exposed on `main`): Returns a 200 status code if the application is not affected by an outage of the Kubernetes API Server. We recommend to using this for the liveness probe.
* `/readyz` (exposed on `self`): Returns a 200 status code if the application is ready to accept requests and expose metrics. We recommend using this for the readiness probe.
Note that it is discouraged to use the telemetry metrics endpoint for any probe when proxying the exposition data.
#### Limited privileges environment
If you want to run kube-state-metrics in an environment where you don't have cluster-reader role, you can:
@ -384,7 +403,7 @@ spec:
- '--namespaces=project1'
```
For the full list of arguments available, see the documentation in [docs/cli-arguments.md](./docs/cli-arguments.md)
For the full list of arguments available, see the documentation in [docs/developer/cli-arguments.md](./docs/developer/cli-arguments.md)
#### Helm Chart
@ -392,20 +411,35 @@ Starting from the kube-state-metrics chart `v2.13.3` (kube-state-metrics image `
#### Development
When developing, test a metric dump against your local Kubernetes cluster by
running:
When developing, test a metric dump against your local Kubernetes cluster by running:
> Users can override the apiserver address in KUBE-CONFIG file with `--apiserver` command line.
go install
kube-state-metrics --port=8080 --telemetry-port=8081 --kubeconfig=<KUBE-CONFIG> --apiserver=<APISERVER>
```bash
go install
kube-state-metrics --port=8080 --telemetry-port=8081 --kubeconfig=<KUBE-CONFIG> --apiserver=<APISERVER>
```
Then curl the metrics endpoint
curl localhost:8080/metrics
```bash
curl localhost:8080/metrics
```
To run the e2e tests locally see the documentation in [tests/README.md](./tests/README.md).
#### Developer Contributions
When developing, there are certain code patterns to follow to better your contributing experience and likelihood of e2e and other ci tests to pass. To learn more about them, see the documentation in [docs/developer/guide.md](./docs/developer/guide.md).
#### Community
This project is sponsored by [SIG Instrumentation](https://github.com/kubernetes/community/tree/master/sig-instrumentation).
There is also a channel for [#kube-state-metrics](https://kubernetes.slack.com/archives/CJJ529RUY) on Kubernetes' Slack.
You can also join the SIG Instrumentation [mailing list](https://groups.google.com/forum/#!forum/kubernetes-sig-instrumentation).
This will typically add invites for the following meetings to your calendar, in which topics around kube-state-metrics can be discussed.
* Regular SIG Meeting: [Thursdays at 9:30 PT (Pacific Time)](https://zoom.us/j/5342565819?pwd=RlVsK21NVnR1dmE3SWZQSXhveHZPdz09) (biweekly). [Convert to your timezone](http://www.thetimezoneconverter.com/?t=9:30&tz=PT%20%28Pacific%20Time%29).
* Regular Triage Meeting: [Thursdays at 9:30 PT (Pacific Time)](https://zoom.us/j/5342565819?pwd=RlVsK21NVnR1dmE3SWZQSXhveHZPdz09) (biweekly - alternating with regular meeting). [Convert to your timezone](http://www.thetimezoneconverter.com/?t=9:30&tz=PT%20%28Pacific%20Time%29).

446
README.md.tpl Normal file
View File

@ -0,0 +1,446 @@
# Overview
[![Build Status](https://github.com/kubernetes/kube-state-metrics/workflows/continuous-integration/badge.svg)](https://github.com/kubernetes/kube-state-metrics/actions)
[![Go Report Card](https://goreportcard.com/badge/github.com/kubernetes/kube-state-metrics)](https://goreportcard.com/report/github.com/kubernetes/kube-state-metrics)
[![Go Reference](https://pkg.go.dev/badge/github.com/kubernetes/kube-state-metrics.svg)](https://pkg.go.dev/github.com/kubernetes/kube-state-metrics)
[![govulncheck](https://github.com/kubernetes/kube-state-metrics/actions/workflows/govulncheck.yml/badge.svg)](https://github.com/kubernetes/kube-state-metrics/actions/workflows/govulncheck.yml)
[![OpenSSF Best Practices](https://www.bestpractices.dev/projects/8696/badge)](https://www.bestpractices.dev/projects/8696)
[![OpenSSF Scorecard](https://api.securityscorecards.dev/projects/github.com/kubernetes/kube-state-metrics/badge)](https://api.securityscorecards.dev/projects/github.com/kubernetes/kube-state-metrics)
kube-state-metrics (KSM) is a simple service that listens to the Kubernetes API
server and generates metrics about the state of the objects. (See examples in
the Metrics section below.) It is not focused on the health of the individual
Kubernetes components, but rather on the health of the various objects inside,
such as deployments, nodes and pods.
kube-state-metrics is about generating metrics from Kubernetes API objects
without modification. This ensures that features provided by kube-state-metrics
have the same grade of stability as the Kubernetes API objects themselves. In
turn, this means that kube-state-metrics in certain situations may not show the
exact same values as kubectl, as kubectl applies certain heuristics to display
comprehensible messages. kube-state-metrics exposes raw data unmodified from the
Kubernetes API, this way users have all the data they require and perform
heuristics as they see fit.
The metrics are exported on the HTTP endpoint `/metrics` on the listening port
(default 8080). They are served as plaintext. They are designed to be consumed
either by Prometheus itself or by a scraper that is compatible with scraping a
Prometheus client endpoint. You can also open `/metrics` in a browser to see
the raw metrics. Note that the metrics exposed on the `/metrics` endpoint
reflect the current state of the Kubernetes cluster. When Kubernetes objects
are deleted they are no longer visible on the `/metrics` endpoint.
> [!NOTE]
> This README is generated from a [template](./README.md.tpl). Please make your changes there and run `make generate-template`.
## Table of Contents
* [Versioning](#versioning)
* [Kubernetes Version](#kubernetes-version)
* [Compatibility matrix](#compatibility-matrix)
* [Resource group version compatibility](#resource-group-version-compatibility)
* [Container Image](#container-image)
* [Metrics Documentation](#metrics-documentation)
* [ECMAScript regular expression support for allow and deny lists](#ecmascript-regular-expression-support-for-allow-and-deny-lists)
* [Conflict resolution in label names](#conflict-resolution-in-label-names)
* [Kube-state-metrics self metrics](#kube-state-metrics-self-metrics)
* [Resource recommendation](#resource-recommendation)
* [Latency](#latency)
* [A note on costing](#a-note-on-costing)
* [kube-state-metrics vs. metrics-server](#kube-state-metrics-vs-metrics-server)
* [Scaling kube-state-metrics](#scaling-kube-state-metrics)
* [Resource recommendation](#resource-recommendation)
* [Horizontal sharding](#horizontal-sharding)
* [Automated sharding](#automated-sharding)
* [Daemonset sharding for pod metrics](#daemonset-sharding-for-pod-metrics)
* [Setup](#setup)
* [Building the Docker container](#building-the-docker-container)
* [Usage](#usage)
* [Kubernetes Deployment](#kubernetes-deployment)
* [Limited privileges environment](#limited-privileges-environment)
* [Helm Chart](#helm-chart)
* [Development](#development)
* [Developer Contributions](#developer-contributions)
* [Community](#community)
### Versioning
#### Kubernetes Version
kube-state-metrics uses [`client-go`](https://github.com/kubernetes/client-go) to talk with
Kubernetes clusters. The supported Kubernetes cluster version is determined by
[`client-go`](https://github.com/kubernetes/client-go#compatibility-matrix).
All additional compatibility is only best effort, or happens to still/already be supported.
#### Compatibility matrix
At most, 5 kube-state-metrics and 5 [kubernetes releases](https://github.com/kubernetes/kubernetes/releases) will be recorded below.
Generally, it is recommended to use the latest release of kube-state-metrics. If you run a very recent version of Kubernetes, you might want to use an unreleased version to have the full range of supported resources. If you run an older version of Kubernetes, you might need to run an older version in order to have full support for all resources. Be aware, that the maintainers will only support the latest release. Older versions might be supported by interested users of the community.
| kube-state-metrics | Kubernetes client-go Version |
|--------------------|:----------------------------:|
{{ define "compat-matrix" -}}
{{- range . -}}
| **{{ .version }}**{{ strings.Repeat (conv.ToInt (math.Sub 15 (len .version))) " " }}| v{{ .kubernetes }} |
{{ end -}}
{{- end -}}
{{ template "compat-matrix" (datasource "config").compat }}
#### Resource group version compatibility
Resources in Kubernetes can evolve, i.e., the group version for a resource may change from alpha to beta and finally GA
in different Kubernetes versions. For now, kube-state-metrics will only use the oldest API available in the latest
release.
#### Container Image
The latest container image can be found at:
{{ define "get-latest-release" -}}
{{ (index . (math.Sub (len .) 2)).version -}}
{{ end }}
* `registry.k8s.io/kube-state-metrics/kube-state-metrics:{{ template "get-latest-release" (datasource "config").compat }}` (arch: `amd64`, `arm`, `arm64`, `ppc64le` and `s390x`)
* [Multi-architecture images](https://explore.ggcr.dev/?image=registry.k8s.io%2Fkube-state-metrics%2Fkube-state-metrics:{{ template "get-latest-release" (datasource "config").compat -}})
### Metrics Documentation
Any resources and metrics based on alpha Kubernetes APIs are excluded from any stability guarantee,
which may be changed at any given release.
See the [`docs`](docs) directory for more information on the exposed metrics.
#### Conflict resolution in label names
The `*_labels` family of metrics exposes Kubernetes labels as Prometheus labels.
As [Kubernetes](https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/#syntax-and-character-set)
is more liberal than
[Prometheus](https://prometheus.io/docs/concepts/data_model/#metric-names-and-labels)
in terms of allowed characters in label names,
we automatically convert unsupported characters to underscores.
For example, `app.kubernetes.io/name` becomes `label_app_kubernetes_io_name`.
This conversion can create conflicts when multiple Kubernetes labels like
`foo-bar` and `foo_bar` would be converted to the same Prometheus label `label_foo_bar`.
Kube-state-metrics automatically adds a suffix `_conflictN` to resolve this conflict,
so it converts the above labels to
`label_foo_bar_conflict1` and `label_foo_bar_conflict2`.
If you'd like to have more control over how this conflict is resolved,
you might want to consider addressing this issue on a different level of the stack,
e.g. by standardizing Kubernetes labels using an
[Admission Webhook](https://kubernetes.io/docs/reference/access-authn-authz/extensible-admission-controllers/)
that ensures that there are no possible conflicts.
#### ECMAScript regular expression support for allow and deny lists
Starting from [#2616](https://github.com/kubernetes/kube-state-metrics/pull/2616/files), kube-state-metrics supports ECMAScript's `regexp` for allow and deny lists. This was incorporated as a workaround for the limitations of the `regexp` package in Go, which does not support lookarounds due to their non-linear time complexity. Please note that while lookarounds are now supported for allow and deny lists, regular expressions' evaluation time is capped at a minute to prevent performance issues.
### Kube-state-metrics self metrics
kube-state-metrics exposes its own general process metrics under `--telemetry-host` and `--telemetry-port` (default 8081).
kube-state-metrics also exposes list and watch success and error metrics. These can be used to calculate the error rate of list or watch resources.
If you encounter those errors in the metrics, it is most likely a configuration or permission issue, and the next thing to investigate would be looking
at the logs of kube-state-metrics.
Example of the above mentioned metrics:
```prometheus
kube_state_metrics_list_total{resource="*v1.Node",result="success"} 1
kube_state_metrics_list_total{resource="*v1.Node",result="error"} 52
kube_state_metrics_watch_total{resource="*v1beta1.Ingress",result="success"} 1
```
kube-state-metrics also exposes some http request metrics, examples of those are:
```prometheus
http_request_duration_seconds_bucket{handler="metrics",method="get",le="2.5"} 30
http_request_duration_seconds_bucket{handler="metrics",method="get",le="5"} 30
http_request_duration_seconds_bucket{handler="metrics",method="get",le="10"} 30
http_request_duration_seconds_bucket{handler="metrics",method="get",le="+Inf"} 30
http_request_duration_seconds_sum{handler="metrics",method="get"} 0.021113919999999998
http_request_duration_seconds_count{handler="metrics",method="get"} 30
```
kube-state-metrics also exposes build and configuration metrics:
```prometheus
kube_state_metrics_build_info{branch="main",goversion="go1.15.3",revision="6c9d775d",version="v2.0.0-beta"} 1
kube_state_metrics_shard_ordinal{shard_ordinal="0"} 0
kube_state_metrics_total_shards 1
```
`kube_state_metrics_build_info` is used to expose version and other build information. For more usage about the info pattern,
please check this [blog post](https://www.robustperception.io/exposing-the-software-version-to-prometheus).
Sharding metrics expose `--shard` and `--total-shards` flags and can be used to validate
run-time configuration, see [`/examples/prometheus-alerting-rules`](./examples/prometheus-alerting-rules).
kube-state-metrics also exposes metrics about it config file and the Custom Resource State config file:
```prometheus
kube_state_metrics_config_hash{filename="crs.yml",type="customresourceconfig"} 2.38272279311849e+14
kube_state_metrics_config_hash{filename="config.yml",type="config"} 2.65285922340846e+14
kube_state_metrics_last_config_reload_success_timestamp_seconds{filename="crs.yml",type="customresourceconfig"} 1.6704882592037103e+09
kube_state_metrics_last_config_reload_success_timestamp_seconds{filename="config.yml",type="config"} 1.6704882592035313e+09
kube_state_metrics_last_config_reload_successful{filename="crs.yml",type="customresourceconfig"} 1
kube_state_metrics_last_config_reload_successful{filename="config.yml",type="config"} 1
```
### Scaling kube-state-metrics
#### Resource recommendation
Resource usage for kube-state-metrics changes with the Kubernetes objects (Pods/Nodes/Deployments/Secrets etc.) size of the cluster.
To some extent, the Kubernetes objects in a cluster are in direct proportion to the node number of the cluster.
As a general rule, you should allocate:
* 250MiB memory
* 0.1 cores
Note that if CPU limits are set too low, kube-state-metrics' internal queues will not be able to be worked off quickly enough, resulting in increased memory consumption as the queue length grows. If you experience problems resulting from high memory allocation or CPU throttling, try increasing the CPU limits.
### Latency
In a 100 node cluster scaling test the latency numbers were as follows:
```text
"Perc50": 259615384 ns,
"Perc90": 475000000 ns,
"Perc99": 906666666 ns.
```
### A note on costing
By default, kube-state-metrics exposes several metrics for events across your cluster. If you have a large number of frequently-updating resources on your cluster, you may find that a lot of data is ingested into these metrics. This can incur high costs on some cloud providers. Please take a moment to [configure what metrics you'd like to expose](docs/developer/cli-arguments.md), as well as consult the documentation for your Kubernetes environment in order to avoid unexpectedly high costs.
### kube-state-metrics vs. metrics-server
The [metrics-server](https://github.com/kubernetes-incubator/metrics-server)
is a project that has been inspired by
[Heapster](https://github.com/kubernetes-retired/heapster) and is implemented
to serve the goals of core metrics pipelines in [Kubernetes monitoring
architecture](https://github.com/kubernetes/design-proposals-archive/blob/main/instrumentation/monitoring_architecture.md).
It is a cluster level component which periodically scrapes metrics from all
Kubernetes nodes served by Kubelet through Metrics API. The metrics are
aggregated, stored in memory and served in [Metrics API
format](https://git.k8s.io/metrics/pkg/apis/metrics/v1alpha1/types.go). The
metrics-server stores the latest values only and is not responsible for
forwarding metrics to third-party destinations.
kube-state-metrics is focused on generating completely new metrics from
Kubernetes' object state (e.g. metrics based on deployments, replica sets,
etc.). It holds an entire snapshot of Kubernetes state in memory and
continuously generates new metrics based off of it. And just like the
metrics-server it too is not responsible for exporting its metrics anywhere.
Having kube-state-metrics as a separate project also enables access to these
metrics from monitoring systems such as Prometheus.
### Horizontal sharding
In order to shard kube-state-metrics horizontally, some automated sharding capabilities have been implemented. It is configured with the following flags:
* `--shard` (zero indexed)
* `--total-shards`
Sharding is done by taking an md5 sum of the Kubernetes Object's UID and performing a modulo operation on it with the total number of shards. Each shard decides whether the object is handled by the respective instance of kube-state-metrics or not. Note that this means all instances of kube-state-metrics, even if sharded, will have the network traffic and the resource consumption for unmarshaling objects for all objects, not just the ones they are responsible for. To optimize this further, the Kubernetes API would need to support sharded list/watch capabilities. In the optimal case, memory consumption for each shard will be 1/n compared to an unsharded setup. Typically, kube-state-metrics needs to be memory and latency optimized in order for it to return its metrics rather quickly to Prometheus. One way to reduce the latency between kube-state-metrics and the kube-apiserver is to run KSM with the `--use-apiserver-cache` flag. In addition to reducing the latency, this option will also lead to a reduction in the load on etcd.
Sharding should be used carefully and additional monitoring should be set up in order to ensure that sharding is set up and functioning as expected (eg. instances for each shard out of the total shards are configured).
#### Automated sharding
Automatic sharding allows each shard to discover its nominal position when deployed in a StatefulSet which is useful for automatically configuring sharding. This is an experimental feature and may be broken or removed without notice.
To enable automated sharding, kube-state-metrics must be run by a `StatefulSet` and the pod name and namespace must be handed to the kube-state-metrics process via the `--pod` and `--pod-namespace` flags. Example manifests demonstrating the autosharding functionality can be found in [`/examples/autosharding`](./examples/autosharding).
This way of deploying shards is useful when you want to manage KSM shards through a single Kubernetes resource (a single `StatefulSet` in this case) instead of having one `Deployment` per shard. The advantage can be especially significant when deploying a high number of shards.
The downside of using an auto-sharded setup comes from the rollout strategy supported by `StatefulSet`s. When managed by a `StatefulSet`, pods are replaced one at a time with each pod first getting terminated and then recreated. Besides such rollouts being slower, they will also lead to short downtime for each shard. If a Prometheus scrape happens during a rollout, it can miss some of the metrics exported by kube-state-metrics.
### Daemonset sharding for pod metrics
For pod metrics, they can be sharded per node with the following flag:
* `--node=$(NODE_NAME)`
Each kube-state-metrics pod uses FieldSelector (spec.nodeName) to watch/list pod metrics only on the same node.
A daemonset kube-state-metrics example:
```yaml
apiVersion: apps/v1
kind: DaemonSet
spec:
template:
spec:
containers:
- image: registry.k8s.io/kube-state-metrics/kube-state-metrics:IMAGE_TAG
name: kube-state-metrics
args:
- --resource=pods
- --node=$(NODE_NAME)
env:
- name: NODE_NAME
valueFrom:
fieldRef:
apiVersion: v1
fieldPath: spec.nodeName
```
To track metrics for unassigned pods, you need to add an additional deployment and set `--track-unscheduled-pods`, as shown in the following example:
```yaml
apiVersion: apps/v1
kind: Deployment
spec:
template:
spec:
containers:
- image: registry.k8s.io/kube-state-metrics/kube-state-metrics:IMAGE_TAG
name: kube-state-metrics
args:
- --resources=pods
- --track-unscheduled-pods
```
Other metrics can be sharded via [Horizontal sharding](#horizontal-sharding).
### Setup
Install this project to your `$GOPATH` using `go get`:
```bash
go get k8s.io/kube-state-metrics/v2
```
#### Building the Docker container
Simply run the following command in this root folder, which will create a
self-contained, statically-linked binary and build a Docker image:
```bash
make container
```
### Usage
Simply build and run kube-state-metrics inside a Kubernetes pod which has a
service account token that has read-only access to the Kubernetes cluster.
#### For users of prometheus-operator/kube-prometheus stack
The ([`kube-prometheus`](https://github.com/prometheus-operator/kube-prometheus/)) stack installs kube-state-metrics as one of its [components](https://github.com/prometheus-operator/kube-prometheus#kube-prometheus); you do not need to install kube-state-metrics if you're using the kube-prometheus stack.
If you want to revise the default configuration for kube-prometheus, for example to enable non-default metrics, have a look at [Customizing Kube-Prometheus](https://github.com/prometheus-operator/kube-prometheus/blob/main/docs/customizing.md).
#### Kubernetes Deployment
To deploy this project, you can simply run `kubectl apply -f examples/standard` and a Kubernetes service and deployment will be created. (Note: Adjust the apiVersion of some resource if your kubernetes cluster's version is not 1.8+, check the yaml file for more information).
To have Prometheus discover kube-state-metrics instances it is advised to create a specific Prometheus scrape config for kube-state-metrics that picks up both metrics endpoints. Annotation based discovery is discouraged as only one of the endpoints would be able to be selected, plus kube-state-metrics in most cases has special authentication and authorization requirements as it essentially grants read access through the metrics endpoint to most information available to it.
**Note:** Google Kubernetes Engine (GKE) Users - GKE has strict role permissions that will prevent the kube-state-metrics roles and role bindings from being created. To work around this, you can give your GCP identity the cluster-admin role by running the following one-liner:
```bash
kubectl create clusterrolebinding cluster-admin-binding --clusterrole=cluster-admin --user=$(gcloud info --format='value(config.account)')
```
Note that your GCP identity is case sensitive but `gcloud info` as of Google Cloud SDK 221.0.0 is not. This means that if your IAM member contains capital letters, the above one-liner may not work for you. If you have 403 forbidden responses after running the above command and `kubectl apply -f examples/standard`, check the IAM member associated with your account at <https://console.cloud.google.com/iam-admin/iam?project=PROJECT_ID>. If it contains capital letters, you may need to set the --user flag in the command above to the case-sensitive role listed at <https://console.cloud.google.com/iam-admin/iam?project=PROJECT_ID>.
After running the above, if you see `Clusterrolebinding "cluster-admin-binding" created`, then you are able to continue with the setup of this service.
#### Healthcheck Endpoints
The following healthcheck endpoints are available (`self` refers to the telemetry port, while `main` refers to the exposition port):
* `/healthz` (exposed on `main`): Returns a 200 status code if the application is running. We recommend to use this for the startup probe.
* `/livez` (exposed on `main`): Returns a 200 status code if the application is not affected by an outage of the Kubernetes API Server. We recommend to using this for the liveness probe.
* `/readyz` (exposed on `self`): Returns a 200 status code if the application is ready to accept requests and expose metrics. We recommend using this for the readiness probe.
Note that it is discouraged to use the telemetry metrics endpoint for any probe when proxying the exposition data.
#### Limited privileges environment
If you want to run kube-state-metrics in an environment where you don't have cluster-reader role, you can:
* create a serviceaccount
```yaml
apiVersion: v1
kind: ServiceAccount
metadata:
name: kube-state-metrics
namespace: your-namespace-where-kube-state-metrics-will-deployed
```
* give it `view` privileges on specific namespaces (using roleBinding) (*note: you can add this roleBinding to all the NS you want your serviceaccount to access*)
```yaml
apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
metadata:
name: kube-state-metrics
namespace: project1
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: view
subjects:
- kind: ServiceAccount
name: kube-state-metrics
namespace: your-namespace-where-kube-state-metrics-will-deployed
```
* then specify a set of namespaces (using the `--namespaces` option) and a set of kubernetes objects (using the `--resources`) that your serviceaccount has access to in the `kube-state-metrics` deployment configuration
```yaml
spec:
template:
spec:
containers:
- name: kube-state-metrics
args:
- '--resources=pods'
- '--namespaces=project1'
```
For the full list of arguments available, see the documentation in [docs/developer/cli-arguments.md](./docs/developer/cli-arguments.md)
#### Helm Chart
Starting from the kube-state-metrics chart `v2.13.3` (kube-state-metrics image `v1.9.8`), the official [Helm chart](https://artifacthub.io/packages/helm/prometheus-community/kube-state-metrics/) is maintained in [prometheus-community/helm-charts](https://github.com/prometheus-community/helm-charts/tree/main/charts/kube-state-metrics). Starting from kube-state-metrics chart `v3.0.0` only kube-state-metrics images of `v2.0.0 +` are supported.
#### Development
When developing, test a metric dump against your local Kubernetes cluster by running:
> Users can override the apiserver address in KUBE-CONFIG file with `--apiserver` command line.
```bash
go install
kube-state-metrics --port=8080 --telemetry-port=8081 --kubeconfig=<KUBE-CONFIG> --apiserver=<APISERVER>
```
Then curl the metrics endpoint
```bash
curl localhost:8080/metrics
```
To run the e2e tests locally see the documentation in [tests/README.md](./tests/README.md).
#### Developer Contributions
When developing, there are certain code patterns to follow to better your contributing experience and likelihood of e2e and other ci tests to pass. To learn more about them, see the documentation in [docs/developer/guide.md](./docs/developer/guide.md).
#### Community
This project is sponsored by [SIG Instrumentation](https://github.com/kubernetes/community/tree/master/sig-instrumentation).
There is also a channel for [#kube-state-metrics](https://kubernetes.slack.com/archives/CJJ529RUY) on Kubernetes' Slack.
You can also join the SIG Instrumentation [mailing list](https://groups.google.com/forum/#!forum/kubernetes-sig-instrumentation).
This will typically add invites for the following meetings to your calendar, in which topics around kube-state-metrics can be discussed.
* Regular SIG Meeting: [Thursdays at 9:30 PT (Pacific Time)](https://zoom.us/j/5342565819?pwd=RlVsK21NVnR1dmE3SWZQSXhveHZPdz09) (biweekly). [Convert to your timezone](http://www.thetimezoneconverter.com/?t=9:30&tz=PT%20%28Pacific%20Time%29).
* Regular Triage Meeting: [Thursdays at 9:30 PT (Pacific Time)](https://zoom.us/j/5342565819?pwd=RlVsK21NVnR1dmE3SWZQSXhveHZPdz09) (biweekly - alternating with regular meeting). [Convert to your timezone](http://www.thetimezoneconverter.com/?t=9:30&tz=PT%20%28Pacific%20Time%29).

View File

@ -14,15 +14,17 @@ Maintaining the release branches for older minor releases happens on a best effo
## Prepare your release
* Bump the version in the `VERSION` file in the root of the repository.
* Update the [data.yaml](data.yaml)
* Update the compat list
* Update the version key to refer to your new release
* Run `make examples`, which will re-generate all example manifests to use the new version.
* Make a PR to update:
* [Compatibility matrix](README.md#compatibility-matrix)
* Run `make generate`, which will update the compatibility matrix in README.md
* Changelog entry
* Only include user relevant changes
* Entries in the [`CHANGELOG.md`](CHANGELOG.md) are meant to be in this order:
```
```text
[CHANGE]
[FEATURE]
[ENHANCEMENT]

View File

@ -32,6 +32,8 @@ dependencies:
dependencies-lists:
- https://github.com/kubernetes/kube-state-metrics/blob/main/go.mod
- https://github.com/kubernetes/kube-state-metrics/blob/main/Dockerfile
env-dependencies-policy:
policy-url: https://github.com/kubernetes/kube-state-metrics/blob/main/docs/dependencies-policy.md
documentation:
- https://github.com/kubernetes/kube-state-metrics/tree/main/docs
security-testing:

View File

@ -13,3 +13,4 @@
dgrisonnet
mrueg
rexagod
CatherineF-dev

View File

@ -1 +0,0 @@
2.11.0

View File

@ -1,9 +1,9 @@
# See https://cloud.google.com/cloud-build/docs/build-config
timeout: 2400s
timeout: 2700s
options:
substitution_option: ALLOW_LOOSE
steps:
- name: 'gcr.io/k8s-staging-test-infra/gcb-docker-gcloud:v20230522-312425ae46'
- name: 'gcr.io/k8s-staging-test-infra/gcb-docker-gcloud:v20241111-71c32dbdcc'
entrypoint: make
env:
- TAG=$_PULL_BASE_REF

19
data.yaml Normal file
View File

@ -0,0 +1,19 @@
# The purpose of this config is to keep all versions in a single file and make them machine accessible
# Marks the latest release
version: "2.16.0"
# List at max 5 releases here + the main branch
compat:
- version: "v2.12.0"
kubernetes: "1.29"
- version: "v2.13.0"
kubernetes: "1.30"
- version: "v2.14.0"
kubernetes: "1.31"
- version: "v2.15.0"
kubernetes: "1.32"
- version: "v2.16.0"
kubernetes: "1.32"
- version: "main"
kubernetes: "1.33"

View File

@ -32,44 +32,44 @@ See each file for specific documentation about the exposed metrics:
### Default Resources
* [CertificateSigningRequest Metrics](certificatesigningrequest-metrics.md)
* [ConfigMap Metrics](configmap-metrics.md)
* [CronJob Metrics](cronjob-metrics.md)
* [DaemonSet Metrics](daemonset-metrics.md)
* [Deployment Metrics](deployment-metrics.md)
* [Endpoint Metrics](endpoint-metrics.md)
* [Horizontal Pod Autoscaler Metrics](horizontalpodautoscaler-metrics.md)
* [Ingress Metrics](ingress-metrics.md)
* [Job Metrics](job-metrics.md)
* [Lease Metrics](lease-metrics.md)
* [LimitRange Metrics](limitrange-metrics.md)
* [MutatingWebhookConfiguration Metrics](mutatingwebhookconfiguration-metrics.md)
* [Namespace Metrics](namespace-metrics.md)
* [NetworkPolicy Metrics](networkpolicy-metrics.md)
* [Node Metrics](node-metrics.md)
* [PersistentVolume Metrics](persistentvolume-metrics.md)
* [PersistentVolumeClaim Metrics](persistentvolumeclaim-metrics.md)
* [Pod Disruption Budget Metrics](poddisruptionbudget-metrics.md)
* [Pod Metrics](pod-metrics.md)
* [ReplicaSet Metrics](replicaset-metrics.md)
* [ReplicationController Metrics](replicationcontroller-metrics.md)
* [ResourceQuota Metrics](resourcequota-metrics.md)
* [Secret Metrics](secret-metrics.md)
* [Service Metrics](service-metrics.md)
* [StatefulSet Metrics](statefulset-metrics.md)
* [StorageClass Metrics](storageclass-metrics.md)
* [ValidatingWebhookConfiguration Metrics](validatingwebhookconfiguration-metrics.md)
* [VolumeAttachment Metrics](volumeattachment-metrics.md)
* [CertificateSigningRequest Metrics](metrics/auth/certificatesigningrequest-metrics.md)
* [ConfigMap Metrics](metrics/storage/configmap-metrics.md)
* [CronJob Metrics](metrics/workload/cronjob-metrics.md)
* [DaemonSet Metrics](metrics/workload/daemonset-metrics.md)
* [Deployment Metrics](metrics/workload/deployment-metrics.md)
* [Endpoint Metrics](metrics/service/endpoint-metrics.md)
* [Horizontal Pod Autoscaler Metrics](metrics/workload/horizontalpodautoscaler-metrics.md)
* [Ingress Metrics](metrics/service/ingress-metrics.md)
* [Job Metrics](metrics/workload/job-metrics.md)
* [Lease Metrics](metrics/cluster/lease-metrics.md)
* [LimitRange Metrics](metrics/policy/limitrange-metrics.md)
* [MutatingWebhookConfiguration Metrics](metrics/extend/mutatingwebhookconfiguration-metrics.md)
* [Namespace Metrics](metrics/cluster/namespace-metrics.md)
* [NetworkPolicy Metrics](metrics/policy/networkpolicy-metrics.md)
* [Node Metrics](metrics/cluster/node-metrics.md)
* [PersistentVolume Metrics](metrics/storage/persistentvolume-metrics.md)
* [PersistentVolumeClaim Metrics](metrics/storage/persistentvolumeclaim-metrics.md)
* [Pod Disruption Budget Metrics](metrics/policy/poddisruptionbudget-metrics.md)
* [Pod Metrics](metrics/workload/pod-metrics.md)
* [ReplicaSet Metrics](metrics/workload/replicaset-metrics.md)
* [ReplicationController Metrics](metrics/workload/replicationcontroller-metrics.md)
* [ResourceQuota Metrics](metrics/policy/resourcequota-metrics.md)
* [Secret Metrics](metrics/storage/secret-metrics.md)
* [Service Metrics](metrics/service/service-metrics.md)
* [StatefulSet Metrics](metrics/workload/statefulset-metrics.md)
* [StorageClass Metrics](metrics/storage/storageclass-metrics.md)
* [ValidatingWebhookConfiguration Metrics](metrics/extend/validatingwebhookconfiguration-metrics.md)
* [VolumeAttachment Metrics](metrics/storage/volumeattachment-metrics.md)
### Optional Resources
* [ClusterRole Metrics](clusterrole-metrics.md)
* [ClusterRoleBinding Metrics](clusterrolebinding-metrics.md)
* [EndpointSlice Metrics](endpointslice-metrics.md)
* [IngressClass Metrics](ingressclass-metrics.md)
* [Role Metrics](role-metrics.md)
* [RoleBinding Metrics](rolebinding-metrics.md)
* [ServiceAccount Metrics](serviceaccount-metrics.md)
* [ClusterRole Metrics](metrics/cluster/clusterrole-metrics.md)
* [ClusterRoleBinding Metrics](metrics/cluster/clusterrolebinding-metrics.md)
* [EndpointSlice Metrics](metrics/service/endpointslice-metrics.md)
* [IngressClass Metrics](metrics/service/ingressclass-metrics.md)
* [Role Metrics](metrics/auth/role-metrics.md)
* [RoleBinding Metrics](metrics/auth/rolebinding-metrics.md)
* [ServiceAccount Metrics](metrics/auth/serviceaccount-metrics.md)
## Join Metrics
@ -79,21 +79,67 @@ can be used to extend single metrics output.
This example adds `label_release` to the set of default labels of the `kube_pod_status_ready` metric
and allows you select or group the metrics by Helm release label:
```
```promql
kube_pod_status_ready * on (namespace, pod) group_left(label_release) kube_pod_labels
```
Another useful example would be to query the memory usage of pods by its `phase`, such as `Running`:
```
```promql
sum(kube_pod_container_resource_requests{resource="memory"}) by (namespace, pod, node)
* on (namespace, pod) group_left() (sum(kube_pod_status_phase{phase="Running"}) by (pod, namespace) == 1)
```
## Metrics from Custom Resources
See [Custom Resource State Metrics](customresourcestate-metrics.md) for experimental support for custom resources.
See [Custom Resource State Metrics](metrics/extend/customresourcestate-metrics.md) for experimental support for custom resources.
## CLI Arguments
Additionally, options for `kube-state-metrics` can be passed when executing as a CLI, or in a kubernetes / openshift environment. More information can be found here: [CLI Arguments](cli-arguments.md)
Additionally, options for `kube-state-metrics` can be passed when executing as a CLI, or in a kubernetes / openshift environment. More information can be found here: [CLI Arguments](developer/cli-arguments.md)
## Protecting /metrics endpoints
Kube-State-Metrics' metrics can contain sensitive information about the state of the cluster, which you as an operator might want to additionally protect from unauthorized access.
In order to achieve this, you need to enable the `--auth-filter` flag on kube-state-metrics.
With this, kube-state-metrics will only accept authenticated and authorized requests to the /metrics endpoints.
Kube-state-metrics uses Kubernetes' RBAC mechanisms for this, so this means that every scrape will trigger a request against the API Server for TokenReview and SubjectAccessReview.
The clients scraping the endpoint, need to use a token which can be provided by a ServiceAccount that can be set up the following way:
A ClusterRole providing access like this:
```yaml
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
name: metrics-reader
rules:
- nonResourceURLs:
- "/metrics"
verbs:
- get
```
and a matching ClusterRoleBinding
```yaml
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
name: metrics-reader-rolebinding
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: metrics-reader
subjects:
- kind: ServiceAccount
name: YOUR_SERVICE_ACCOUNT
namespace: NAMESPACE_OF_THE_SERVICE_ACCOUNT
```
Your client can then use either this ServiceAccount to gather metrics or you can create a token, that can be used to fetch data like this:
```bash
TOKEN=$(kubectl create token YOUR_SERVICE_ACCOUNT -n NAMESPACE_OF_THE_SERVICE_ACCOUNT)
curl -H "Authorization: Bearer $TOKEN" KUBE_STATE_METRICS_URL:8080/metrics
```

View File

@ -0,0 +1,43 @@
# Dependencies Policy
## Purpose
This policy describes how kube-state-metrics maintainers consume third-party packages.
## Scope
This policy applies to all kube-state-metrics maintainers and all third-party packages used in the kube-state-metrics project.
## Policy
kube-state-metrics maintainers must follow these guidelines when consuming third-party packages:
* Only use third-party packages that are necessary for the functionality of kube-state-metrics.
* Use the latest version of all third-party packages whenever possible.
* Avoid using third-party packages that are known to have security vulnerabilities.
* Pin all third-party packages to specific versions in the kube-state-metrics codebase.
* Use a dependency management tool, such as Go modules, to manage third-party dependencies.
## Procedure
When adding a new third-party package to kube-state-metrics, maintainers must follow these steps:
1. Evaluate the need for the package. Is it necessary for the functionality of kube-state-metrics?
2. Research the package. Is it actively maintained? Does it have a good reputation?
3. Choose a version of the package. Use the latest version whenever possible.
4. Pin the package to the specific version in the kube-state-metrics codebase.
5. Update the kube-state-metrics documentation to reflect the new dependency.
## Enforcement
This policy is enforced by the kube-state-metrics maintainers.
Maintainers are expected to review each other's code changes to ensure that they comply with this policy.
## Exceptions
Exceptions to this policy may be granted by the kube-state-metrics project owners on a case-by-case basis.
## Credits
This policy was adapted from Kubescape's [Environment Dependencies Policy](https://github.com/kubescape/kubescape/blob/master/docs/environment-dependencies-policy.md).

View File

@ -0,0 +1,72 @@
# Kube-State-Metrics - Timeseries best practices
---
Author: Manuel Rüger (<manuel@rueg.eu>)
Date: October 17th 2024
---
## Introduction
Kube-State-Metrics' goal is to provide insights into the state of Kubernetes objects by exposing them as metrics.
This document provides guidelines with the goal to create a good user experience when using these metrics.
Please be aware that this document is introduced in a later stage of the project and there might be metrics that do not follow these best practices.
Feel encouraged to report these metrics and provide a pull request to improve them.
## General best practices
We follow [Prometheus](https://prometheus.io/docs/practices/naming/) best practices in terms of naming and labeling.
## Best practices for kube-state-metrics
### Avoid pre-computation
kube-state-metrics should expose metrics on an individual object level and avoid any sort of pre-computation unless it is required due to for example high cardinality on objects.
We prefer not to add metrics that can be derived from existing raw metrics. For example, we would not want to expose a metric called `kube_pod_total` as it can be computed with `count(kube_pod_info)`.
This way kube-state-metrics allows the user to have full control on how they want to use the metrics and gives them flexibility to do specific computation.
### Static object properties
An object usually has a stable set of properties that do not change during its lifecycle in Kubernetes.
This includes properties like name, namespace, uid etc. that have a 1:1 relationship with the object.
It is a good practice to group those together into an `_info` metric.
If there is a 1:n relationship (e.g. a list of ports), it should be in a separate metric to avoid generating too many metrics.
### Dynamic object properties
An object can also have a dynamic set of properties, which are usually part of the status field.
These change during the lifecycle of the object.
For example a pod can be in different states like "Pending", "Running" etc.
These should be part of a "State Set" that includes labels that identify the object as well as the dynamic property.
### Linked properties
If an object contains a substructure that links multiple properties together (e.g. endpoint address and port), those should be reported in the same metric.
### Optional properties
Some Kubernetes objects have optional fields. In case there is an optional value, the label should still be exposed, ideally as an empty string.
### Timestamps
Timestamps like creation time or modification time should be exposed as a value. The metric should end with `_timestamp_seconds`. The date value is represented in [UNIX epoch seconds](https://en.wikipedia.org/wiki/Unix_time).
### Cardinality
Some object properties can cause cardinality issues if they can contain a lot of different values or are linked together with multiple properties that also can change a lot.
In this case it is better to limit the number of values that can be exposed within kube-state-metrics by allowing only a few of them and have a default for others.
If for example the Kubernetes object contains a status field that contains an error message that can change a lot, it would be better to have a boolean `error="true"` label in case there is an error.
If there are some error messages that are worth exposing, those could be exposed and for any other message, a default value could be provided.
## Stability
We follow the stability framework derived from Kubernetes, in which we expose experimental and stable metrics.
Experimental metrics are recently introduced or expose alpha/beta resources in the Kubernetes API.
They can change anytime and should be used with caution.
They can be promoted to a stable metric once the object stabilized in the Kubernetes API or they were part of two consecutive releases and haven't observed any changes in them.
Stable metrics are considered frozen with the exception of new labels being added.
A stable metric or a label on a stable metric can be deprecated in release Major.Minor and the earliest point it will be removed is the release Major.Minor+2.

View File

@ -58,7 +58,7 @@ properties in memory via the Kubernetes client-go cache, use a map, addressable
by the Kubernetes object uuid, containing all time series of that object as a
single multi-line string.
```
```go
var cache = map[uuid][]byte{}
```
@ -76,7 +76,7 @@ On a scrape request on the /metrics endpoint, kube-state-metrics iterates over
the cache map and concatenates all time series string blobs into a single
string, which is finally passed on as a response.
```
```text
+---------------+ +-----------+ +---------------+ +-------------------+
| pod_reflector | | pod_store | | pod_collector | | metrics_endpoint |
+---------------+ +-----------+ +---------------+ +-------------------+
@ -116,7 +116,7 @@ string, which is finally passed on as a response.
Build via [text-diagram](http://weidagang.github.io/text-diagram/)
```
```text
object pod_reflector pod_store pod_collector metrics_endpoint
note left of pod_reflector: new pod p1
@ -163,8 +163,6 @@ pod_collector -> metrics_endpoint: concat(metrics)
of saving unstructured strings inside the cache map, one can structure them,
using pointers to deduplicate e.g. metric names.
* ...
* Kube-state-metrics does not make use of all properties of all Kubernetes
objects. Instead of unmarshalling unused properties, their json struct tags or
their Protobuf representation could be removed.

View File

@ -23,7 +23,7 @@ spec:
<!-- markdownlint-disable blanks-around-fences -->
<!-- markdownlint-disable link-image-reference-definitions -->
[embedmd]:# (../help.txt)
[embedmd]:# (../../help.txt)
```txt
$ kube-state-metrics -h
kube-state-metrics is a simple service that listens to the Kubernetes API server and generates metrics about the state of the objects.
@ -41,7 +41,10 @@ Flags:
--add_dir_header If true, adds the file directory to the header of the log messages
--alsologtostderr log to standard error as well as files (no effect when -logtostderr=true)
--apiserver string The URL of the apiserver to use as a master
--config string Path to the kube-state-metrics options config file
--auth-filter If true, requires authentication and authorization through Kubernetes API to access metrics endpoints
--auto-gomemlimit Automatically set GOMEMLIMIT to match container or system memory limit. (experimental)
--auto-gomemlimit-ratio float The ratio of reserved GOMEMLIMIT memory to the detected maximum container or system memory. (experimental) (default 0.9)
--config string Path to the kube-state-metrics options config YAML file. If this flag is set, the flags defined in the file override the command line flags.
--custom-resource-state-config string Inline Custom Resource State Metrics config YAML (experimental)
--custom-resource-state-config-file string Path to a Custom Resource State Metrics config file (experimental)
--custom-resource-state-only Only provide Custom Resource State metrics (experimental)
@ -54,19 +57,24 @@ Flags:
--log_file string If non-empty, use this log file (no effect when -logtostderr=true)
--log_file_max_size uint Defines the maximum size a log file can grow to (no effect when -logtostderr=true). Unit is megabytes. If the value is 0, the maximum file size is unlimited. (default 1800)
--logtostderr log to standard error instead of files (default true)
--metric-allowlist string Comma-separated list of metrics to be exposed. This list comprises of exact metric names and/or regex patterns. The allowlist and denylist are mutually exclusive.
--metric-allowlist string Comma-separated list of metrics to be exposed. This list comprises of exact metric names and/or *ECMAScript-based* regex patterns. The allowlist and denylist are mutually exclusive.
--metric-annotations-allowlist string Comma-separated list of Kubernetes annotations keys that will be used in the resource' labels metric. By default the annotations metrics are not exposed. To include them, provide a list of resource names in their plural form and Kubernetes annotation keys you would like to allow for them (Example: '=namespaces=[kubernetes.io/team,...],pods=[kubernetes.io/team],...)'. A single '*' can be provided per resource instead to allow any annotations, but that has severe performance implications (Example: '=pods=[*]').
--metric-denylist string Comma-separated list of metrics not to be enabled. This list comprises of exact metric names and/or regex patterns. The allowlist and denylist are mutually exclusive.
--metric-denylist string Comma-separated list of metrics not to be enabled. This list comprises of exact metric names and/or *ECMAScript-based* regex patterns. The allowlist and denylist are mutually exclusive.
--metric-labels-allowlist string Comma-separated list of additional Kubernetes label keys that will be used in the resource' labels metric. By default the labels metrics are not exposed. To include them, provide a list of resource names in their plural form and Kubernetes label keys you would like to allow for them (Example: '=namespaces=[k8s-label-1,k8s-label-n,...],pods=[app],...)'. A single '*' can be provided per resource instead to allow any labels, but that has severe performance implications (Example: '=pods=[*]'). Additionally, an asterisk (*) can be provided as a key, which will resolve to all resources, i.e., assuming '--resources=deployments,pods', '=*=[*]' will resolve to '=deployments=[*],pods=[*]'.
--metric-opt-in-list string Comma-separated list of metrics which are opt-in and not enabled by default. This is in addition to the metric allow- and denylists
--namespaces string Comma-separated list of namespaces to be enabled. Defaults to ""
--namespaces-denylist string Comma-separated list of namespaces not to be enabled. If namespaces and namespaces-denylist are both set, only namespaces that are excluded in namespaces-denylist will be used.
--node string Name of the node that contains the kube-state-metrics pod. Most likely it should be passed via the downward API. This is used for daemonset sharding. Only available for resources (pod metrics) that support spec.nodeName fieldSelector. This is experimental.
--object-limit int The total number of objects to list per resource from the API Server. (experimental)
--one_output If true, only write logs to their native severity level (vs also writing to each lower severity level; no effect when -logtostderr=true)
--pod string Name of the pod that contains the kube-state-metrics container. When set, it is expected that --pod and --pod-namespace are both set. Most likely this should be passed via the downward API. This is used for auto-detecting sharding. If set, this has preference over statically configured sharding. This is experimental, it may be removed without notice.
--pod-namespace string Name of the namespace of the pod specified by --pod. When set, it is expected that --pod and --pod-namespace are both set. Most likely this should be passed via the downward API. This is used for auto-detecting sharding. If set, this has preference over statically configured sharding. This is experimental, it may be removed without notice.
--port int Port to expose metrics on. (default 8080)
--resources string Comma-separated list of Resources to be enabled. Defaults to "certificatesigningrequests,configmaps,cronjobs,daemonsets,deployments,endpoints,horizontalpodautoscalers,ingresses,jobs,leases,limitranges,mutatingwebhookconfigurations,namespaces,networkpolicies,nodes,persistentvolumeclaims,persistentvolumes,poddisruptionbudgets,pods,replicasets,replicationcontrollers,resourcequotas,secrets,services,statefulsets,storageclasses,validatingwebhookconfigurations,volumeattachments"
--server-idle-timeout duration The maximum amount of time to wait for the next request when keep-alives are enabled. Align with the idletimeout of your scrape clients. (default 5m0s)
--server-read-header-timeout duration The maximum duration for reading the header of requests. (default 5s)
--server-read-timeout duration The maximum duration for reading the entire request, including the body. Align with the scrape interval or timeout of scraping clients. (default 1m0s)
--server-write-timeout duration The maximum duration before timing out writes of the response. Align with the scrape interval or timeout of scraping clients.. (default 1m0s)
--shard int32 The instances shard nominal (zero indexed) within the total number of shards. (default 0)
--skip_headers If true, avoid header prefixes in the log messages
--skip_log_headers If true, avoid headers when opening log files (no effect when -logtostderr=true)
@ -75,6 +83,7 @@ Flags:
--telemetry-port int Port to expose kube-state-metrics self metrics on. (default 8081)
--tls-config string Path to the TLS configuration file
--total-shards int The total number of shards. Sharding is disabled when total shards is set to 1. (default 1)
--track-unscheduled-pods This configuration is used in conjunction with node configuration. When this configuration is true, node configuration is empty and the metric of unscheduled pods is fetched from the Kubernetes API Server. This is experimental.
--use-apiserver-cache Sets resourceVersion=0 for ListWatch requests, using cached resources from the apiserver instead of an etcd quorum read.
-v, --v Level number for the log level verbosity
--vmodule moduleSpec comma-separated list of pattern=N settings for file-filtered logging

View File

@ -12,15 +12,15 @@ Any contribution to improving this documentation will be appreciated.
The following steps are needed to introduce a new resource and its respective resource metrics.
* Reference your new resource(s) to the [docs/README.md](https://github.com/kubernetes/kube-state-metrics/blob/main/docs/README.md#exposed-metrics).
* Reference your new resource(s) in the [docs/cli-arguments.md](https://github.com/kubernetes/kube-state-metrics/blob/main/docs/cli-arguments.md#available-options) as part of the `--resources` flag.
* Create a new `<name-of-resource>.md` in the [docs](https://github.com/kubernetes/kube-state-metrics/tree/main/docs) directory to provide documentation on the resource(s) and metrics you implemented. Follow the formatting of all other resources.
* Add the resource(s) you are representing to the [jsonnet/kube-state-metrics/kube-state-metrics.libsonnet](https://github.com/kubernetes/kube-state-metrics/blob/main/jsonnet/kube-state-metrics/kube-state-metrics.libsonnet) under the appropriate `apiGroup` using the `verbs`: `list` and `watch`.
* Run `make examples/standard`, this should re-generate [examples/standard/cluster-role.yaml](https://github.com/kubernetes/kube-state-metrics/blob/main/examples/standard/cluster-role.yaml) with the resource(s) added to [jsonnet/kube-state-metrics/kube-state-metrics.libsonnet](https://github.com/kubernetes/kube-state-metrics/blob/main/jsonnet/kube-state-metrics/kube-state-metrics.libsonnet).
* Reference and add build functions for the new resource(s) in [internal/store/builder.go](https://github.com/kubernetes/kube-state-metrics/blob/main/internal/store/builder.go).
* Reference the new resource in [pkg/options/resource.go](https://github.com/kubernetes/kube-state-metrics/blob/main/pkg/options/resource.go).
* Add a sample Kubernetes manifest to be used by tests in the [tests/manifests/](https://github.com/kubernetes/kube-state-metrics/tree/main/tests/manifests) directory.
* Lastly, and most importantly, actually implement your new resource(s) and its test binary in [internal/store](https://github.com/kubernetes/kube-state-metrics/tree/main/internal/store). Follow the formatting and structure of other resources.
* Reference your new resource(s) to the [docs/README.md](./../README.md#exposed-metrics).
* Reference your new resource(s) in the [docs/developer/cli-arguments.md](./cli-arguments.md#available-options) as part of the `--resources` flag.
* Create a new `<name-of-resource>.md` in the [docs](./../docs) directory to provide documentation on the resource(s) and metrics you implemented. Follow the formatting of all other resources.
* Add the resource(s) you are representing to the [jsonnet/kube-state-metrics/kube-state-metrics.libsonnet](./../../jsonnet/kube-state-metrics/kube-state-metrics.libsonnet) under the appropriate `apiGroup` using the `verbs`: `list` and `watch`.
* Run `make examples/standard`, this should re-generate [examples/standard/cluster-role.yaml](./../../examples/standard/cluster-role.yaml) with the resource(s) added to [jsonnet/kube-state-metrics/kube-state-metrics.libsonnet](./../../jsonnet/kube-state-metrics/kube-state-metrics.libsonnet).
* Reference and add build functions for the new resource(s) in [internal/store/builder.go](./../../internal/store/builder.go).
* Reference the new resource in [pkg/options/resource.go](./../../pkg/options/resource.go).
* Add a sample Kubernetes manifest to be used by tests in the [tests/manifests/](./../../tests/manifests) directory.
* Lastly, and most importantly, actually implement your new resource(s) and its test binary in [internal/store](./../../internal/store). Follow the formatting and structure of other resources.
### Add New Metrics

View File

@ -2,8 +2,8 @@
| Metric name | Metric type | Description | Labels/tags | Status |
| ------------------------------------------ | ----------- | ------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------ |
| kube_certificatesigningrequest_annotations | Gauge | Kubernetes annotations converted to Prometheus labels controlled via [--metric-annotations-allowlist](./cli-arguments.md) | `certificatesigningrequest`=&lt;certificatesigningrequest-name&gt; <br> `signer_name`=&lt;certificatesigningrequest-signer-name&gt; | EXPERIMENTAL |
| kube_certificatesigningrequest_annotations | Gauge | Kubernetes annotations converted to Prometheus labels controlled via [--metric-annotations-allowlist](../../developer/cli-arguments.md) | `certificatesigningrequest`=&lt;certificatesigningrequest-name&gt; <br> `signer_name`=&lt;certificatesigningrequest-signer-name&gt; | EXPERIMENTAL |
| kube_certificatesigningrequest_created | Gauge | | `certificatesigningrequest`=&lt;certificatesigningrequest-name&gt; <br> `signer_name`=&lt;certificatesigningrequest-signer-name&gt; | STABLE |
| kube_certificatesigningrequest_condition | Gauge | | `certificatesigningrequest`=&lt;certificatesigningrequest-name&gt; <br> `signer_name`=&lt;certificatesigningrequest-signer-name&gt; <br> `condition`=&lt;approved\|denied&gt; | STABLE |
| kube_certificatesigningrequest_labels | Gauge | Kubernetes labels converted to Prometheus labels controlled via [--metric-labels-allowlist](./cli-arguments.md) | `certificatesigningrequest`=&lt;certificatesigningrequest-name&gt; <br> `signer_name`=&lt;certificatesigningrequest-signer-name&gt; | STABLE |
| kube_certificatesigningrequest_labels | Gauge | Kubernetes labels converted to Prometheus labels controlled via [--metric-labels-allowlist](../../developer/cli-arguments.md) | `certificatesigningrequest`=&lt;certificatesigningrequest-name&gt; <br> `signer_name`=&lt;certificatesigningrequest-signer-name&gt; | STABLE |
| kube_certificatesigningrequest_cert_length | Gauge | | `certificatesigningrequest`=&lt;certificatesigningrequest-name&gt; <br> `signer_name`=&lt;certificatesigningrequest-signer-name&gt; | STABLE |

View File

@ -2,8 +2,8 @@
| Metric name | Metric type | Description | Labels/tags | Status |
| ----------------------------------- | ----------- | ------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------- | ------------ |
| kube_role_annotations | Gauge | Kubernetes annotations converted to Prometheus labels controlled via [--metric-annotations-allowlist](./cli-arguments.md) | `role`=&lt;role-name&gt; <br> `namespace`=&lt;role-namespace&gt; | EXPERIMENTAL |
| kube_role_labels | Gauge | Kubernetes labels converted to Prometheus labels controlled via [--metric-labels-allowlist](./cli-arguments.md) | `role`=&lt;role-name&gt; <br> `namespace`=&lt;role-namespace&gt; | EXPERIMENTAL |
| kube_role_annotations | Gauge | Kubernetes annotations converted to Prometheus labels controlled via [--metric-annotations-allowlist](../../developer/cli-arguments.md) | `role`=&lt;role-name&gt; <br> `namespace`=&lt;role-namespace&gt; | EXPERIMENTAL |
| kube_role_labels | Gauge | Kubernetes labels converted to Prometheus labels controlled via [--metric-labels-allowlist](../../developer/cli-arguments.md) | `role`=&lt;role-name&gt; <br> `namespace`=&lt;role-namespace&gt; | EXPERIMENTAL |
| kube_role_info | Gauge | | `role`=&lt;role-name&gt; <br> `namespace`=&lt;role-namespace&gt; | EXPERIMENTAL |
| kube_role_created | Gauge | | `role`=&lt;role-name&gt; <br> `namespace`=&lt;role-namespace&gt; | EXPERIMENTAL |
| kube_role_metadata_resource_version | Gauge | | `role`=&lt;role-name&gt; <br> `namespace`=&lt;role-namespace&gt; | EXPERIMENTAL |

View File

@ -2,8 +2,8 @@
| Metric name | Metric type | Description | Labels/tags | Status |
| ------------------------------------------ | ----------- | ------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------ |
| kube_rolebinding_annotations | Gauge | Kubernetes annotations converted to Prometheus labels controlled via [--metric-annotations-allowlist](./cli-arguments.md) | `rolebinding`=&lt;rolebinding-name&gt; <br> `namespace`=&lt;rolebinding-namespace&gt; | EXPERIMENTAL |
| kube_rolebinding_labels | Gauge | Kubernetes labels converted to Prometheus labels controlled via [--metric-labels-allowlist](./cli-arguments.md) | `rolebinding`=&lt;rolebinding-name&gt; <br> `namespace`=&lt;rolebinding-namespace&gt; | EXPERIMENTAL |
| kube_rolebinding_annotations | Gauge | Kubernetes annotations converted to Prometheus labels controlled via [--metric-annotations-allowlist](../../developer/cli-arguments.md) | `rolebinding`=&lt;rolebinding-name&gt; <br> `namespace`=&lt;rolebinding-namespace&gt; | EXPERIMENTAL |
| kube_rolebinding_labels | Gauge | Kubernetes labels converted to Prometheus labels controlled via [--metric-labels-allowlist](../../developer/cli-arguments.md) | `rolebinding`=&lt;rolebinding-name&gt; <br> `namespace`=&lt;rolebinding-namespace&gt; | EXPERIMENTAL |
| kube_rolebinding_info | Gauge | | `rolebinding`=&lt;rolebinding-name&gt; <br> `namespace`=&lt;rolebinding-namespace&gt; <br> `roleref_kind`=&lt;role-kind&gt; <br> `roleref_name`=&lt;role-name&gt; | EXPERIMENTAL |
| kube_rolebinding_created | Gauge | | `rolebinding`=&lt;rolebinding-name&gt; <br> `namespace`=&lt;rolebinding-namespace&gt; | EXPERIMENTAL |
| kube_rolebinding_metadata_resource_version | Gauge | | `rolebinding`=&lt;rolebinding-name&gt; <br> `namespace`=&lt;rolebinding-namespace&gt; | EXPERIMENTAL |

View File

@ -7,5 +7,5 @@
| kube_serviceaccount_deleted | Gauge | Unix deletion timestamp | | `namespace`=&lt;serviceaccount-namespace&gt; <br> `serviceaccount`=&lt;serviceaccount-name&gt; <br> `uid`=&lt;serviceaccount-uid&gt; | EXPERIMENTAL |
| kube_serviceaccount_secret | Gauge | Secret being referenced by a service account | | `namespace`=&lt;serviceaccount-namespace&gt; <br> `serviceaccount`=&lt;serviceaccount-name&gt; <br> `uid`=&lt;serviceaccount-uid&gt; <br> `name`=&lt;secret-name&gt; | EXPERIMENTAL |
| kube_serviceaccount_image_pull_secret | Gauge | Secret being referenced by a service account for the purpose of pulling images | | `namespace`=&lt;serviceaccount-namespace&gt; <br> `serviceaccount`=&lt;serviceaccount-name&gt; <br> `uid`=&lt;serviceaccount-uid&gt; <br> `name`=&lt;secret-name&gt; | EXPERIMENTAL |
| kube_serviceaccount_annotations | Gauge | Kubernetes annotations converted to Prometheus labels controlled via [--metric-annotations-allowlist](./cli-arguments.md) | | `namespace`=&lt;serviceaccount-namespace&gt; <br> `serviceaccount`=&lt;serviceaccount-name&gt; <br> `uid`=&lt;serviceaccount-uid&gt; <br> `annotation_SERVICE_ACCOUNT_ANNOTATION`=&lt;SERVICE_ACCOUNT_ANNOTATION&gt; | EXPERIMENTAL |
| kube_serviceaccount_labels | Gauge | Kubernetes labels converted to Prometheus labels controlled via [--metric-labels-allowlist](./cli-arguments.md) | | `namespace`=&lt;serviceaccount-namespace&gt; <br> `serviceaccount`=&lt;serviceaccount-name&gt; <br> `uid`=&lt;serviceaccount-uid&gt; <br> `label_SERVICE_ACCOUNT_LABEL`=&lt;SERVICE_ACCOUNT_LABEL&gt; | EXPERIMENTAL |
| kube_serviceaccount_annotations | Gauge | Kubernetes annotations converted to Prometheus labels controlled via [--metric-annotations-allowlist](../../developer/cli-arguments.md) | | `namespace`=&lt;serviceaccount-namespace&gt; <br> `serviceaccount`=&lt;serviceaccount-name&gt; <br> `uid`=&lt;serviceaccount-uid&gt; <br> `annotation_SERVICE_ACCOUNT_ANNOTATION`=&lt;SERVICE_ACCOUNT_ANNOTATION&gt; | EXPERIMENTAL |
| kube_serviceaccount_labels | Gauge | Kubernetes labels converted to Prometheus labels controlled via [--metric-labels-allowlist](../../developer/cli-arguments.md) | | `namespace`=&lt;serviceaccount-namespace&gt; <br> `serviceaccount`=&lt;serviceaccount-name&gt; <br> `uid`=&lt;serviceaccount-uid&gt; <br> `label_SERVICE_ACCOUNT_LABEL`=&lt;SERVICE_ACCOUNT_LABEL&gt; | EXPERIMENTAL |

View File

@ -2,8 +2,8 @@
| Metric name | Metric type | Description | Labels/tags | Status |
| ------------------------------------------ | ----------- | ------------------------------------------------------------------------------------------------------------------------- | -------------------------------------- | ------------ |
| kube_clusterrole_annotations | Gauge | Kubernetes annotations converted to Prometheus labels controlled via [--metric-annotations-allowlist](./cli-arguments.md) | `clusterrole`=&lt;clusterrole-name&gt; | EXPERIMENTAL |
| kube_clusterrole_labels | Gauge | Kubernetes labels converted to Prometheus labels controlled via [--metric-labels-allowlist](./cli-arguments.md) | `clusterrole`=&lt;clusterrole-name&gt; | EXPERIMENTAL |
| kube_clusterrole_annotations | Gauge | Kubernetes annotations converted to Prometheus labels controlled via [--metric-annotations-allowlist](../../developer/cli-arguments.md) | `clusterrole`=&lt;clusterrole-name&gt; | EXPERIMENTAL |
| kube_clusterrole_labels | Gauge | Kubernetes labels converted to Prometheus labels controlled via [--metric-labels-allowlist](../../developer/cli-arguments.md) | `clusterrole`=&lt;clusterrole-name&gt; | EXPERIMENTAL |
| kube_clusterrole_info | Gauge | | `clusterrole`=&lt;clusterrole-name&gt; | EXPERIMENTAL |
| kube_clusterrole_created | Gauge | | `clusterrole`=&lt;clusterrole-name&gt; | EXPERIMENTAL |
| kube_clusterrole_metadata_resource_version | Gauge | | `clusterrole`=&lt;clusterrole-name&gt; | EXPERIMENTAL |

View File

@ -2,8 +2,8 @@
| Metric name | Metric type | Description | Labels/tags | Status |
| ------------------------------------------------- | ----------- | ------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------- | ------------ |
| kube_clusterrolebinding_annotations | Gauge | Kubernetes annotations converted to Prometheus labels controlled via [--metric-annotations-allowlist](./cli-arguments.md) | `clusterrolebinding`=&lt;clusterrolebinding-name&gt; | EXPERIMENTAL |
| kube_clusterrolebinding_labels | Gauge | Kubernetes labels converted to Prometheus labels controlled via [--metric-labels-allowlist](./cli-arguments.md) | `clusterrolebinding`=&lt;clusterrolebinding-name&gt; | EXPERIMENTAL |
| kube_clusterrolebinding_annotations | Gauge | Kubernetes annotations converted to Prometheus labels controlled via [--metric-annotations-allowlist](../../developer/cli-arguments.md) | `clusterrolebinding`=&lt;clusterrolebinding-name&gt; | EXPERIMENTAL |
| kube_clusterrolebinding_labels | Gauge | Kubernetes labels converted to Prometheus labels controlled via [--metric-labels-allowlist](../../developer/cli-arguments.md) | `clusterrolebinding`=&lt;clusterrolebinding-name&gt; | EXPERIMENTAL |
| kube_clusterrolebinding_info | Gauge | | `clusterrolebinding`=&lt;clusterrolebinding-name&gt; <br> `roleref_kind`=&lt;role-kind&gt; <br> `roleref_name`=&lt;role-name&gt; | EXPERIMENTAL |
| kube_clusterrolebinding_created | Gauge | | `clusterrolebinding`=&lt;clusterrolebinding-name&gt; | EXPERIMENTAL |
| kube_clusterrolebinding_metadata_resource_version | Gauge | | `clusterrolebinding`=&lt;clusterrolebinding-name&gt; | EXPERIMENTAL |

View File

@ -2,8 +2,8 @@
| Metric name | Metric type | Description | Labels/tags | Status |
| ------------------------------- | ----------- | ------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------ |
| kube_namespace_annotations | Gauge | Kubernetes annotations converted to Prometheus labels controlled via [--metric-annotations-allowlist](./cli-arguments.md) | `namespace`=&lt;namespace-name&gt; <br> `label_NS_ANNOTATION`=&lt;NS_ANNOTATION&gt; | EXPERIMENTAL |
| kube_namespace_annotations | Gauge | Kubernetes annotations converted to Prometheus labels controlled via [--metric-annotations-allowlist](../../developer/cli-arguments.md) | `namespace`=&lt;namespace-name&gt; <br> `label_NS_ANNOTATION`=&lt;NS_ANNOTATION&gt; | EXPERIMENTAL |
| kube_namespace_created | Gauge | | `namespace`=&lt;namespace-name&gt; | STABLE |
| kube_namespace_labels | Gauge | Kubernetes labels converted to Prometheus labels controlled via [--metric-labels-allowlist](./cli-arguments.md) | `namespace`=&lt;namespace-name&gt; <br> `label_NS_LABEL`=&lt;NS_LABEL&gt; | STABLE |
| kube_namespace_labels | Gauge | Kubernetes labels converted to Prometheus labels controlled via [--metric-labels-allowlist](../../developer/cli-arguments.md) | `namespace`=&lt;namespace-name&gt; <br> `label_NS_LABEL`=&lt;NS_LABEL&gt; | STABLE |
| kube_namespace_status_condition | Gauge | | `namespace`=&lt;namespace-name&gt; <br> `condition`=&lt;NamespaceDeletionDiscoveryFailure\|NamespaceDeletionContentFailure\|NamespaceDeletionGroupVersionParsingFailure&gt; <br> `status`=&lt;true\|false\|unknown&gt; | EXPERIMENTAL |
| kube_namespace_status_phase | Gauge | | `namespace`=&lt;namespace-name&gt; <br> `phase`=&lt;Active\|Terminating&gt; | STABLE |

View File

@ -2,9 +2,9 @@
| Metric name | Metric type | Description | Unit (where applicable) | Labels/tags | Status |
| ---------------------------- | ----------- | ------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------ |
| kube_node_annotations | Gauge | Kubernetes annotations converted to Prometheus labels controlled via [--metric-annotations-allowlist](./cli-arguments.md) | | `node`=&lt;node-address&gt; <br> `annotation_NODE_ANNOTATION`=&lt;NODE_ANNOTATION&gt; | EXPERIMENTAL |
| kube_node_info | Gauge | Information about a cluster node | | `node`=&lt;node-address&gt; <br> `kernel_version`=&lt;kernel-version&gt; <br> `os_image`=&lt;os-image-name&gt; <br> `container_runtime_version`=&lt;container-runtime-and-version-combination&gt; <br> `kubelet_version`=&lt;kubelet-version&gt; <br> `kubeproxy_version`=&lt;kubeproxy-version&gt; <br> `pod_cidr`=&lt;pod-cidr&gt; <br> `provider_id`=&lt;provider-id&gt; <br> `system_uuid`=&lt;system-uuid&gt; <br> `internal_ip`=&lt;internal-ip&gt; | STABLE |
| kube_node_labels | Gauge | Kubernetes labels converted to Prometheus labels controlled via [--metric-labels-allowlist](./cli-arguments.md) | | `node`=&lt;node-address&gt; <br> `label_NODE_LABEL`=&lt;NODE_LABEL&gt; | STABLE |
| kube_node_annotations | Gauge | Kubernetes annotations converted to Prometheus labels controlled via [--metric-annotations-allowlist](../../developer/cli-arguments.md) | | `node`=&lt;node-address&gt; <br> `annotation_NODE_ANNOTATION`=&lt;NODE_ANNOTATION&gt; | EXPERIMENTAL |
| kube_node_info | Gauge | Information about a cluster node | | `node`=&lt;node-address&gt; <br> `kernel_version`=&lt;kernel-version&gt; <br> `os_image`=&lt;os-image-name&gt; <br> `container_runtime_version`=&lt;container-runtime-and-version-combination&gt; <br> `kubelet_version`=&lt;kubelet-version&gt; <br> `kubeproxy_version`=&lt;deprecated&gt; <br> `pod_cidr`=&lt;pod-cidr&gt; <br> `provider_id`=&lt;provider-id&gt; <br> `system_uuid`=&lt;system-uuid&gt; <br> `internal_ip`=&lt;internal-ip&gt; | STABLE |
| kube_node_labels | Gauge | Kubernetes labels converted to Prometheus labels controlled via [--metric-labels-allowlist](../../developer/cli-arguments.md) | | `node`=&lt;node-address&gt; <br> `label_NODE_LABEL`=&lt;NODE_LABEL&gt; | STABLE |
| kube_node_role | Gauge | The role of a cluster node | | `node`=&lt;node-address&gt; <br> `role`=&lt;NODE_ROLE&gt; | EXPERIMENTAL |
| kube_node_spec_unschedulable | Gauge | Whether a node can schedule new pods | | `node`=&lt;node-address&gt; | STABLE |
| kube_node_spec_taint | Gauge | The taint of a cluster node. | | `node`=&lt;node-address&gt; <br> `key`=&lt;taint-key&gt; <br> `value=`&lt;taint-value&gt; <br> `effect=`&lt;taint-effect&gt; | STABLE |

View File

@ -32,6 +32,7 @@ spec:
# in YAML files, | allows a multi-line string to be passed as a flag value
# see https://yaml-multiline.info
- |
kind: CustomResourceStateMetrics
spec:
resources:
- groupVersionKind:
@ -65,6 +66,7 @@ spec:
# in YAML files, | allows a multi-line string to be passed as a flag value
# see https://yaml-multiline.info
- |
kind: CustomResourceStateMetrics
spec:
resources:
- groupVersionKind:
@ -198,6 +200,8 @@ spec:
# whole objects may be copied into labels by prefixing with "*"
# *anything will be copied into labels, with the highest sorted * strings first
"*": [metadata, labels]
# a prefix before the asterisk will be used as a label prefix
"lorem_*": [metadata, annotations]
"**": [metadata, annotations]
# or specific fields may be copied. these fields will always override values from *s
@ -208,8 +212,12 @@ spec:
Produces the following metrics:
```prometheus
kube_customresource_ready_count{customresource_group="myteam.io", customresource_kind="Foo", customresource_version="v1", active="1",custom_metric="yes",foo="bar",name="foo",bar="baz",qux="quxx",type="type-a"} 2
kube_customresource_ready_count{customresource_group="myteam.io", customresource_kind="Foo", customresource_version="v1", active="3",custom_metric="yes",foo="bar",name="foo",bar="baz",qux="quxx",type="type-b"} 4
kube_customresource_ready_count{customresource_group="myteam.io", customresource_kind="Foo",
customresource_version="v1", active="1",custom_metric="yes",foo="bar",name="foo",bar="baz",qux="quxx",type="type-a",
lorem_bar="baz",lorem_qux="quxx",} 2
kube_customresource_ready_count{customresource_group="myteam.io", customresource_kind="Foo",
customresource_version="v1", active="3",custom_metric="yes",foo="bar",name="foo",bar="baz",qux="quxx",type="type-b",
lorem_bar="baz",lorem_qux="quxx",} 4
```
#### Non-map Arrays
@ -248,6 +256,73 @@ kube_customresource_ref_info{customresource_group="myteam.io", customresource_ki
kube_customresource_ref_info{customresource_group="myteam.io", customresource_kind="Foo", customresource_version="v1", name="foo",ref="foo_with_extensions"} 1
```
#### Same Metrics with Different Labels
```yaml
recommendation:
containerRecommendations:
- containerName: consumer
lowerBound:
cpu: 100m
memory: 262144k
```
For example in VPA we have above attributes and we want to have a same metrics for both CPU and Memory, you can use below config:
```yaml
kind: CustomResourceStateMetrics
spec:
resources:
- groupVersionKind:
group: autoscaling.k8s.io
kind: "VerticalPodAutoscaler"
version: "v1"
labelsFromPath:
verticalpodautoscaler: [metadata, name]
namespace: [metadata, namespace]
target_api_version: [apiVersion]
target_kind: [spec, targetRef, kind]
target_name: [spec, targetRef, name]
metrics:
# for memory
- name: "verticalpodautoscaler_status_recommendation_containerrecommendations_lowerbound"
help: "Minimum memory resources the container can use before the VerticalPodAutoscaler updater evicts it."
commonLabels:
unit: "byte"
resource: "memory"
each:
type: Gauge
gauge:
path: [status, recommendation, containerRecommendations]
labelsFromPath:
container: [containerName]
valueFrom: [lowerBound, memory]
# for CPU
- name: "verticalpodautoscaler_status_recommendation_containerrecommendations_lowerbound"
help: "Minimum cpu resources the container can use before the VerticalPodAutoscaler updater evicts it."
commonLabels:
unit: "core"
resource: "cpu"
each:
type: Gauge
gauge:
path: [status, recommendation, containerRecommendations]
labelsFromPath:
container: [containerName]
valueFrom: [lowerBound, cpu]
```
Produces the following metrics:
```prometheus
# HELP kube_customresource_verticalpodautoscaler_status_recommendation_containerrecommendations_lowerbound Minimum memory resources the container can use before the VerticalPodAutoscaler updater evicts it.
# TYPE kube_customresource_verticalpodautoscaler_status_recommendation_containerrecommendations_lowerbound gauge
kube_customresource_verticalpodautoscaler_status_recommendation_containerrecommendations_lowerbound{container="consumer",customresource_group="autoscaling.k8s.io",customresource_kind="VerticalPodAutoscaler",customresource_version="v1",namespace="namespace-example",resource="memory",target_api_version="apps/v1",target_kind="Deployment",target_name="target-name-example",unit="byte",verticalpodautoscaler="vpa-example"} 123456
# HELP kube_customresource_verticalpodautoscaler_status_recommendation_containerrecommendations_lowerbound Minimum cpu resources the container can use before the VerticalPodAutoscaler updater evicts it.
# TYPE kube_customresource_verticalpodautoscaler_status_recommendation_containerrecommendations_lowerbound gauge
kube_customresource_verticalpodautoscaler_status_recommendation_containerrecommendations_lowerbound{container="consumer",customresource_group="autoscaling.k8s.io",customresource_kind="VerticalPodAutoscaler",customresource_version="v1",namespace="namespace-example",resource="cpu",target_api_version="apps/v1",target_kind="Deployment",target_name="target-name-example",unit="core",verticalpodautoscaler="vpa-example"} 0.1
```
#### VerticalPodAutoscaler
In v2.9.0 the `vericalpodautoscalers` resource was removed from the list of default resources. In order to generate metrics for `verticalpodautoscalers`, you can use the following Custom Resource State config:
@ -286,15 +361,226 @@ spec:
The above configuration was tested on [this](https://github.com/kubernetes/autoscaler/blob/master/vertical-pod-autoscaler/examples/hamster.yaml) VPA configuration, with an added annotation (`foo: 123`).
#### All VerticalPodAutoscaler Metrics
As an addition for the above configuration, here's the complete `CustomResourceStateMetrics` spec to re-enable all of the VPA metrics which are removed from the list of the default resources:
<details>
<summary>VPA CustomResourceStateMetrics</summary>
```yaml
kind: CustomResourceStateMetrics
spec:
resources:
- groupVersionKind:
group: autoscaling.k8s.io
kind: "VerticalPodAutoscaler"
version: "v1"
labelsFromPath:
namespace: [metadata, namespace]
target_api_version: [spec, targetRef, apiVersion]
target_kind: [spec, targetRef, kind]
target_name: [spec, targetRef, name]
verticalpodautoscaler: [metadata, name]
metricNamePrefix: "kube"
metrics:
# kube_verticalpodautoscaler_annotations
- name: "verticalpodautoscaler_annotations"
help: "Kubernetes annotations converted to Prometheus labels."
each:
type: Info
info:
labelsFromPath:
annotation_*: [metadata, annotations]
name: [metadata, name]
# kube_verticalpodautoscaler_labels
- name: "verticalpodautoscaler_labels"
help: "Kubernetes labels converted to Prometheus labels."
each:
type: Info
info:
labelsFromPath:
label_*: [metadata, labels]
name: [metadata, name]
# kube_verticalpodautoscaler_spec_updatepolicy_updatemode
- name: "verticalpodautoscaler_spec_updatepolicy_updatemode"
help: "Update mode of the VerticalPodAutoscaler."
each:
type: StateSet
stateSet:
labelName: "update_mode"
path: [spec, updatePolicy, updateMode]
list: ["Auto", "Initial", "Off", "Recreate"]
# Memory kube_verticalpodautoscaler_spec_resourcepolicy_container_policies_minallowed_memory
- name: "verticalpodautoscaler_spec_resourcepolicy_container_policies_minallowed_memory"
help: "Minimum memory resources the VerticalPodAutoscaler can set for containers matching the name."
commonLabels:
unit: "byte"
resource: "memory"
each:
type: Gauge
gauge:
path: [spec, resourcePolicy, containerPolicies]
labelsFromPath:
container: [containerName]
valueFrom: [minAllowed, memory]
# CPU kube_verticalpodautoscaler_spec_resourcepolicy_container_policies_minallowed_cpu
- name: "verticalpodautoscaler_spec_resourcepolicy_container_policies_minallowed_cpu"
help: "Minimum cpu resources the VerticalPodAutoscaler can set for containers matching the name."
commonLabels:
unit: "core"
resource: "cpu"
each:
type: Gauge
gauge:
path: [spec, resourcePolicy, containerPolicies]
labelsFromPath:
container: [containerName]
valueFrom: [minAllowed, cpu]
# Memory kube_verticalpodautoscaler_spec_resourcepolicy_container_policies_maxallowed_memory
- name: "verticalpodautoscaler_spec_resourcepolicy_container_policies_maxallowed_memory"
help: "Maximum memory resources the VerticalPodAutoscaler can set for containers matching the name."
commonLabels:
unit: "byte"
resource: "memory"
each:
type: Gauge
gauge:
path: [spec, resourcePolicy, containerPolicies]
labelsFromPath:
container: [containerName]
valueFrom: [maxAllowed, memory]
# CPU kube_verticalpodautoscaler_spec_resourcepolicy_container_policies_maxallowed_cpu
- name: "verticalpodautoscaler_spec_resourcepolicy_container_policies_maxallowed_cpu"
help: "Maximum cpu resources the VerticalPodAutoscaler can set for containers matching the name."
commonLabels:
unit: "core"
resource: "cpu"
each:
type: Gauge
gauge:
path: [spec, resourcePolicy, containerPolicies]
labelsFromPath:
container: [containerName]
valueFrom: [maxAllowed, cpu]
# Memory kube_verticalpodautoscaler_status_recommendation_containerrecommendations_lowerbound_memory
- name: "verticalpodautoscaler_status_recommendation_containerrecommendations_lowerbound_memory"
help: "Minimum memory resources the container can use before the VerticalPodAutoscaler updater evicts it."
commonLabels:
unit: "byte"
resource: "memory"
each:
type: Gauge
gauge:
path: [status, recommendation, containerRecommendations]
labelsFromPath:
container: [containerName]
valueFrom: [lowerBound, memory]
# CPU kube_verticalpodautoscaler_status_recommendation_containerrecommendations_lowerbound_cpu
- name: "verticalpodautoscaler_status_recommendation_containerrecommendations_lowerbound_cpu"
help: "Minimum cpu resources the container can use before the VerticalPodAutoscaler updater evicts it."
commonLabels:
unit: "core"
resource: "cpu"
each:
type: Gauge
gauge:
path: [status, recommendation, containerRecommendations]
labelsFromPath:
container: [containerName]
valueFrom: [lowerBound, cpu]
# Memory kube_verticalpodautoscaler_status_recommendation_containerrecommendations_upperbound_memory
- name: "verticalpodautoscaler_status_recommendation_containerrecommendations_upperbound_memory"
help: "Maximum memory resources the container can use before the VerticalPodAutoscaler updater evicts it."
commonLabels:
unit: "byte"
resource: "memory"
each:
type: Gauge
gauge:
path: [status, recommendation, containerRecommendations]
labelsFromPath:
container: [containerName]
valueFrom: [upperBound, memory]
# CPU kube_verticalpodautoscaler_status_recommendation_containerrecommendations_upperbound_cpu
- name: "verticalpodautoscaler_status_recommendation_containerrecommendations_upperbound_cpu"
help: "Maximum cpu resources the container can use before the VerticalPodAutoscaler updater evicts it."
commonLabels:
unit: "core"
resource: "cpu"
each:
type: Gauge
gauge:
path: [status, recommendation, containerRecommendations]
labelsFromPath:
container: [containerName]
valueFrom: [upperBound, cpu]
# Memory kube_verticalpodautoscaler_status_recommendation_containerrecommendations_target_memory
- name: "verticalpodautoscaler_status_recommendation_containerrecommendations_target_memory"
help: "Target memory resources the VerticalPodAutoscaler recommends for the container."
commonLabels:
unit: "byte"
resource: "memory"
each:
type: Gauge
gauge:
path: [status, recommendation, containerRecommendations]
labelsFromPath:
container: [containerName]
valueFrom: [target, memory]
# CPU kube_verticalpodautoscaler_status_recommendation_containerrecommendations_target_cpu
- name: "verticalpodautoscaler_status_recommendation_containerrecommendations_target_cpu"
help: "Target cpu resources the VerticalPodAutoscaler recommends for the container."
commonLabels:
unit: "core"
resource: "cpu"
each:
type: Gauge
gauge:
path: [status, recommendation, containerRecommendations]
labelsFromPath:
container: [containerName]
valueFrom: [target, cpu]
# Memory kube_verticalpodautoscaler_status_recommendation_containerrecommendations_uncappedtarget_memory
- name: "verticalpodautoscaler_status_recommendation_containerrecommendations_uncappedtarget_memory"
help: "Target memory resources the VerticalPodAutoscaler recommends for the container ignoring bounds."
commonLabels:
unit: "byte"
resource: "memory"
each:
type: Gauge
gauge:
path: [status, recommendation, containerRecommendations]
labelsFromPath:
container: [containerName]
valueFrom: [uncappedTarget, memory]
# CPU kube_verticalpodautoscaler_status_recommendation_containerrecommendations_uncappedtarget_cpu
- name: "verticalpodautoscaler_status_recommendation_containerrecommendations_uncappedtarget_cpu"
help: "Target memory resources the VerticalPodAutoscaler recommends for the container ignoring bounds."
commonLabels:
unit: "core"
resource: "cpu"
each:
type: Gauge
gauge:
path: [status, recommendation, containerRecommendations]
labelsFromPath:
container: [containerName]
valueFrom: [uncappedTarget, cpu]
```
</details>
### Metric types
The configuration supports three kind of metrics from the [OpenMetrics specification](https://github.com/OpenObservability/OpenMetrics/blob/main/specification/OpenMetrics.md).
The configuration supports three kind of metrics from the [OpenMetrics specification](https://github.com/prometheus/OpenMetrics/blob/v1.0.0/specification/OpenMetrics.md).
The metric type is specified by the `type` field and its specific configuration at the types specific struct.
#### Gauge
> Gauges are current measurements, such as bytes of memory currently used or the number of items in a queue. For gauges the absolute value is what is of interest to a user. [[0]](https://github.com/OpenObservability/OpenMetrics/blob/main/specification/OpenMetrics.md#gauge)
> Gauges are current measurements, such as bytes of memory currently used or the number of items in a queue. For gauges the absolute value is what is of interest to a user. [[0]](https://github.com/prometheus/OpenMetrics/blob/v1.0.0/specification/OpenMetrics.md#gauge)
Example:
@ -331,7 +617,7 @@ Supported types are:
* `nil` is generally mapped to `0.0` if NilIsZero is `true`, otherwise it will throw an error
* for bool `true` is mapped to `1.0` and `false` is mapped to `0.0`
* for string the following logic applies
* `"true"` and `"yes"` are mapped to `1.0` and `"false"` and `"no"` are mapped to `0.0` (all case-insensitive)
* `"true"` and `"yes"` are mapped to `1.0`, `"false"`, `"no"` and `"unknown"` are mapped to `0.0` (all case-insensitive)
* RFC3339 times are parsed to float timestamp
* Quantities like "250m" or "512Gi" are parsed to float using <https://github.com/kubernetes/apimachinery/blob/master/pkg/api/resource/quantity.go>
* Percentages ending with a "%" are parsed to float
@ -380,7 +666,7 @@ kube_customresource_foo_status{customresource_group="myteam.io", customresource_
#### StateSet
> StateSets represent a series of related boolean values, also called a bitset. If ENUMs need to be encoded this MAY be done via StateSet. [[1]](https://github.com/OpenObservability/OpenMetrics/blob/main/specification/OpenMetrics.md#stateset)
> StateSets represent a series of related boolean values, also called a bitset. If ENUMs need to be encoded this MAY be done via StateSet. [[1]](https://github.com/prometheus/OpenMetrics/blob/v1.0.0/specification/OpenMetrics.md#stateset)
```yaml
kind: CustomResourceStateMetrics
@ -414,7 +700,7 @@ kube_customresource_status_phase{customresource_group="myteam.io", customresourc
#### Info
> Info metrics are used to expose textual information which SHOULD NOT change during process lifetime. Common examples are an application's version, revision control commit, and the version of a compiler. [[2]](https://github.com/OpenObservability/OpenMetrics/blob/main/specification/OpenMetrics.md#info)
> Info metrics are used to expose textual information which SHOULD NOT change during process lifetime. Common examples are an application's version, revision control commit, and the version of a compiler. [[2]](https://github.com/prometheus/OpenMetrics/blob/v1.0.0/specification/OpenMetrics.md#info)
Metrics of type `Info` will always have a value of 1.

View File

@ -2,8 +2,8 @@
| Metric name | Metric type | Description | Labels/tags | Status |
| ------------------------------------- | ----------- | ------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------- | ------------ |
| kube_networkpolicy_annotations | Gauge | Kubernetes annotations converted to Prometheus labels controlled via [--metric-annotations-allowlist](./cli-arguments.md) | `namespace`=&lt;namespace name&gt; `networkpolicy`=&lt;networkpolicy name&gt; | EXPERIMENTAL |
| kube_networkpolicy_annotations | Gauge | Kubernetes annotations converted to Prometheus labels controlled via [--metric-annotations-allowlist](../../developer/cli-arguments.md) | `namespace`=&lt;namespace name&gt; `networkpolicy`=&lt;networkpolicy name&gt; | EXPERIMENTAL |
| kube_networkpolicy_created | Gauge | | `namespace`=&lt;namespace name&gt; `networkpolicy`=&lt;networkpolicy name&gt; | EXPERIMENTAL |
| kube_networkpolicy_labels | Gauge | Kubernetes labels converted to Prometheus labels controlled via [--metric-labels-allowlist](./cli-arguments.md) | `namespace`=&lt;namespace name&gt; `networkpolicy`=&lt;networkpolicy name&gt; | EXPERIMENTAL |
| kube_networkpolicy_labels | Gauge | Kubernetes labels converted to Prometheus labels controlled via [--metric-labels-allowlist](../../developer/cli-arguments.md) | `namespace`=&lt;namespace name&gt; `networkpolicy`=&lt;networkpolicy name&gt; | EXPERIMENTAL |
| kube_networkpolicy_spec_egress_rules | Gauge | | `namespace`=&lt;namespace name&gt; `networkpolicy`=&lt;networkpolicy name&gt; | EXPERIMENTAL |
| kube_networkpolicy_spec_ingress_rules | Gauge | | `namespace`=&lt;namespace name&gt; `networkpolicy`=&lt;networkpolicy name&gt; | EXPERIMENTAL |

View File

@ -2,8 +2,8 @@
| Metric name | Metric type | Description | Labels/tags | Status |
| ------------------------------------------------------- | ----------- | ------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------ |
| kube_poddisruptionbudget_annotations | Gauge | Kubernetes annotations converted to Prometheus labels controlled via [--metric-annotations-allowlist](./cli-arguments.md) | `poddisruptionbudget`=&lt;poddisruptionbudget-name&gt; <br> `namespace`=&lt;poddisruptionbudget-namespace&gt; <br> `annotation_PODDISRUPTIONBUDGET_ANNOTATION`=&lt;PODDISRUPTIONBUDGET_ANNOATION&gt; | EXPERIMENTAL |
| kube_poddisruptionbudget_labels | Gauge | Kubernetes labels converted to Prometheus labels controlled via [--metric-labels-allowlist](./cli-arguments.md) | `poddisruptionbudget`=&lt;poddisruptionbudget-name&gt; <br> `namespace`=&lt;poddisruptionbudget-namespace&gt; <br> `label_PODDISRUPTIONBUDGET_LABEL`=&lt;PODDISRUPTIONBUDGET_ANNOATION&gt; | EXPERIMENTAL |
| kube_poddisruptionbudget_annotations | Gauge | Kubernetes annotations converted to Prometheus labels controlled via [--metric-annotations-allowlist](../../developer/cli-arguments.md) | `poddisruptionbudget`=&lt;poddisruptionbudget-name&gt; <br> `namespace`=&lt;poddisruptionbudget-namespace&gt; <br> `annotation_PODDISRUPTIONBUDGET_ANNOTATION`=&lt;PODDISRUPTIONBUDGET_ANNOATION&gt; | EXPERIMENTAL |
| kube_poddisruptionbudget_labels | Gauge | Kubernetes labels converted to Prometheus labels controlled via [--metric-labels-allowlist](../../developer/cli-arguments.md) | `poddisruptionbudget`=&lt;poddisruptionbudget-name&gt; <br> `namespace`=&lt;poddisruptionbudget-namespace&gt; <br> `label_PODDISRUPTIONBUDGET_LABEL`=&lt;PODDISRUPTIONBUDGET_ANNOATION&gt; | EXPERIMENTAL |
| kube_poddisruptionbudget_created | Gauge | | `poddisruptionbudget`=&lt;pdb-name&gt; <br> `namespace`=&lt;pdb-namespace&gt; | STABLE |
| kube_poddisruptionbudget_status_current_healthy | Gauge | | `poddisruptionbudget`=&lt;pdb-name&gt; <br> `namespace`=&lt;pdb-namespace&gt; | STABLE |
| kube_poddisruptionbudget_status_desired_healthy | Gauge | | `poddisruptionbudget`=&lt;pdb-name&gt; <br> `namespace`=&lt;pdb-namespace&gt; | STABLE |

View File

@ -4,5 +4,5 @@
| ------------------------------ | ----------- | ------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------- | ------------ |
| kube_resourcequota | Gauge | | `resourcequota`=&lt;quota-name&gt; <br> `namespace`=&lt;namespace&gt; <br> `resource`=&lt;ResourceName&gt; <br> `type`=&lt;quota-type&gt; | STABLE |
| kube_resourcequota_created | Gauge | | `resourcequota`=&lt;quota-name&gt; <br> `namespace`=&lt;namespace&gt; | STABLE |
| kube_resourcequota_annotations | Gauge | Kubernetes annotations converted to Prometheus labels controlled via [--metric-annotations-allowlist](./cli-arguments.md) | `resourcequota`=&lt;quota-name&gt; <br> `namespace`=&lt;namespace&gt; <br> `annotation_RESOURCE_QUOTA_ANNOTATION`=&lt;RESOURCE_QUOTA_ANNOTATION&gt; | EXPERIMENTAL |
| kube_resourcequota_labels | Gauge | Kubernetes labels converted to Prometheus labels controlled via [--metric-labels-allowlist](./cli-arguments.md) | `resourcequota`=&lt;quota-name&gt; <br> `namespace`=&lt;namespace&gt; <br> `label_RESOURCE_QUOTA_LABEL`=&lt;RESOURCE_QUOTA_LABEL&gt; | EXPERIMENTAL |
| kube_resourcequota_annotations | Gauge | Kubernetes annotations converted to Prometheus labels controlled via [--metric-annotations-allowlist](../../developer/cli-arguments.md) | `resourcequota`=&lt;quota-name&gt; <br> `namespace`=&lt;namespace&gt; <br> `annotation_RESOURCE_QUOTA_ANNOTATION`=&lt;RESOURCE_QUOTA_ANNOTATION&gt; | EXPERIMENTAL |
| kube_resourcequota_labels | Gauge | Kubernetes labels converted to Prometheus labels controlled via [--metric-labels-allowlist](../../developer/cli-arguments.md) | `resourcequota`=&lt;quota-name&gt; <br> `namespace`=&lt;namespace&gt; <br> `label_RESOURCE_QUOTA_LABEL`=&lt;RESOURCE_QUOTA_LABEL&gt; | EXPERIMENTAL |

View File

@ -2,11 +2,9 @@
| Metric name | Metric type | Description | Labels/tags | Status |
| ------------------------------- | ----------- | ------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------ |
| kube_endpoint_annotations | Gauge | Kubernetes annotations converted to Prometheus labels controlled via [--metric-annotations-allowlist](./cli-arguments.md) | `endpoint`=&lt;endpoint-name&gt; <br> `namespace`=&lt;endpoint-namespace&gt; <br> `annotation_ENDPOINT_ANNOTATION`=&lt;ENDPOINT_ANNOTATION&gt; | EXPERIMENTAL |
| kube_endpoint_address_not_ready | Gauge | | `endpoint`=&lt;endpoint-name&gt; <br> `namespace`=&lt;endpoint-namespace&gt; | DEPRECATED |
| kube_endpoint_address_available | Gauge | | `endpoint`=&lt;endpoint-name&gt; <br> `namespace`=&lt;endpoint-namespace&gt; | DEPRECATED |
| kube_endpoint_annotations | Gauge | Kubernetes annotations converted to Prometheus labels controlled via [--metric-annotations-allowlist](../../developer/cli-arguments.md) | `endpoint`=&lt;endpoint-name&gt; <br> `namespace`=&lt;endpoint-namespace&gt; <br> `annotation_ENDPOINT_ANNOTATION`=&lt;ENDPOINT_ANNOTATION&gt; | EXPERIMENTAL |
| kube_endpoint_info | Gauge | | `endpoint`=&lt;endpoint-name&gt; <br> `namespace`=&lt;endpoint-namespace&gt; | STABLE |
| kube_endpoint_labels | Gauge | Kubernetes labels converted to Prometheus labels controlled via [--metric-labels-allowlist](./cli-arguments.md) | `endpoint`=&lt;endpoint-name&gt; <br> `namespace`=&lt;endpoint-namespace&gt; <br> `label_ENDPOINT_LABEL`=&lt;ENDPOINT_LABEL&gt; | STABLE |
| kube_endpoint_labels | Gauge | Kubernetes labels converted to Prometheus labels controlled via [--metric-labels-allowlist](../../developer/cli-arguments.md) | `endpoint`=&lt;endpoint-name&gt; <br> `namespace`=&lt;endpoint-namespace&gt; <br> `label_ENDPOINT_LABEL`=&lt;ENDPOINT_LABEL&gt; | STABLE |
| kube_endpoint_created | Gauge | | `endpoint`=&lt;endpoint-name&gt; <br> `namespace`=&lt;endpoint-namespace&gt; | STABLE |
| kube_endpoint_ports | Gauge | | `endpoint`=&lt;endpoint-name&gt; <br> `namespace`=&lt;endpoint-namespace&gt; <br> `port_name`=&lt;endpoint-port-name&gt; <br> `port_protocol`=&lt;endpoint-port-protocol&gt; <br> `port_number`=&lt;endpoint-port-number&gt; | STABLE |
| kube_endpoint_address | Gauge | | `endpoint`=&lt;endpoint-name&gt; <br> `namespace`=&lt;endpoint-namespace&gt; <br> `ip`=&lt;endpoint-ip&gt; <br> `ready`=&lt;true if available, false if unavailalbe&gt; | STABLE |
| kube_endpoint_ports | Gauge | | `endpoint`=&lt;endpoint-name&gt; <br> `namespace`=&lt;endpoint-namespace&gt; <br> `port_name`=&lt;endpoint-port-name&gt; <br> `port_protocol`=&lt;endpoint-port-protocol&gt; <br> `port_number`=&lt;endpoint-port-number&gt; | STABLE (Deprecated from 2.14.0) |
| kube_endpoint_address | Gauge | | `endpoint`=&lt;endpoint-name&gt; <br> `namespace`=&lt;endpoint-namespace&gt; <br> `ip`=&lt;endpoint-ip&gt; <br> `port_name`=&lt;endpoint-port-name&gt; <br> `port_protocol`=&lt;endpoint-port-protocol&gt; <br> `port_number`=&lt;endpoint-port-number&gt;`ready`=&lt;true if available, false if unavailalbe&gt; | STABLE |

View File

@ -2,10 +2,10 @@
| Metric name | Metric type | Description | Labels/tags | Status |
| ------------------------------ | ----------- | ------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------ |
| kube_endpointslice_annotations | Gauge | Kubernetes annotations converted to Prometheus labels controlled via [--metric-annotations-allowlist](./cli-arguments.md) | `endpointslice`=&lt;endpointslice-name&gt; <br> `namespace`=&lt;endpointslice-namespace&gt; <br> `annotation_ENDPOINTSLICE_ANNOTATION`=&lt;ENDPOINTSLICE_ANNOTATION&gt; | EXPERIMENTAL |
| kube_endpointslice_annotations | Gauge | Kubernetes annotations converted to Prometheus labels controlled via [--metric-annotations-allowlist](../../developer/cli-arguments.md) | `endpointslice`=&lt;endpointslice-name&gt; <br> `namespace`=&lt;endpointslice-namespace&gt; <br> `annotation_ENDPOINTSLICE_ANNOTATION`=&lt;ENDPOINTSLICE_ANNOTATION&gt; | EXPERIMENTAL |
| kube_endpointslice_info | Gauge | | `endpointslice`=&lt;endpointslice-name&gt; <br> `namespace`=&lt;endpointslice-namespace&gt; | EXPERIMENTAL |
| kube_endpointslice_ports | Gauge | | `endpointslice`=&lt;endpointslice-name&gt; <br> `namespace`=&lt;endpointslice-namespace&gt; <br> `port_name`=&lt;endpointslice-port-name&gt; <br> `port_protocol`=&lt;endpointslice-port-protocol&gt; <br> `port_number`=&lt;endpointslice-port-number&gt; | EXPERIMENTAL |
| kube_endpointslice_endpoints | Gauge | | `endpointslice`=&lt;endpointslice-name&gt; <br> `namespace`=&lt;endpointslice-namespace&gt; <br> `ready`=&lt;endpointslice-ready&gt; <br> `serving`=&lt;endpointslice-serving&gt; <br> `terminating`=&lt;endpointslice-terminating&gt; <br> `hostname`=&lt;endpointslice-hostname&gt; <br> `targetref_kind`=&lt;endpointslice-targetref-kind&gt; <br> `targetref_name`=&lt;endpointslice-targetref-name&gt; <br> `targetref_namespace`=&lt;endpointslice-targetref-namespace&gt; <br> `nodename`=&lt;endpointslice-nodename&gt; <br> `endpoint_zone`=&lt;endpointslice-zone&gt; | EXPERIMENTAL |
| kube_endpointslice_endpoints_hints | Gauge | Each line is a hint applied to an endpoint-slice | `endpointslice`=&lt;endpointslice-name&gt; <br> `namespace`=&lt;endpointslice-namespace&gt; <br> `address`=&lt;endpointslice-address[0]&gt; <br> `for_zone`=&lt;endpointslice-hint&gt; | EXPERIMENTAL |
| kube_endpointslice_labels | Gauge | Kubernetes labels converted to Prometheus labels controlled via [--metric-labels-allowlist](./cli-arguments.md) | `endpointslice`=&lt;endpointslice-name&gt; <br> `namespace`=&lt;endpointslice-namespace&gt; <br> `label_ENDPOINTSLICE_LABEL`=&lt;ENDPOINTSLICE_LABEL&gt; | EXPERIMENTAL |
| kube_endpointslice_labels | Gauge | Kubernetes labels converted to Prometheus labels controlled via [--metric-labels-allowlist](../../developer/cli-arguments.md) | `endpointslice`=&lt;endpointslice-name&gt; <br> `namespace`=&lt;endpointslice-namespace&gt; <br> `label_ENDPOINTSLICE_LABEL`=&lt;ENDPOINTSLICE_LABEL&gt; | EXPERIMENTAL |
| kube_endpointslice_created | Gauge | | `endpointslice`=&lt;endpointslice-name&gt; <br> `namespace`=&lt;endpointslice-namespace&gt; | EXPERIMENTAL |

View File

@ -1,11 +1,11 @@
# Ingress Metrics
| Metric name | Metric type | Description | Labels/tags | Status |
| -------------------------------------- | ----------- | ------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------ |
| kube_ingress_annotations | Gauge | Kubernetes annotations converted to Prometheus labels controlled via [--metric-annotations-allowlist](./cli-arguments.md) | `ingress`=&lt;ingress-name&gt; <br> `namespace`=&lt;ingress-namespace&gt; <br> `annotation_INGRESS_ANNOTATION`=&lt;ANNOTATION_LABEL&gt; | EXPERIMENTAL |
| kube_ingress_info | Gauge | | `ingress`=&lt;ingress-name&gt; <br> `namespace`=&lt;ingress-namespace&gt; <br> `ingressclass`=&lt;ingress-class&gt; or `_default` if not set | STABLE |
| kube_ingress_labels | Gauge | Kubernetes labels converted to Prometheus labels controlled via [--metric-labels-allowlist](./cli-arguments.md) | `ingress`=&lt;ingress-name&gt; <br> `namespace`=&lt;ingress-namespace&gt; <br> `label_INGRESS_LABEL`=&lt;INGRESS_LABEL&gt; | STABLE |
| kube_ingress_created | Gauge | | `ingress`=&lt;ingress-name&gt; <br> `namespace`=&lt;ingress-namespace&gt; | STABLE |
| kube_ingress_metadata_resource_version | Gauge | | `ingress`=&lt;ingress-name&gt; <br> `namespace`=&lt;ingress-namespace&gt; | EXPERIMENTAL |
| kube_ingress_path | Gauge | | `ingress`=&lt;ingress-name&gt; <br> `namespace`=&lt;ingress-namespace&gt; <br> `host`=&lt;ingress-host&gt; <br> `path`=&lt;ingress-path&gt; <br><i> If path served by Service Backend</i> <br> `service_name`=&lt;service name for the path&gt; <br> `service_port`=&lt;service port for the path&gt;<br><i> If path served by Resource Backend</i><br> `resource_api_group`=&lt;resource backend api group&gt; <br> `resource_kind`=&lt;resource backend kind&gt; <br> `resource_name`=&lt;resource backend name&gt; | STABLE |
| kube_ingress_tls | Gauge | | `ingress`=&lt;ingress-name&gt; <br> `namespace`=&lt;ingress-namespace&gt; <br> `tls_host`=&lt;tls hostname&gt; <br> `secret`=&lt;tls secret name&gt; | STABLE |
| Metric name | Metric type | Description | Labels/tags | Status |
| -------------------------------------- | ----------- | ------------------------------------------------------------------------------------------------------------------------- |------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| ------------ |
| kube_ingress_annotations | Gauge | Kubernetes annotations converted to Prometheus labels controlled via [--metric-annotations-allowlist](../../developer/cli-arguments.md) | `ingress`=&lt;ingress-name&gt; <br> `namespace`=&lt;ingress-namespace&gt; <br> `annotation_INGRESS_ANNOTATION`=&lt;ANNOTATION_LABEL&gt; | EXPERIMENTAL |
| kube_ingress_info | Gauge | | `ingress`=&lt;ingress-name&gt; <br> `namespace`=&lt;ingress-namespace&gt; <br> `ingressclass`=&lt;ingress-class&gt; or `_default` if not set | STABLE |
| kube_ingress_labels | Gauge | Kubernetes labels converted to Prometheus labels controlled via [--metric-labels-allowlist](../../developer/cli-arguments.md) | `ingress`=&lt;ingress-name&gt; <br> `namespace`=&lt;ingress-namespace&gt; <br> `label_INGRESS_LABEL`=&lt;INGRESS_LABEL&gt; | STABLE |
| kube_ingress_created | Gauge | | `ingress`=&lt;ingress-name&gt; <br> `namespace`=&lt;ingress-namespace&gt; | STABLE |
| kube_ingress_metadata_resource_version | Gauge | | `ingress`=&lt;ingress-name&gt; <br> `namespace`=&lt;ingress-namespace&gt; | EXPERIMENTAL |
| kube_ingress_path | Gauge | | `ingress`=&lt;ingress-name&gt; <br> `namespace`=&lt;ingress-namespace&gt; <br> `host`=&lt;ingress-host&gt; <br> `path`=&lt;ingress-path&gt; <br> `path_type`=&lt;ingress-path type&gt; <br> If path served by Service Backend <br> `service_name`=&lt;service name for the path&gt; <br> `service_port`=&lt;service port for the path&gt; <br> If path served by Resource Backend <br> `resource_api_group`=&lt;resource backend api group&gt; <br> `resource_kind`=&lt;resource backend kind&gt; <br> `resource_name`=&lt;resource backend name&gt; | STABLE |
| kube_ingress_tls | Gauge | | `ingress`=&lt;ingress-name&gt; <br> `namespace`=&lt;ingress-namespace&gt; <br> `tls_host`=&lt;tls hostname&gt; <br> `secret`=&lt;tls secret name&gt; | STABLE |

View File

@ -2,7 +2,7 @@
| Metric name | Metric type | Description | Labels/tags | Status |
| ----------------------------- | ----------- | ------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------ | ------------ |
| kube_ingressclass_annotations | Gauge | Kubernetes annotations converted to Prometheus labels controlled via [--metric-annotations-allowlist](./cli-arguments.md) | `ingressclass`=&lt;ingressclass-name&gt; <br> `annotation_INGRESSCLASS_ANNOTATION`=&lt;INGRESSCLASS_ANNOTATION&gt; | EXPERIMENTAL |
| kube_ingressclass_annotations | Gauge | Kubernetes annotations converted to Prometheus labels controlled via [--metric-annotations-allowlist](../../developer/cli-arguments.md) | `ingressclass`=&lt;ingressclass-name&gt; <br> `annotation_INGRESSCLASS_ANNOTATION`=&lt;INGRESSCLASS_ANNOTATION&gt; | EXPERIMENTAL |
| kube_ingressclass_info | Gauge | | `ingressclass`=&lt;ingressclass-name&gt; <br> `controller`=&lt;ingress-controller-name&gt; <br> | EXPERIMENTAL |
| kube_ingressclass_labels | Gauge | Kubernetes labels converted to Prometheus labels controlled via [--metric-labels-allowlist](./cli-arguments.md) | `ingressclass`=&lt;ingressclass-name&gt; <br> `label_INGRESSCLASS_LABEL`=&lt;INGRESSCLASS_LABEL&gt; | EXPERIMENTAL |
| kube_ingressclass_labels | Gauge | Kubernetes labels converted to Prometheus labels controlled via [--metric-labels-allowlist](../../developer/cli-arguments.md) | `ingressclass`=&lt;ingressclass-name&gt; <br> `label_INGRESSCLASS_LABEL`=&lt;INGRESSCLASS_LABEL&gt; | EXPERIMENTAL |
| kube_ingressclass_created | Gauge | | `ingressclass`=&lt;ingressclass-name&gt; | EXPERIMENTAL |

View File

@ -2,9 +2,9 @@
| Metric name | Metric type | Description | Unit (where applicable) | Labels/tags | Status |
| ----------------------------------------- | ----------- | ------------------------------------------------------------------------------------------------------------------------- | ----------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------ |
| kube_service_annotations | Gauge | Kubernetes annotations converted to Prometheus labels controlled via [--metric-annotations-allowlist](./cli-arguments.md) | | `service`=&lt;service-name&gt; <br> `namespace`=&lt;service-namespace&gt; <br> `uid`=&lt;service-uid&gt; <br> `annotation_SERVICE_ANNOTATION`=&lt;SERVICE_ANNOTATION&gt; | EXPERIMENTAL |
| kube_service_info | Gauge | Information about service | | `service`=&lt;service-name&gt; <br> `namespace`=&lt;service-namespace&gt; <br> `uid`=&lt;service-uid&gt; <br> `cluster_ip`=&lt;service cluster ip&gt; <br> `external_name`=&lt;service external name&gt; <br> `load_balancer_ip`=&lt;service load balancer ip&gt; | STABLE |
| kube_service_labels | Gauge | Kubernetes labels converted to Prometheus labels controlled via [--metric-labels-allowlist](./cli-arguments.md) | | `service`=&lt;service-name&gt; <br> `namespace`=&lt;service-namespace&gt; <br> `uid`=&lt;service-uid&gt; <br> `label_SERVICE_LABEL`=&lt;SERVICE_LABEL&gt; | STABLE |
| kube_service_annotations | Gauge | Kubernetes annotations converted to Prometheus labels controlled via [--metric-annotations-allowlist](../../developer/cli-arguments.md) | | `service`=&lt;service-name&gt; <br> `namespace`=&lt;service-namespace&gt; <br> `uid`=&lt;service-uid&gt; <br> `annotation_SERVICE_ANNOTATION`=&lt;SERVICE_ANNOTATION&gt; | EXPERIMENTAL |
| kube_service_info | Gauge | Information about service | | `service`=&lt;service-name&gt; <br> `namespace`=&lt;service-namespace&gt; <br> `uid`=&lt;service-uid&gt; <br> `cluster_ip`=&lt;service cluster ip&gt; <br> `external_name`=&lt;service external name&gt; <br> `external_traffic_policy`=&lt;service external traffic policy&gt; <br> `load_balancer_ip`=&lt;service load balancer ip&gt; | STABLE |
| kube_service_labels | Gauge | Kubernetes labels converted to Prometheus labels controlled via [--metric-labels-allowlist](../../developer/cli-arguments.md) | | `service`=&lt;service-name&gt; <br> `namespace`=&lt;service-namespace&gt; <br> `uid`=&lt;service-uid&gt; <br> `label_SERVICE_LABEL`=&lt;SERVICE_LABEL&gt; | STABLE |
| kube_service_created | Gauge | Unix creation timestamp | seconds | `service`=&lt;service-name&gt; <br> `namespace`=&lt;service-namespace&gt; <br> `uid`=&lt;service-uid&gt; | STABLE |
| kube_service_spec_type | Gauge | Type about service | | `service`=&lt;service-name&gt; <br> `namespace`=&lt;service-namespace&gt; <br> `uid`=&lt;service-uid&gt; <br> `type`=&lt;ClusterIP\|NodePort\|LoadBalancer\|ExternalName&gt; | STABLE |
| kube_service_spec_external_ip | Gauge | Service external ips. One series for each ip | | `service`=&lt;service-name&gt; <br> `namespace`=&lt;service-namespace&gt; <br> `uid`=&lt;service-uid&gt; <br> `external_ip`=&lt;external-ip&gt; | STABLE |

View File

@ -2,8 +2,8 @@
| Metric name | Metric type | Description | Labels/tags | Status |
| ---------------------------------------- | ----------- | ------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------- | ------------ |
| kube_configmap_annotations | Gauge | Kubernetes annotations converted to Prometheus labels controlled via [--metric-annotations-allowlist](./cli-arguments.md) | `configmap`=&lt;configmap-name&gt; <br> `namespace`=&lt;configmap-namespace&gt; <br> `annotation_CONFIGMAP_ANNOTATION`=&lt;CONFIGMAP_ANNOTATION&gt; | EXPERIMENTAL |
| kube_configmap_labels | Gauge | Kubernetes labels converted to Prometheus labels controlled via [--metric-labels-allowlist](./cli-arguments.md) | `configmap`=&lt;configmap-name&gt; <br> `namespace`=&lt;configmap-namespace&gt; <br> `label_CONFIGMAP_LABEL`=&lt;CONFIGMAP_LABEL&gt; | STABLE |
| kube_configmap_annotations | Gauge | Kubernetes annotations converted to Prometheus labels controlled via [--metric-annotations-allowlist](../../developer/cli-arguments.md) | `configmap`=&lt;configmap-name&gt; <br> `namespace`=&lt;configmap-namespace&gt; <br> `annotation_CONFIGMAP_ANNOTATION`=&lt;CONFIGMAP_ANNOTATION&gt; | EXPERIMENTAL |
| kube_configmap_labels | Gauge | Kubernetes labels converted to Prometheus labels controlled via [--metric-labels-allowlist](../../developer/cli-arguments.md) | `configmap`=&lt;configmap-name&gt; <br> `namespace`=&lt;configmap-namespace&gt; <br> `label_CONFIGMAP_LABEL`=&lt;CONFIGMAP_LABEL&gt; | STABLE |
| kube_configmap_info | Gauge | | `configmap`=&lt;configmap-name&gt; <br> `namespace`=&lt;configmap-namespace&gt; | STABLE |
| kube_configmap_created | Gauge | | `configmap`=&lt;configmap-name&gt; <br> `namespace`=&lt;configmap-namespace&gt; | STABLE |
| kube_configmap_metadata_resource_version | Gauge | | `configmap`=&lt;configmap-name&gt; <br> `namespace`=&lt;configmap-namespace&gt; | EXPERIMENTAL |

View File

@ -2,15 +2,16 @@
| Metric name | Metric type | Description | Unit (where applicable) | Labels/tags | Status |
|------------------------------------------|-------------|---------------------------------------------------------------------------------------------------------------------------|-------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|--------------|
| kube_persistentvolume_annotations | Gauge | Kubernetes annotations converted to Prometheus labels controlled via [--metric-annotations-allowlist](./cli-arguments.md) | | `persistentvolume`=&lt;persistentvolume-name&gt; <br> `annotation_PERSISTENTVOLUME_ANNOTATION`=&lt;PERSISTENTVOLUME_ANNOTATION&gt; | EXPERIMENTAL |
| kube_persistentvolume_annotations | Gauge | Kubernetes annotations converted to Prometheus labels controlled via [--metric-annotations-allowlist](../../developer/cli-arguments.md) | | `persistentvolume`=&lt;persistentvolume-name&gt; <br> `annotation_PERSISTENTVOLUME_ANNOTATION`=&lt;PERSISTENTVOLUME_ANNOTATION&gt; | EXPERIMENTAL |
| kube_persistentvolume_capacity_bytes | Gauge | | | `persistentvolume`=&lt;pv-name&gt; | STABLE |
| kube_persistentvolume_status_phase | Gauge | | | `persistentvolume`=&lt;pv-name&gt; <br>`phase`=&lt;Bound\|Failed\|Pending\|Available\|Released&gt; | STABLE |
| kube_persistentvolume_claim_ref | Gauge | | | `persistentvolume`=&lt;pv-name&gt; <br>`claim_namespace`=&lt;<namespace>&gt; <br>`name`=&lt;<name>&gt; | STABLE |
| kube_persistentvolume_labels | Gauge | Kubernetes labels converted to Prometheus labels controlled via [--metric-labels-allowlist](./cli-arguments.md) | | `persistentvolume`=&lt;persistentvolume-name&gt; <br> `label_PERSISTENTVOLUME_LABEL`=&lt;PERSISTENTVOLUME_LABEL&gt; | STABLE |
| kube_persistentvolume_info | Gauge | Information about Persistent Volumes | | `persistentvolume`=&lt;pv-name&gt; <br> `storageclass`=&lt;storageclass-name&gt; <br> `gce_persistent_disk_name`=&lt;pd-name&gt; <br> `host_path`=&lt;path-of-a-host-volume&gt; <br> `host_path_type`=&lt;host-mount-type&gt; <br> `ebs_volume_id`=&lt;ebs-volume-id&gt; <br> `azure_disk_name`=&lt;azure-disk-name&gt; <br> `fc_wwids`=&lt;fc-wwids-comma-separated&gt; <br> `fc_lun`=&lt;fc-lun&gt; <br> `fc_target_wwns`=&lt;fc-target-wwns-comma-separated&gt; <br> `iscsi_target_portal`=&lt;iscsi-target-portal&gt; <br> `iscsi_iqn`=&lt;iscsi-iqn&gt; <br> `iscsi_lun`=&lt;iscsi-lun&gt; <br> `iscsi_initiator_name`=&lt;iscsi-initiator-name&gt; <br> `local_path`=&lt;path-of-a-local-volume&gt; <br> `local_fs`=&lt;local-volume-fs-type&gt; <br> `nfs_server`=&lt;nfs-server&gt; <br> `nfs_path`=&lt;nfs-path&gt; <br> `csi_driver`=&lt;csi-driver&gt; <br> `csi_volume_handle`=&lt;csi-volume-handle&gt; | STABLE |
| kube_persistentvolume_claim_ref | Gauge | | | `persistentvolume`=&lt;pv-name&gt; <br>`claim_namespace`=`<namespace>`; <br>`name`=`<name>`; | STABLE |
| kube_persistentvolume_labels | Gauge | Kubernetes labels converted to Prometheus labels controlled via [--metric-labels-allowlist](../../developer/cli-arguments.md) | | `persistentvolume`=&lt;persistentvolume-name&gt; <br> `label_PERSISTENTVOLUME_LABEL`=&lt;PERSISTENTVOLUME_LABEL&gt; | STABLE |
| kube_persistentvolume_info | Gauge | Information about Persistent Volumes | | `persistentvolume`=&lt;pv-name&gt; <br> `storageclass`=&lt;storageclass-name&gt; <br> `gce_persistent_disk_name`=&lt;pd-name&gt; <br> `host_path`=&lt;path-of-a-host-volume&gt; <br> `host_path_type`=&lt;host-mount-type&gt; <br> `ebs_volume_id`=&lt;ebs-volume-id&gt; <br> `azure_disk_name`=&lt;azure-disk-name&gt; <br> `fc_wwids`=&lt;fc-wwids-comma-separated&gt; <br> `fc_lun`=&lt;fc-lun&gt; <br> `fc_target_wwns`=&lt;fc-target-wwns-comma-separated&gt; <br> `iscsi_target_portal`=&lt;iscsi-target-portal&gt; <br> `iscsi_iqn`=&lt;iscsi-iqn&gt; <br> `iscsi_lun`=&lt;iscsi-lun&gt; <br> `iscsi_initiator_name`=&lt;iscsi-initiator-name&gt; <br> `local_path`=&lt;path-of-a-local-volume&gt; <br> `local_fs`=&lt;local-volume-fs-type&gt; <br> `nfs_server`=&lt;nfs-server&gt; <br> `nfs_path`=&lt;nfs-path&gt; <br> `csi_driver`=&lt;csi-driver&gt; <br> `csi_volume_handle`=&lt;csi-volume-handle&gt; <br> `reclaim_policy`=&lt;reclaim-policy&gt; | STABLE |
| kube_persistentvolume_created | Gauge | Unix creation timestamp | seconds | `persistentvolume`=&lt;persistentvolume-name&gt; <br> | EXPERIMENTAL |
| kube_persistentvolume_deletion_timestamp | Gauge | Unix deletion timestamp | seconds | `persistentvolume`=&lt;persistentvolume-name&gt; <br> | EXPERIMENTAL |
| kube_persistentvolume_csi_attributes | Gauge | CSI attributes of the Persistent Volume, disabled by default, manage with [--metric-opt-in-list](./cli-arguments.md)) | | `persistentvolume`=&lt;persistentvolume-name&gt; <br> `csi_mounter`=&lt;csi-mounter&gt; <br> `csi_map_options`=&lt;csi-map-options&gt; | EXPERIMENTAL |
| kube_persistentvolume_csi_attributes | Gauge | CSI attributes of the Persistent Volume, disabled by default, manage with [--metric-opt-in-list](../../developer/cli-arguments.md)) | | `persistentvolume`=&lt;persistentvolume-name&gt; <br> `csi_mounter`=&lt;csi-mounter&gt; <br> `csi_map_options`=&lt;csi-map-options&gt; | EXPERIMENTAL |
| kube_persistentvolume_volume_mode | Gauge | Volume Mode information for the PersistentVolume. | | `persistentvolume`=&lt;persistentvolume-name&gt; <br>`volumemode`=&lt;volumemode&gt; | EXPERIMENTAL |
## Useful metrics queries

View File

@ -2,10 +2,10 @@
| Metric name | Metric type | Description | Unit (where applicable) | Labels/tags | Status |
| ---------------------------------------------------------- | ----------- | ------------------------------------------------------------------------------------------------------------------------- | ----------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------ |
| kube_persistentvolumeclaim_annotations | Gauge | Kubernetes annotations converted to Prometheus labels controlled via [--metric-annotations-allowlist](./cli-arguments.md) | | `persistentvolumeclaim`=&lt;persistentvolumeclaim-name&gt; <br> `namespace`=&lt;persistentvolumeclaim-namespace&gt; <br> `annotation_PERSISTENTVOLUMECLAIM_ANNOTATION`=&lt;PERSISTENTVOLUMECLAIM_ANNOATION&gt; | EXPERIMENTAL |
| kube_persistentvolumeclaim_annotations | Gauge | Kubernetes annotations converted to Prometheus labels controlled via [--metric-annotations-allowlist](../../developer/cli-arguments.md) | | `persistentvolumeclaim`=&lt;persistentvolumeclaim-name&gt; <br> `namespace`=&lt;persistentvolumeclaim-namespace&gt; <br> `annotation_PERSISTENTVOLUMECLAIM_ANNOTATION`=&lt;PERSISTENTVOLUMECLAIM_ANNOATION&gt; | EXPERIMENTAL |
| kube_persistentvolumeclaim_access_mode | Gauge | | | `access_mode`=&lt;persistentvolumeclaim-access-mode&gt; <br>`namespace`=&lt;persistentvolumeclaim-namespace&gt; <br> `persistentvolumeclaim`=&lt;persistentvolumeclaim-name&gt; | STABLE |
| kube_persistentvolumeclaim_info | Gauge | | | `namespace`=&lt;persistentvolumeclaim-namespace&gt; <br> `persistentvolumeclaim`=&lt;persistentvolumeclaim-name&gt; <br> `storageclass`=&lt;persistentvolumeclaim-storageclassname&gt;<br>`volumename`=&lt;volumename&gt;<br>`volumemode`=&lt;volumemode&gt; | STABLE |
| kube_persistentvolumeclaim_labels | Gauge | Kubernetes labels converted to Prometheus labels controlled via [--metric-labels-allowlist](./cli-arguments.md) | | `persistentvolumeclaim`=&lt;persistentvolumeclaim-name&gt; <br> `namespace`=&lt;persistentvolumeclaim-namespace&gt; <br> `label_PERSISTENTVOLUMECLAIM_LABEL`=&lt;PERSISTENTVOLUMECLAIM_LABEL&gt; | STABLE |
| kube_persistentvolumeclaim_labels | Gauge | Kubernetes labels converted to Prometheus labels controlled via [--metric-labels-allowlist](../../developer/cli-arguments.md) | | `persistentvolumeclaim`=&lt;persistentvolumeclaim-name&gt; <br> `namespace`=&lt;persistentvolumeclaim-namespace&gt; <br> `label_PERSISTENTVOLUMECLAIM_LABEL`=&lt;PERSISTENTVOLUMECLAIM_LABEL&gt; | STABLE |
| kube_persistentvolumeclaim_resource_requests_storage_bytes | Gauge | | | `namespace`=&lt;persistentvolumeclaim-namespace&gt; <br> `persistentvolumeclaim`=&lt;persistentvolumeclaim-name&gt; | STABLE |
| kube_persistentvolumeclaim_status_condition | Gauge | | | `namespace` =&lt;persistentvolumeclaim-namespace&gt; <br> `persistentvolumeclaim`=&lt;persistentvolumeclaim-name&gt; <br> `type`=&lt;persistentvolumeclaim-condition-type&gt; <br> `status`=&lt;true\false\unknown&gt; | EXPERIMENTAL |
| kube_persistentvolumeclaim_status_phase | Gauge | | | `namespace`=&lt;persistentvolumeclaim-namespace&gt; <br> `persistentvolumeclaim`=&lt;persistentvolumeclaim-name&gt; <br> `phase`=&lt;Pending\Bound\Lost&gt; | STABLE |

View File

@ -2,10 +2,10 @@
| Metric name | Metric type | Description | Labels/tags | Status |
| ------------------------------------- | ----------- | ------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------- | ------------ |
| kube_secret_annotations | Gauge | Kubernetes annotations converted to Prometheus labels controlled via [--metric-annotations-allowlist](./cli-arguments.md) | `secret`=&lt;secret-name&gt; <br> `namespace`=&lt;secret-namespace&gt; <br> `annotations_SECRET_ANNOTATION`=&lt;SECRET_ANNOTATION&gt; | EXPERIMENTAL |
| kube_secret_annotations | Gauge | Kubernetes annotations converted to Prometheus labels controlled via [--metric-annotations-allowlist](../../developer/cli-arguments.md) | `secret`=&lt;secret-name&gt; <br> `namespace`=&lt;secret-namespace&gt; <br> `annotations_SECRET_ANNOTATION`=&lt;SECRET_ANNOTATION&gt; | EXPERIMENTAL |
| kube_secret_info | Gauge | | `secret`=&lt;secret-name&gt; <br> `namespace`=&lt;secret-namespace&gt; | STABLE |
| kube_secret_type | Gauge | | `secret`=&lt;secret-name&gt; <br> `namespace`=&lt;secret-namespace&gt; <br> `type`=&lt;secret-type&gt; | STABLE |
| kube_secret_labels | Gauge | Kubernetes labels converted to Prometheus labels controlled via [--metric-labels-allowlist](./cli-arguments.md) | `secret`=&lt;secret-name&gt; <br> `namespace`=&lt;secret-namespace&gt; <br> `label_SECRET_LABEL`=&lt;SECRET_LABEL&gt; | STABLE |
| kube_secret_labels | Gauge | Kubernetes labels converted to Prometheus labels controlled via [--metric-labels-allowlist](../../developer/cli-arguments.md) | `secret`=&lt;secret-name&gt; <br> `namespace`=&lt;secret-namespace&gt; <br> `label_SECRET_LABEL`=&lt;SECRET_LABEL&gt; | STABLE |
| kube_secret_created | Gauge | | `secret`=&lt;secret-name&gt; <br> `namespace`=&lt;secret-namespace&gt; | STABLE |
| kube_secret_metadata_resource_version | Gauge | | `secret`=&lt;secret-name&gt; <br> `namespace`=&lt;secret-namespace&gt; | EXPERIMENTAL |
| kube_secret_owner | Gauge | | `secret`=&lt;secret-name&gt; <br> `namespace`=&lt;secret-namespace&gt; <br> `owner_kind`=&lt;owner kind&gt; <br> `owner_name`=&lt;owner name&gt; <br> `owner_is_controller`=&lt;whether owner is controller&gt; | EXPERIMENTAL |

View File

@ -2,7 +2,7 @@
| Metric name | Metric type | Description | Labels/tags | Status |
| ----------------------------- | ----------- | ------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------ |
| kube_storageclass_annotations | Gauge | Kubernetes annotations converted to Prometheus labels controlled via [--metric-annotations-allowlist](./cli-arguments.md) | `storageclass`=&lt;storageclass-name&gt; <br> `annotation_STORAGECLASS_ANNOTATION`=&lt;STORAGECLASS_ANNOTATION&gt; | EXPERIMENTAL |
| kube_storageclass_annotations | Gauge | Kubernetes annotations converted to Prometheus labels controlled via [--metric-annotations-allowlist](../../developer/cli-arguments.md) | `storageclass`=&lt;storageclass-name&gt; <br> `annotation_STORAGECLASS_ANNOTATION`=&lt;STORAGECLASS_ANNOTATION&gt; | EXPERIMENTAL |
| kube_storageclass_info | Gauge | | `storageclass`=&lt;storageclass-name&gt; <br> `provisioner`=&lt;storageclass-provisioner&gt; <br> `reclaim_policy`=&lt;storageclass-reclaimPolicy&gt; <br> `volume_binding_mode`=&lt;storageclass-volumeBindingMode&gt; | STABLE |
| kube_storageclass_labels | Gauge | Kubernetes labels converted to Prometheus labels controlled via [--metric-labels-allowlist](./cli-arguments.md) | `storageclass`=&lt;storageclass-name&gt; <br> `label_STORAGECLASS_LABEL`=&lt;STORAGECLASS_LABEL&gt; | STABLE |
| kube_storageclass_labels | Gauge | Kubernetes labels converted to Prometheus labels controlled via [--metric-labels-allowlist](../../developer/cli-arguments.md) | `storageclass`=&lt;storageclass-name&gt; <br> `label_STORAGECLASS_LABEL`=&lt;STORAGECLASS_LABEL&gt; | STABLE |
| kube_storageclass_created | Gauge | | `storageclass`=&lt;storageclass-name&gt; | STABLE |

View File

@ -4,7 +4,7 @@
| -------------------------------------------------- | ----------- | --------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------- | ------------ |
| kube_volumeattachment_info | Gauge | | `volumeattachment`=&lt;volumeattachment-name&gt; <br> `attacher`=&lt;attacher-name&gt; <br> `node`=&lt;node-name&gt; | EXPERIMENTAL |
| kube_volumeattachment_created | Gauge | | `volumeattachment`=&lt;volumeattachment-name&gt; | EXPERIMENTAL |
| kube_volumeattachment_labels | Gauge | Kubernetes labels converted to Prometheus labels controlled via [--metric-labels-allowlist](./cli-arguments.md) | `volumeattachment`=&lt;volumeattachment-name&gt; <br> `label_VOLUMEATTACHMENT_LABEL`=&lt;VOLUMEATTACHMENT_LABEL&gt; | EXPERIMENTAL |
| kube_volumeattachment_labels | Gauge | Kubernetes labels converted to Prometheus labels controlled via [--metric-labels-allowlist](../../developer/cli-arguments.md) | `volumeattachment`=&lt;volumeattachment-name&gt; <br> `label_VOLUMEATTACHMENT_LABEL`=&lt;VOLUMEATTACHMENT_LABEL&gt; | EXPERIMENTAL |
| kube_volumeattachment_spec_source_persistentvolume | Gauge | | `volumeattachment`=&lt;volumeattachment-name&gt; <br> `volumename`=&lt;persistentvolume-name&gt; | EXPERIMENTAL |
| kube_volumeattachment_status_attached | Gauge | | `volumeattachment`=&lt;volumeattachment-name&gt; | EXPERIMENTAL |
| kube_volumeattachment_status_attachment_metadata | Gauge | | `volumeattachment`=&lt;volumeattachment-name&gt; <br> `metadata_METADATA_KEY`=&lt;METADATA_VALUE&gt; | EXPERIMENTAL |

View File

@ -2,9 +2,9 @@
| Metric name | Metric type | Description | Labels/tags | Status |
| ---------------------------------------------- | ----------- | ------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------ |
| kube_cronjob_annotations | Gauge | Kubernetes annotations converted to Prometheus labels controlled via [--metric-annotations-allowlist](./cli-arguments.md) | `cronjob`=&lt;cronjob-name&gt; <br> `namespace`=&lt;cronjob-namespace&gt; <br> `annotation_CRONJOB_ANNOTATION`=&lt;CRONJOB_ANNOTATION&gt; | EXPERIMENTAL |
| kube_cronjob_info | Gauge | | `cronjob`=&lt;cronjob-name&gt; <br> `namespace`=&lt;cronjob-namespace&gt; <br> `schedule`=&lt;schedule&gt; <br> `concurrency_policy`=&lt;concurrency-policy&gt; | STABLE |
| kube_cronjob_labels | Gauge | Kubernetes labels converted to Prometheus labels controlled via [--metric-labels-allowlist](./cli-arguments.md) | `cronjob`=&lt;cronjob-name&gt; <br> `namespace`=&lt;cronjob-namespace&gt; <br> `label_CRONJOB_LABEL`=&lt;CRONJOB_LABEL&gt; | STABLE |
| kube_cronjob_annotations | Gauge | Kubernetes annotations converted to Prometheus labels controlled via [--metric-annotations-allowlist](../../developer/cli-arguments.md) | `cronjob`=&lt;cronjob-name&gt; <br> `namespace`=&lt;cronjob-namespace&gt; <br> `annotation_CRONJOB_ANNOTATION`=&lt;CRONJOB_ANNOTATION&gt; | EXPERIMENTAL |
| kube_cronjob_info | Gauge | | `cronjob`=&lt;cronjob-name&gt; <br> `namespace`=&lt;cronjob-namespace&gt; <br> `schedule`=&lt;schedule&gt; <br> `concurrency_policy`=&lt;concurrency-policy&gt; <br> `timezone`=&lt;timezone&gt; | STABLE |
| kube_cronjob_labels | Gauge | Kubernetes labels converted to Prometheus labels controlled via [--metric-labels-allowlist](../../developer/cli-arguments.md) | `cronjob`=&lt;cronjob-name&gt; <br> `namespace`=&lt;cronjob-namespace&gt; <br> `label_CRONJOB_LABEL`=&lt;CRONJOB_LABEL&gt; | STABLE |
| kube_cronjob_created | Gauge | | `cronjob`=&lt;cronjob-name&gt; <br> `namespace`=&lt;cronjob-namespace&gt; | STABLE |
| kube_cronjob_next_schedule_time | Gauge | | `cronjob`=&lt;cronjob-name&gt; <br> `namespace`=&lt;cronjob-namespace&gt; | STABLE |
| kube_cronjob_status_active | Gauge | | `cronjob`=&lt;cronjob-name&gt; <br> `namespace`=&lt;cronjob-namespace&gt; | STABLE |

View File

@ -2,7 +2,7 @@
| Metric name | Metric type | Description | Labels/tags | Status |
| ---------------------------------------------- | ----------- | ------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------- | ------------ |
| kube_daemonset_annotations | Gauge | Kubernetes annotations converted to Prometheus labels controlled via [--metric-annotations-allowlist](./cli-arguments.md) | `daemonset`=&lt;daemonset-name&gt; <br> `namespace`=&lt;daemonset-namespace&gt; <br> `annotation_DAEMONSET_ANNOTATION`=&lt;DAEMONSET_ANNOTATION&gt; | EXPERIMENTAL |
| kube_daemonset_annotations | Gauge | Kubernetes annotations converted to Prometheus labels controlled via [--metric-annotations-allowlist](../../developer/cli-arguments.md) | `daemonset`=&lt;daemonset-name&gt; <br> `namespace`=&lt;daemonset-namespace&gt; <br> `annotation_DAEMONSET_ANNOTATION`=&lt;DAEMONSET_ANNOTATION&gt; | EXPERIMENTAL |
| kube_daemonset_created | Gauge | | `daemonset`=&lt;daemonset-name&gt; <br> `namespace`=&lt;daemonset-namespace&gt; | STABLE |
| kube_daemonset_status_current_number_scheduled | Gauge | | `daemonset`=&lt;daemonset-name&gt; <br> `namespace`=&lt;daemonset-namespace&gt; | STABLE |
| kube_daemonset_status_desired_number_scheduled | Gauge | | `daemonset`=&lt;daemonset-name&gt; <br> `namespace`=&lt;daemonset-namespace&gt; | STABLE |
@ -13,4 +13,4 @@
| kube_daemonset_status_observed_generation | Gauge | | `daemonset`=&lt;daemonset-name&gt; <br> `namespace`=&lt;daemonset-namespace&gt; | STABLE |
| kube_daemonset_status_updated_number_scheduled | Gauge | | `daemonset`=&lt;daemonset-name&gt; <br> `namespace`=&lt;daemonset-namespace&gt; | STABLE |
| kube_daemonset_metadata_generation | Gauge | | `daemonset`=&lt;daemonset-name&gt; <br> `namespace`=&lt;daemonset-namespace&gt; | STABLE |
| kube_daemonset_labels | Gauge | Kubernetes labels converted to Prometheus labels controlled via [--metric-labels-allowlist](./cli-arguments.md) | `daemonset`=&lt;daemonset-name&gt; <br> `namespace`=&lt;daemonset-namespace&gt; <br> `label_DAEMONSET_LABEL`=&lt;DAEMONSET_LABEL&gt; | STABLE |
| kube_daemonset_labels | Gauge | Kubernetes labels converted to Prometheus labels controlled via [--metric-labels-allowlist](../../developer/cli-arguments.md) | `daemonset`=&lt;daemonset-name&gt; <br> `namespace`=&lt;daemonset-namespace&gt; <br> `label_DAEMONSET_LABEL`=&lt;DAEMONSET_LABEL&gt; | STABLE |

View File

@ -2,18 +2,18 @@
| Metric name | Metric type | Description | Labels/tags | Status |
| ----------------------------------------------------------- | ----------- | ------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------ |
| kube_deployment_annotations | Gauge | Kubernetes annotations converted to Prometheus labels controlled via [--metric-annotations-allowlist](./cli-arguments.md) | `deployment`=&lt;deployment-name&gt; <br> `namespace`=&lt;deployment-namespace&gt; <br> `annotation_DEPLOYMENT_ANNOTATION`=&lt;DEPLOYMENT_ANNOTATION&gt; | EXPERIMENTAL |
| kube_deployment_annotations | Gauge | Kubernetes annotations converted to Prometheus labels controlled via [--metric-annotations-allowlist](../../developer/cli-arguments.md) | `deployment`=&lt;deployment-name&gt; <br> `namespace`=&lt;deployment-namespace&gt; <br> `annotation_DEPLOYMENT_ANNOTATION`=&lt;DEPLOYMENT_ANNOTATION&gt; | EXPERIMENTAL |
| kube_deployment_status_replicas | Gauge | | `deployment`=&lt;deployment-name&gt; <br> `namespace`=&lt;deployment-namespace&gt; | STABLE |
| kube_deployment_status_replicas_ready | Gauge | | `deployment`=&lt;deployment-name&gt; <br> `namespace`=&lt;deployment-namespace&gt; | STABLE |
| kube_deployment_status_replicas_available | Gauge | | `deployment`=&lt;deployment-name&gt; <br> `namespace`=&lt;deployment-namespace&gt; | STABLE |
| kube_deployment_status_replicas_unavailable | Gauge | | `deployment`=&lt;deployment-name&gt; <br> `namespace`=&lt;deployment-namespace&gt; | STABLE |
| kube_deployment_status_replicas_updated | Gauge | | `deployment`=&lt;deployment-name&gt; <br> `namespace`=&lt;deployment-namespace&gt; | STABLE |
| kube_deployment_status_observed_generation | Gauge | | `deployment`=&lt;deployment-name&gt; <br> `namespace`=&lt;deployment-namespace&gt; | STABLE |
| kube_deployment_status_condition | Gauge | | `deployment`=&lt;deployment-name&gt; <br> `namespace`=&lt;deployment-namespace&gt; <br> `condition`=&lt;deployment-condition&gt; <br> `status`=&lt;true\|false\|unknown&gt; | STABLE |
| kube_deployment_status_condition | Gauge | | `deployment`=&lt;deployment-name&gt; <br> `namespace`=&lt;deployment-namespace&gt; <br> `reason`=&lt;deployment-transition-reason&gt; <br> `condition`=&lt;deployment-condition&gt; <br> `status`=&lt;true\|false\|unknown&gt; | STABLE |
| kube_deployment_spec_replicas | Gauge | | `deployment`=&lt;deployment-name&gt; <br> `namespace`=&lt;deployment-namespace&gt; | STABLE |
| kube_deployment_spec_paused | Gauge | | `deployment`=&lt;deployment-name&gt; <br> `namespace`=&lt;deployment-namespace&gt; | STABLE |
| kube_deployment_spec_strategy_rollingupdate_max_unavailable | Gauge | | `deployment`=&lt;deployment-name&gt; <br> `namespace`=&lt;deployment-namespace&gt; | STABLE |
| kube_deployment_spec_strategy_rollingupdate_max_surge | Gauge | | `deployment`=&lt;deployment-name&gt; <br> `namespace`=&lt;deployment-namespace&gt; | STABLE |
| kube_deployment_metadata_generation | Gauge | | `deployment`=&lt;deployment-name&gt; <br> `namespace`=&lt;deployment-namespace&gt; | STABLE |
| kube_deployment_labels | Gauge | Kubernetes labels converted to Prometheus labels controlled via [--metric-labels-allowlist](./cli-arguments.md) | `deployment`=&lt;deployment-name&gt; <br> `namespace`=&lt;deployment-namespace&gt; <br> `label_DEPLOYMENT_LABEL`=&lt;DEPLOYMENT_LABEL&gt; | STABLE |
| kube_deployment_labels | Gauge | Kubernetes labels converted to Prometheus labels controlled via [--metric-labels-allowlist](../../developer/cli-arguments.md) | `deployment`=&lt;deployment-name&gt; <br> `namespace`=&lt;deployment-namespace&gt; <br> `label_DEPLOYMENT_LABEL`=&lt;DEPLOYMENT_LABEL&gt; | STABLE |
| kube_deployment_created | Gauge | | `deployment`=&lt;deployment-name&gt; <br> `namespace`=&lt;deployment-namespace&gt; | STABLE |

View File

@ -3,8 +3,8 @@
| Metric name | Metric type | Description | Labels/tags | Status |
| ---------------------------------------------------- | ----------- | ------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------ |
| kube_horizontalpodautoscaler_info | Gauge | | `horizontalpodautoscaler`=&lt;hpa-name&gt; <br> `namespace`=&lt;hpa-namespace&gt; <br> `scaletargetref_api_version`=&lt;hpa-target-api-version&gt; <br> `scaletargetref_kind`=&lt;hpa-target-kind&gt; <br> `scaletargetref_name`=&lt;hpa-target-name&gt; | EXPERIMENTAL |
| kube_horizontalpodautoscaler_annotations | Gauge | Kubernetes annotations converted to Prometheus labels controlled via [--metric-annotations-allowlist](./cli-arguments.md) | `horizontalpodautoscaler`=&lt;hpa-name&gt; <br> `namespace`=&lt;hpa-namespace&gt; | EXPERIMENTAL |
| kube_horizontalpodautoscaler_labels | Gauge | Kubernetes labels converted to Prometheus labels controlled via [--metric-labels-allowlist](./cli-arguments.md) | `horizontalpodautoscaler`=&lt;hpa-name&gt; <br> `namespace`=&lt;hpa-namespace&gt; | STABLE |
| kube_horizontalpodautoscaler_annotations | Gauge | Kubernetes annotations converted to Prometheus labels controlled via [--metric-annotations-allowlist](../../developer/cli-arguments.md) | `horizontalpodautoscaler`=&lt;hpa-name&gt; <br> `namespace`=&lt;hpa-namespace&gt; | EXPERIMENTAL |
| kube_horizontalpodautoscaler_labels | Gauge | Kubernetes labels converted to Prometheus labels controlled via [--metric-labels-allowlist](../../developer/cli-arguments.md) | `horizontalpodautoscaler`=&lt;hpa-name&gt; <br> `namespace`=&lt;hpa-namespace&gt; | STABLE |
| kube_horizontalpodautoscaler_metadata_generation | Gauge | | `horizontalpodautoscaler`=&lt;hpa-name&gt; <br> `namespace`=&lt;hpa-namespace&gt; | STABLE |
| kube_horizontalpodautoscaler_spec_max_replicas | Gauge | | `horizontalpodautoscaler`=&lt;hpa-name&gt; <br> `namespace`=&lt;hpa-namespace&gt; | STABLE |
| kube_horizontalpodautoscaler_spec_min_replicas | Gauge | | `horizontalpodautoscaler`=&lt;hpa-name&gt; <br> `namespace`=&lt;hpa-namespace&gt; | STABLE |

View File

@ -2,9 +2,9 @@
| Metric name | Metric type | Description | Labels/tags | Status |
| ------------------------------------- | ----------- | ------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------ |
| kube_job_annotations | Gauge | Kubernetes annotations converted to Prometheus labels controlled via [--metric-annotations-allowlist](./cli-arguments.md) | `job_name`=&lt;job-name&gt; <br> `namespace`=&lt;job-namespace&gt; <br> `annotation_JOB_ANNOTATION`=&lt;JOB_ANNOTATION&gt; | EXPERIMENTAL |
| kube_job_annotations | Gauge | Kubernetes annotations converted to Prometheus labels controlled via [--metric-annotations-allowlist](../../developer/cli-arguments.md) | `job_name`=&lt;job-name&gt; <br> `namespace`=&lt;job-namespace&gt; <br> `annotation_JOB_ANNOTATION`=&lt;JOB_ANNOTATION&gt; | EXPERIMENTAL |
| kube_job_info | Gauge | | `job_name`=&lt;job-name&gt; <br> `namespace`=&lt;job-namespace&gt; | STABLE |
| kube_job_labels | Gauge | Kubernetes labels converted to Prometheus labels controlled via [--metric-labels-allowlist](./cli-arguments.md) | `job_name`=&lt;job-name&gt; <br> `namespace`=&lt;job-namespace&gt; <br> `label_JOB_LABEL`=&lt;JOB_LABEL&gt; | STABLE |
| kube_job_labels | Gauge | Kubernetes labels converted to Prometheus labels controlled via [--metric-labels-allowlist](../../developer/cli-arguments.md) | `job_name`=&lt;job-name&gt; <br> `namespace`=&lt;job-namespace&gt; <br> `label_JOB_LABEL`=&lt;JOB_LABEL&gt; | STABLE |
| kube_job_owner | Gauge | | `job_name`=&lt;job-name&gt; <br> `namespace`=&lt;job-namespace&gt; <br> `owner_kind`=&lt;owner kind&gt; <br> `owner_name`=&lt;owner name&gt; <br> `owner_is_controller`=&lt;whether owner is controller&gt; | STABLE |
| kube_job_spec_parallelism | Gauge | | `job_name`=&lt;job-name&gt; <br> `namespace`=&lt;job-namespace&gt; | STABLE |
| kube_job_spec_completions | Gauge | | `job_name`=&lt;job-name&gt; <br> `namespace`=&lt;job-namespace&gt; | STABLE |
@ -17,3 +17,4 @@
| kube_job_complete | Gauge | | `job_name`=&lt;job-name&gt; <br> `namespace`=&lt;job-namespace&gt; <br> `condition`=&lt;true\|false\|unknown&gt; | STABLE |
| kube_job_failed | Gauge | | `job_name`=&lt;job-name&gt; <br> `namespace`=&lt;job-namespace&gt; <br> `condition`=&lt;true\|false\|unknown&gt; | STABLE |
| kube_job_created | Gauge | | `job_name`=&lt;job-name&gt; <br> `namespace`=&lt;job-namespace&gt; | STABLE |
| kube_job_status_suspended | Gauge | | `job_name`=&lt;job-name&gt; <br> `namespace`=&lt;job-namespace&gt; | EXPERIMENTAL |

View File

@ -2,13 +2,13 @@
| Metric name | Metric type | Description | Unit (where applicable) | Labels/tags | Status | Opt-in |
| ----------------------------------------------------- | ----------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------ | ------ |
| kube_pod_annotations | Gauge | Kubernetes annotations converted to Prometheus labels controlled via [--metric-annotations-allowlist](./cli-arguments.md) | | `pod`=&lt;pod-name&gt; <br> `namespace`=&lt;pod-namespace&gt; <br> `annotation_POD_ANNOTATION`=&lt;POD_ANNOTATION&gt; <br> `uid`=&lt;pod-uid&gt; | EXPERIMENTAL | - |
| kube_pod_annotations | Gauge | Kubernetes annotations converted to Prometheus labels controlled via [--metric-annotations-allowlist](../../developer/cli-arguments.md) | | `pod`=&lt;pod-name&gt; <br> `namespace`=&lt;pod-namespace&gt; <br> `annotation_POD_ANNOTATION`=&lt;POD_ANNOTATION&gt; <br> `uid`=&lt;pod-uid&gt; | EXPERIMENTAL | - |
| kube_pod_info | Gauge | Information about pod | | `pod`=&lt;pod-name&gt; <br> `namespace`=&lt;pod-namespace&gt; <br> `host_ip`=&lt;host-ip&gt; <br> `pod_ip`=&lt;pod-ip&gt; <br> `node`=&lt;node-name&gt;<br> `created_by_kind`=&lt;created_by_kind&gt;<br> `created_by_name`=&lt;created_by_name&gt;<br> `uid`=&lt;pod-uid&gt;<br> `priority_class`=&lt;priority_class&gt;<br> `host_network`=&lt;host_network&gt; | STABLE | - |
| kube_pod_ips | Gauge | Pod IP addresses | | `pod`=&lt;pod-name&gt; <br> `namespace`=&lt;pod-namespace&gt; <br> `ip`=&lt;pod-ip-address&gt; <br> `ip_family`=&lt;4 OR 6&gt; <br> `uid`=&lt;pod-uid&gt; | EXPERIMENTAL | - |
| kube_pod_start_time | Gauge | Start time in unix timestamp for a pod | seconds | `pod`=&lt;pod-name&gt; <br> `namespace`=&lt;pod-namespace&gt; <br> `uid`=&lt;pod-uid&gt; | STABLE | - |
| kube_pod_completion_time | Gauge | Completion time in unix timestamp for a pod | seconds | `pod`=&lt;pod-name&gt; <br> `namespace`=&lt;pod-namespace&gt; <br> `uid`=&lt;pod-uid&gt; | STABLE | - |
| kube_pod_owner | Gauge | Information about the Pod's owner | | `pod`=&lt;pod-name&gt; <br> `namespace`=&lt;pod-namespace&gt; <br> `owner_kind`=&lt;owner kind&gt; <br> `owner_name`=&lt;owner name&gt; <br> `owner_is_controller`=&lt;whether owner is controller&gt; <br> `uid`=&lt;pod-uid&gt; | STABLE | - |
| kube_pod_labels | Gauge | Kubernetes labels converted to Prometheus labels controlled via [--metric-labels-allowlist](./cli-arguments.md) | | `pod`=&lt;pod-name&gt; <br> `namespace`=&lt;pod-namespace&gt; <br> `label_POD_LABEL`=&lt;POD_LABEL&gt; <br> `uid`=&lt;pod-uid&gt; | STABLE | - |
| kube_pod_labels | Gauge | Kubernetes labels converted to Prometheus labels controlled via [--metric-labels-allowlist](../../developer/cli-arguments.md) | | `pod`=&lt;pod-name&gt; <br> `namespace`=&lt;pod-namespace&gt; <br> `label_POD_LABEL`=&lt;POD_LABEL&gt; <br> `uid`=&lt;pod-uid&gt; | STABLE | - |
| kube_pod_nodeselectors | Gauge | Describes the Pod nodeSelectors | | `pod`=&lt;pod-name&gt; <br> `namespace`=&lt;pod-namespace&gt; <br> `nodeselector_NODE_SELECTOR`=&lt;NODE_SELECTOR&gt; <br> `uid`=&lt;pod-uid&gt; | EXPERIMENTAL | Opt-in |
| kube_pod_status_phase | Gauge | The pods current phase | | `pod`=&lt;pod-name&gt; <br> `namespace`=&lt;pod-namespace&gt; <br> `phase`=&lt;Pending\|Running\|Succeeded\|Failed\|Unknown&gt; <br> `uid`=&lt;pod-uid&gt; | STABLE | - |
| kube_pod_status_qos_class | Gauge | The pods current qosClass | | `pod`=&lt;pod-name&gt; <br> `namespace`=&lt;pod-namespace&gt; <br> `qos_class`=&lt;BestEffort\|Burstable\|Guaranteed&gt; <br> `uid`=&lt;pod-uid&gt; | EXPERIMENTAL | - |
@ -23,10 +23,11 @@
| kube_pod_container_status_terminated_reason | Gauge | Describes the reason the container is currently in terminated state | | `container`=&lt;container-name&gt; <br> `pod`=&lt;pod-name&gt; <br> `namespace`=&lt;pod-namespace&gt; <br> `reason`=&lt;container-terminated-reason&gt; <br> `uid`=&lt;pod-uid&gt; | EXPERIMENTAL | - |
| kube_pod_container_status_last_terminated_reason | Gauge | Describes the last reason the container was in terminated state | | `container`=&lt;container-name&gt; <br> `pod`=&lt;pod-name&gt; <br> `namespace`=&lt;pod-namespace&gt; <br> `reason`=&lt;last-terminated-reason&gt; <br> `uid`=&lt;pod-uid&gt; | EXPERIMENTAL | - |
| kube_pod_container_status_last_terminated_exitcode | Gauge | Describes the exit code for the last container in terminated state. | | `container`=&lt;container-name&gt; <br> `pod`=&lt;pod-name&gt; <br> `namespace`=&lt;pod-namespace&gt; <br> `uid`=&lt;pod-uid&gt; | EXPERIMENTAL | - |
| kube_pod_container_status_last_terminated_timestamp | Gauge | Last terminated time for a pod container in unix timestamp. | | `container`=&lt;container-name&gt; <br> `pod`=&lt;pod-name&gt; <br> `namespace`=&lt;pod-namespace&gt; <br> `uid`=&lt;pod-uid&gt; | EXPERIMENTAL | - |
| kube_pod_container_status_ready | Gauge | Describes whether the containers readiness check succeeded | | `container`=&lt;container-name&gt; <br> `pod`=&lt;pod-name&gt; <br> `namespace`=&lt;pod-namespace&gt; <br> `uid`=&lt;pod-uid&gt; | STABLE | - |
| kube_pod_status_initialized_time | Gauge | Time when the pod is initialized. | seconds | `pod`=&lt;pod-name&gt; <br> `namespace`=&lt;pod-namespace&gt; <br> `uid`=&lt;pod-uid&gt; | EXPERIMENTAL |
| kube_pod_status_ready_time | Gauge | Time when pod passed readiness probes. | seconds | `pod`=&lt;pod-name&gt; <br> `namespace`=&lt;pod-namespace&gt; <br> `uid`=&lt;pod-uid&gt; | EXPERIMENTAL |
| kube_pod_status_container_ready_time | Gauge | Time when the container of the pod entered Ready state. | seconds | `pod`=&lt;pod-name&gt; <br> `namespace`=&lt;pod-namespace&gt; <br> `uid`=&lt;pod-uid&gt; | EXPERIMENTAL |
| kube_pod_status_initialized_time | Gauge | Time when the pod is initialized. | seconds | `pod`=&lt;pod-name&gt; <br> `namespace`=&lt;pod-namespace&gt; <br> `uid`=&lt;pod-uid&gt; | EXPERIMENTAL | - |
| kube_pod_status_ready_time | Gauge | Time when pod passed readiness probes. | seconds | `pod`=&lt;pod-name&gt; <br> `namespace`=&lt;pod-namespace&gt; <br> `uid`=&lt;pod-uid&gt; | EXPERIMENTAL | - |
| kube_pod_status_container_ready_time | Gauge | Time when the container of the pod entered Ready state. | seconds | `pod`=&lt;pod-name&gt; <br> `namespace`=&lt;pod-namespace&gt; <br> `uid`=&lt;pod-uid&gt; | EXPERIMENTAL | - |
| kube_pod_container_status_restarts_total | Counter | The number of container restarts per container | | `container`=&lt;container-name&gt; <br> `namespace`=&lt;pod-namespace&gt; <br> `pod`=&lt;pod-name&gt; <br> `uid`=&lt;pod-uid&gt; | STABLE | - |
| kube_pod_container_resource_requests | Gauge | The number of requested request resource by a container. It is recommended to use the `kube_pod_resource_requests` metric exposed by kube-scheduler instead, as it is more precise. | `cpu`=&lt;core&gt; <br> `memory`=&lt;bytes&gt; | `resource`=&lt;resource-name&gt; <br> `unit`=&lt;resource-unit&gt; <br> `container`=&lt;container-name&gt; <br> `pod`=&lt;pod-name&gt; <br> `namespace`=&lt;pod-namespace&gt; <br> `node`=&lt; node-name&gt; <br> `uid`=&lt;pod-uid&gt; | EXPERIMENTAL | - |
| kube_pod_container_resource_limits | Gauge | The number of requested limit resource by a container. It is recommended to use the `kube_pod_resource_limits` metric exposed by kube-scheduler instead, as it is more precise. | `cpu`=&lt;core&gt; <br> `memory`=&lt;bytes&gt; | `resource`=&lt;resource-name&gt; <br> `unit`=&lt;resource-unit&gt; <br> `container`=&lt;container-name&gt; <br> `pod`=&lt;pod-name&gt; <br> `namespace`=&lt;pod-namespace&gt; <br> `node`=&lt; node-name&gt; <br> `uid`=&lt;pod-uid&gt; | EXPERIMENTAL | - |
@ -52,6 +53,7 @@
| kube_pod_status_reason | Gauge | The pod status reasons | | `pod`=&lt;pod-name&gt; <br> `namespace`=&lt;pod-namespace&gt; <br> `reason`=&lt;Evicted\|NodeAffinity\|NodeLost\|Shutdown\|UnexpectedAdmissionError&gt; <br> `uid`=&lt;pod-uid&gt; | EXPERIMENTAL | - |
| kube_pod_status_scheduled_time | Gauge | Unix timestamp when pod moved into scheduled status | seconds | `pod`=&lt;pod-name&gt; <br> `namespace`=&lt;pod-namespace&gt; <br> `uid`=&lt;pod-uid&gt; | STABLE | - |
| kube_pod_status_unschedulable | Gauge | Describes the unschedulable status for the pod | | `pod`=&lt;pod-name&gt; <br> `namespace`=&lt;pod-namespace&gt; <br> `uid`=&lt;pod-uid&gt; | STABLE | - |
| kube_pod_status_unscheduled_time | Gauge | Unix timestamp when pod moved into unscheduled status | seconds | `pod`=&lt;pod-name&gt; <br> `namespace`=&lt;pod-namespace&gt; <br> `uid`=&lt;pod-uid&gt; | EXPERIMENTAL | - |
| kube_pod_tolerations | Gauge | Information about the pod tolerations | | `pod`=&lt;pod-name&gt; <br> `namespace`=&lt;pod-namespace&gt; <br> `uid`=&lt;pod-uid&gt; <br> `key`=&lt;toleration-key&gt; <br> `operator`=&lt;toleration-operator&gt; <br> `value`=&lt;toleration-value&gt; <br> `effect`=&lt;toleration-effect&gt; `toleration_seconds`=&lt;toleration-seconds&gt; | EXPERIMENTAL | - |
| kube_pod_service_account | Gauge | The service account for a pod | | `pod`=&lt;pod-name&gt; <br> `namespace`=&lt;pod-namespace&gt; <br> `uid`=&lt;pod-uid&gt; <br> `service_account`=&lt;service_account&gt; | EXPERIMENTAL | - |
| kube_pod_scheduler | Gauge | The scheduler for a pod | | `pod`=&lt;pod-name&gt; <br> `namespace`=&lt;pod-namespace&gt; <br> `uid`=&lt;pod-uid&gt; <br> `name`=&lt;scheduler-name&gt; | EXPERIMENTAL | - |

View File

@ -2,13 +2,13 @@
| Metric name | Metric type | Description | Labels/tags | Status |
| --------------------------------------------- | ----------- | ------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------ |
| kube_replicaset_annotations | Gauge | Kubernetes annotations converted to Prometheus labels controlled via [--metric-annotations-allowlist](./cli-arguments.md) | `replicaset`=&lt;replicaset-name&gt; <br> `namespace`=&lt;replicaset-namespace&gt; <br> `annotation_REPLICASET_ANNOTATION`=&lt;REPLICASET_ANNOTATION&gt; | EXPERIMENTAL |
| kube_replicaset_annotations | Gauge | Kubernetes annotations converted to Prometheus labels controlled via [--metric-annotations-allowlist](../../developer/cli-arguments.md) | `replicaset`=&lt;replicaset-name&gt; <br> `namespace`=&lt;replicaset-namespace&gt; <br> `annotation_REPLICASET_ANNOTATION`=&lt;REPLICASET_ANNOTATION&gt; | EXPERIMENTAL |
| kube_replicaset_status_replicas | Gauge | | `replicaset`=&lt;replicaset-name&gt; <br> `namespace`=&lt;replicaset-namespace&gt; | STABLE |
| kube_replicaset_status_fully_labeled_replicas | Gauge | | `replicaset`=&lt;replicaset-name&gt; <br> `namespace`=&lt;replicaset-namespace&gt; | STABLE |
| kube_replicaset_status_ready_replicas | Gauge | | `replicaset`=&lt;replicaset-name&gt; <br> `namespace`=&lt;replicaset-namespace&gt; | STABLE |
| kube_replicaset_status_observed_generation | Gauge | | `replicaset`=&lt;replicaset-name&gt; <br> `namespace`=&lt;replicaset-namespace&gt; | STABLE |
| kube_replicaset_spec_replicas | Gauge | | `replicaset`=&lt;replicaset-name&gt; <br> `namespace`=&lt;replicaset-namespace&gt; | STABLE |
| kube_replicaset_metadata_generation | Gauge | | `replicaset`=&lt;replicaset-name&gt; <br> `namespace`=&lt;replicaset-namespace&gt; | STABLE |
| kube_replicaset_labels | Gauge | Kubernetes labels converted to Prometheus labels controlled via [--metric-labels-allowlist](./cli-arguments.md) | `replicaset`=&lt;replicaset-name&gt; <br> `namespace`=&lt;replicaset-namespace&gt; <br> `label_REPLICASET_LABEL`=&lt;REPLICASET_LABEL&gt; | STABLE |
| kube_replicaset_labels | Gauge | Kubernetes labels converted to Prometheus labels controlled via [--metric-labels-allowlist](../../developer/cli-arguments.md) | `replicaset`=&lt;replicaset-name&gt; <br> `namespace`=&lt;replicaset-namespace&gt; <br> `label_REPLICASET_LABEL`=&lt;REPLICASET_LABEL&gt; | STABLE |
| kube_replicaset_created | Gauge | | `replicaset`=&lt;replicaset-name&gt; <br> `namespace`=&lt;replicaset-namespace&gt; | STABLE |
| kube_replicaset_owner | Gauge | | `replicaset`=&lt;replicaset-name&gt; <br> `namespace`=&lt;replicaset-namespace&gt; <br> `owner_kind`=&lt;owner kind&gt; <br> `owner_name`=&lt;owner name&gt; <br> `owner_is_controller`=&lt;whether owner is controller&gt; | STABLE |

View File

@ -2,7 +2,7 @@
| Metric name | Metric type | Description | Labels/tags | Status |
| ------------------------------------------------------- | ----------- | ------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------ |
| kube_statefulset_annotations | Gauge | Kubernetes annotations converted to Prometheus labels controlled via [--metric-annotations-allowlist](./cli-arguments.md) | `statefulset`=&lt;statefulset-name&gt; <br> `namespace`=&lt;statefulset-namespace&gt; <br> `annotation_STATEFULSET_ANNOTATION`=&lt;STATEFULSET_ANNOTATION&gt; | EXPERIMENTAL |
| kube_statefulset_annotations | Gauge | Kubernetes annotations converted to Prometheus labels controlled via [--metric-annotations-allowlist](../../developer/cli-arguments.md) | `statefulset`=&lt;statefulset-name&gt; <br> `namespace`=&lt;statefulset-namespace&gt; <br> `annotation_STATEFULSET_ANNOTATION`=&lt;STATEFULSET_ANNOTATION&gt; | EXPERIMENTAL |
| kube_statefulset_status_replicas | Gauge | | `statefulset`=&lt;statefulset-name&gt; <br> `namespace`=&lt;statefulset-namespace&gt; | STABLE |
| kube_statefulset_status_replicas_current | Gauge | | `statefulset`=&lt;statefulset-name&gt; <br> `namespace`=&lt;statefulset-namespace&gt; | STABLE |
| kube_statefulset_status_replicas_ready | Gauge | | `statefulset`=&lt;statefulset-name&gt; <br> `namespace`=&lt;statefulset-namespace&gt; | STABLE |
@ -10,10 +10,10 @@
| kube_statefulset_status_replicas_updated | Gauge | | `statefulset`=&lt;statefulset-name&gt; <br> `namespace`=&lt;statefulset-namespace&gt; | STABLE |
| kube_statefulset_status_observed_generation | Gauge | | `statefulset`=&lt;statefulset-name&gt; <br> `namespace`=&lt;statefulset-namespace&gt; | STABLE |
| kube_statefulset_replicas | Gauge | | `statefulset`=&lt;statefulset-name&gt; <br> `namespace`=&lt;statefulset-namespace&gt; | STABLE |
| kube_statefulset_ordinals_start | Gauge | | `statefulset`=&lt;statefulset-name&gt; <br> `namespace`=&lt;statefulset-namespace&gt; | ALPHA |
| kube_statefulset_ordinals_start | Gauge | | `statefulset`=&lt;statefulset-name&gt; <br> `namespace`=&lt;statefulset-namespace&gt; | STABLE |
| kube_statefulset_metadata_generation | Gauge | | `statefulset`=&lt;statefulset-name&gt; <br> `namespace`=&lt;statefulset-namespace&gt; | STABLE |
| kube_statefulset_persistentvolumeclaim_retention_policy | Gauge | | `statefulset`=&lt;statefulset-name&gt; <br> `namespace`=&lt;statefulset-namespace&gt; <br> `when_deleted`=&lt;statefulset-when-deleted-pvc-policy&gt; <br> `when_scaled`=&lt;statefulset-when-scaled-pvc-policy&gt; | EXPERIMENTAL |
| kube_statefulset_created | Gauge | | `statefulset`=&lt;statefulset-name&gt; <br> `namespace`=&lt;statefulset-namespace&gt; | STABLE |
| kube_statefulset_labels | Gauge | Kubernetes labels converted to Prometheus labels controlled via [--metric-labels-allowlist](./cli-arguments.md) | `statefulset`=&lt;statefulset-name&gt; <br> `namespace`=&lt;statefulset-namespace&gt; <br> `label_STATEFULSET_LABEL`=&lt;STATEFULSET_LABEL&gt; | STABLE |
| kube_statefulset_labels | Gauge | Kubernetes labels converted to Prometheus labels controlled via [--metric-labels-allowlist](../../developer/cli-arguments.md) | `statefulset`=&lt;statefulset-name&gt; <br> `namespace`=&lt;statefulset-namespace&gt; <br> `label_STATEFULSET_LABEL`=&lt;STATEFULSET_LABEL&gt; | STABLE |
| kube_statefulset_status_current_revision | Gauge | | `statefulset`=&lt;statefulset-name&gt; <br> `namespace`=&lt;statefulset-namespace&gt; <br> `revision`=&lt;statefulset-current-revision&gt; | STABLE |
| kube_statefulset_status_update_revision | Gauge | | `statefulset`=&lt;statefulset-name&gt; <br> `namespace`=&lt;statefulset-namespace&gt; <br> `revision`=&lt;statefulset-update-revision&gt; | STABLE |

View File

@ -4,7 +4,7 @@ metadata:
labels:
app.kubernetes.io/component: exporter
app.kubernetes.io/name: kube-state-metrics
app.kubernetes.io/version: 2.11.0
app.kubernetes.io/version: 2.16.0
name: kube-state-metrics
roleRef:
apiGroup: rbac.authorization.k8s.io

View File

@ -4,7 +4,7 @@ metadata:
labels:
app.kubernetes.io/component: exporter
app.kubernetes.io/name: kube-state-metrics
app.kubernetes.io/version: 2.11.0
app.kubernetes.io/version: 2.16.0
name: kube-state-metrics
rules:
- apiGroups:

View File

@ -4,7 +4,7 @@ metadata:
labels:
app.kubernetes.io/component: exporter
app.kubernetes.io/name: kube-state-metrics
app.kubernetes.io/version: 2.11.0
app.kubernetes.io/version: 2.16.0
name: kube-state-metrics
namespace: kube-system
roleRef:

View File

@ -4,7 +4,7 @@ metadata:
labels:
app.kubernetes.io/component: exporter
app.kubernetes.io/name: kube-state-metrics
app.kubernetes.io/version: 2.11.0
app.kubernetes.io/version: 2.16.0
name: kube-state-metrics
namespace: kube-system
rules:

View File

@ -5,6 +5,6 @@ metadata:
labels:
app.kubernetes.io/component: exporter
app.kubernetes.io/name: kube-state-metrics
app.kubernetes.io/version: 2.11.0
app.kubernetes.io/version: 2.16.0
name: kube-state-metrics
namespace: kube-system

View File

@ -4,7 +4,7 @@ metadata:
labels:
app.kubernetes.io/component: exporter
app.kubernetes.io/name: kube-state-metrics
app.kubernetes.io/version: 2.11.0
app.kubernetes.io/version: 2.16.0
name: kube-state-metrics
namespace: kube-system
spec:

View File

@ -4,7 +4,7 @@ metadata:
labels:
app.kubernetes.io/component: exporter
app.kubernetes.io/name: kube-state-metrics
app.kubernetes.io/version: 2.11.0
app.kubernetes.io/version: 2.16.0
name: kube-state-metrics
namespace: kube-system
spec:
@ -18,7 +18,7 @@ spec:
labels:
app.kubernetes.io/component: exporter
app.kubernetes.io/name: kube-state-metrics
app.kubernetes.io/version: 2.11.0
app.kubernetes.io/version: 2.16.0
spec:
automountServiceAccountToken: true
containers:
@ -34,11 +34,11 @@ spec:
valueFrom:
fieldRef:
fieldPath: metadata.namespace
image: registry.k8s.io/kube-state-metrics/kube-state-metrics:v2.11.0
image: registry.k8s.io/kube-state-metrics/kube-state-metrics:v2.16.0
livenessProbe:
httpGet:
path: /healthz
port: 8080
path: /livez
port: http-metrics
initialDelaySeconds: 5
timeoutSeconds: 5
name: kube-state-metrics
@ -49,8 +49,8 @@ spec:
name: telemetry
readinessProbe:
httpGet:
path: /
port: 8081
path: /readyz
port: telemetry
initialDelaySeconds: 5
timeoutSeconds: 5
securityContext:

View File

@ -4,7 +4,7 @@ metadata:
labels:
app.kubernetes.io/component: exporter
app.kubernetes.io/name: kube-state-metrics
app.kubernetes.io/version: 2.11.0
app.kubernetes.io/version: 2.16.0
name: kube-state-metrics
roleRef:
apiGroup: rbac.authorization.k8s.io

View File

@ -4,7 +4,7 @@ metadata:
labels:
app.kubernetes.io/component: exporter
app.kubernetes.io/name: kube-state-metrics
app.kubernetes.io/version: 2.11.0
app.kubernetes.io/version: 2.16.0
name: kube-state-metrics
rules:
- apiGroups:

View File

@ -4,7 +4,7 @@ metadata:
labels:
app.kubernetes.io/component: exporter
app.kubernetes.io/name: kube-state-metrics-shard
app.kubernetes.io/version: 2.11.0
app.kubernetes.io/version: 2.16.0
name: kube-state-metrics-shard
namespace: kube-system
spec:

View File

@ -4,7 +4,7 @@ metadata:
labels:
app.kubernetes.io/component: exporter
app.kubernetes.io/name: kube-state-metrics-shard
app.kubernetes.io/version: 2.11.0
app.kubernetes.io/version: 2.16.0
name: kube-state-metrics-shard
namespace: kube-system
spec:
@ -16,7 +16,7 @@ spec:
labels:
app.kubernetes.io/component: exporter
app.kubernetes.io/name: kube-state-metrics-shard
app.kubernetes.io/version: 2.11.0
app.kubernetes.io/version: 2.16.0
spec:
automountServiceAccountToken: true
containers:
@ -29,11 +29,11 @@ spec:
fieldRef:
apiVersion: v1
fieldPath: spec.nodeName
image: registry.k8s.io/kube-state-metrics/kube-state-metrics:v2.11.0
image: registry.k8s.io/kube-state-metrics/kube-state-metrics:v2.16.0
livenessProbe:
httpGet:
path: /healthz
port: 8080
path: /livez
port: http-metrics
initialDelaySeconds: 5
timeoutSeconds: 5
name: kube-state-metrics-shard
@ -44,8 +44,8 @@ spec:
name: telemetry
readinessProbe:
httpGet:
path: /
port: 8081
path: /readyz
port: telemetry
initialDelaySeconds: 5
timeoutSeconds: 5
securityContext:

View File

@ -4,7 +4,7 @@ metadata:
labels:
app.kubernetes.io/component: exporter
app.kubernetes.io/name: kube-state-metrics
app.kubernetes.io/version: 2.11.0
app.kubernetes.io/version: 2.16.0
name: kube-state-metrics
namespace: kube-system
spec:

View File

@ -0,0 +1,20 @@
apiVersion: v1
kind: Service
metadata:
labels:
app.kubernetes.io/component: exporter
app.kubernetes.io/name: kube-state-metrics-unscheduled-pods-fetching
app.kubernetes.io/version: 2.16.0
name: kube-state-metrics-unscheduled-pods-fetching
namespace: kube-system
spec:
clusterIP: None
ports:
- name: http-metrics
port: 8080
targetPort: http-metrics
- name: telemetry
port: 8081
targetPort: telemetry
selector:
app.kubernetes.io/name: kube-state-metrics-unscheduled-pods-fetching

View File

@ -3,35 +3,35 @@ kind: Deployment
metadata:
labels:
app.kubernetes.io/component: exporter
app.kubernetes.io/name: kube-state-metrics-pods
app.kubernetes.io/version: 2.11.0
name: kube-state-metrics-pods
app.kubernetes.io/name: kube-state-metrics-unscheduled-pods-fetching
app.kubernetes.io/version: 2.16.0
name: kube-state-metrics-unscheduled-pods-fetching
namespace: kube-system
spec:
replicas: 1
selector:
matchLabels:
app.kubernetes.io/name: kube-state-metrics
app.kubernetes.io/name: kube-state-metrics-unscheduled-pods-fetching
template:
metadata:
labels:
app.kubernetes.io/component: exporter
app.kubernetes.io/name: kube-state-metrics
app.kubernetes.io/version: 2.11.0
app.kubernetes.io/name: kube-state-metrics-unscheduled-pods-fetching
app.kubernetes.io/version: 2.16.0
spec:
automountServiceAccountToken: true
containers:
- args:
- --resources=pods
- --node=""
image: registry.k8s.io/kube-state-metrics/kube-state-metrics:v2.11.0
- --track-unscheduled-pods
image: registry.k8s.io/kube-state-metrics/kube-state-metrics:v2.16.0
livenessProbe:
httpGet:
path: /healthz
port: 8080
path: /livez
port: http-metrics
initialDelaySeconds: 5
timeoutSeconds: 5
name: kube-state-metrics
name: kube-state-metrics-unscheduled-pods-fetching
ports:
- containerPort: 8080
name: http-metrics
@ -39,8 +39,8 @@ spec:
name: telemetry
readinessProbe:
httpGet:
path: /
port: 8081
path: /readyz
port: telemetry
initialDelaySeconds: 5
timeoutSeconds: 5
securityContext:

View File

@ -4,7 +4,7 @@ metadata:
labels:
app.kubernetes.io/component: exporter
app.kubernetes.io/name: kube-state-metrics
app.kubernetes.io/version: 2.11.0
app.kubernetes.io/version: 2.16.0
name: kube-state-metrics
namespace: kube-system
spec:
@ -17,17 +17,17 @@ spec:
labels:
app.kubernetes.io/component: exporter
app.kubernetes.io/name: kube-state-metrics
app.kubernetes.io/version: 2.11.0
app.kubernetes.io/version: 2.16.0
spec:
automountServiceAccountToken: true
containers:
- args:
- --resources=certificatesigningrequests,configmaps,cronjobs,daemonsets,deployments,endpoints,horizontalpodautoscalers,ingresses,jobs,leases,limitranges,mutatingwebhookconfigurations,namespaces,networkpolicies,nodes,persistentvolumeclaims,persistentvolumes,poddisruptionbudgets,replicasets,replicationcontrollers,resourcequotas,secrets,services,statefulsets,storageclasses,validatingwebhookconfigurations,volumeattachments
image: registry.k8s.io/kube-state-metrics/kube-state-metrics:v2.11.0
image: registry.k8s.io/kube-state-metrics/kube-state-metrics:v2.16.0
livenessProbe:
httpGet:
path: /healthz
port: 8080
path: /livez
port: http-metrics
initialDelaySeconds: 5
timeoutSeconds: 5
name: kube-state-metrics
@ -38,8 +38,8 @@ spec:
name: telemetry
readinessProbe:
httpGet:
path: /
port: 8081
path: /readyz
port: telemetry
initialDelaySeconds: 5
timeoutSeconds: 5
securityContext:

View File

@ -5,6 +5,6 @@ metadata:
labels:
app.kubernetes.io/component: exporter
app.kubernetes.io/name: kube-state-metrics
app.kubernetes.io/version: 2.11.0
app.kubernetes.io/version: 2.16.0
name: kube-state-metrics
namespace: kube-system

View File

@ -4,7 +4,7 @@ metadata:
labels:
app.kubernetes.io/component: exporter
app.kubernetes.io/name: kube-state-metrics
app.kubernetes.io/version: 2.11.0
app.kubernetes.io/version: 2.16.0
name: kube-state-metrics
roleRef:
apiGroup: rbac.authorization.k8s.io

View File

@ -4,7 +4,7 @@ metadata:
labels:
app.kubernetes.io/component: exporter
app.kubernetes.io/name: kube-state-metrics
app.kubernetes.io/version: 2.11.0
app.kubernetes.io/version: 2.16.0
name: kube-state-metrics
rules:
- apiGroups:

View File

@ -4,7 +4,7 @@ metadata:
labels:
app.kubernetes.io/component: exporter
app.kubernetes.io/name: kube-state-metrics
app.kubernetes.io/version: 2.11.0
app.kubernetes.io/version: 2.16.0
name: kube-state-metrics
namespace: kube-system
spec:
@ -17,15 +17,15 @@ spec:
labels:
app.kubernetes.io/component: exporter
app.kubernetes.io/name: kube-state-metrics
app.kubernetes.io/version: 2.11.0
app.kubernetes.io/version: 2.16.0
spec:
automountServiceAccountToken: true
containers:
- image: registry.k8s.io/kube-state-metrics/kube-state-metrics:v2.11.0
- image: registry.k8s.io/kube-state-metrics/kube-state-metrics:v2.16.0
livenessProbe:
httpGet:
path: /healthz
port: 8080
path: /livez
port: http-metrics
initialDelaySeconds: 5
timeoutSeconds: 5
name: kube-state-metrics
@ -36,8 +36,8 @@ spec:
name: telemetry
readinessProbe:
httpGet:
path: /
port: 8081
path: /readyz
port: telemetry
initialDelaySeconds: 5
timeoutSeconds: 5
securityContext:

View File

@ -0,0 +1,10 @@
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
namespace: kube-system
resources:
- cluster-role.yaml
- cluster-role-binding.yaml
- service-account.yaml
- deployment.yaml
- service.yaml

View File

@ -5,6 +5,6 @@ metadata:
labels:
app.kubernetes.io/component: exporter
app.kubernetes.io/name: kube-state-metrics
app.kubernetes.io/version: 2.11.0
app.kubernetes.io/version: 2.16.0
name: kube-state-metrics
namespace: kube-system

View File

@ -4,7 +4,7 @@ metadata:
labels:
app.kubernetes.io/component: exporter
app.kubernetes.io/name: kube-state-metrics
app.kubernetes.io/version: 2.11.0
app.kubernetes.io/version: 2.16.0
name: kube-state-metrics
namespace: kube-system
spec:

287
go.mod
View File

@ -1,91 +1,264 @@
module k8s.io/kube-state-metrics/v2
go 1.19
go 1.24.0
require (
github.com/KimMachineGun/automemlimit v0.7.4
github.com/dgryski/go-jump v0.0.0-20211018200510-ba001c3ffce0
github.com/fsnotify/fsnotify v1.7.0
github.com/gobuffalo/flect v1.0.2
github.com/google/go-cmp v0.6.0
github.com/oklog/run v1.1.0
github.com/prometheus/client_golang v1.18.0
github.com/prometheus/client_model v0.6.0
github.com/prometheus/common v0.47.0
github.com/prometheus/exporter-toolkit v0.11.0
github.com/dlclark/regexp2 v1.11.5
github.com/fsnotify/fsnotify v1.9.0
github.com/go-logr/logr v1.4.3
github.com/gobuffalo/flect v1.0.3
github.com/google/go-cmp v0.7.0
github.com/oklog/run v1.2.0
github.com/prometheus/client_golang v1.23.0
github.com/prometheus/client_model v0.6.2
github.com/prometheus/common v0.65.0
github.com/prometheus/exporter-toolkit v0.14.0
github.com/robfig/cron/v3 v3.0.1
github.com/spf13/cobra v1.8.0
github.com/spf13/viper v1.18.2
github.com/stretchr/testify v1.8.4
gopkg.in/yaml.v3 v3.0.1
k8s.io/api v0.28.4
k8s.io/apimachinery v0.28.4
k8s.io/client-go v0.28.4
k8s.io/component-base v0.28.4
k8s.io/klog/v2 v2.120.1
k8s.io/sample-controller v0.28.4
k8s.io/utils v0.0.0-20230726121419-3b25d923346b
github.com/spf13/cobra v1.9.1
github.com/spf13/viper v1.20.1
github.com/stretchr/testify v1.10.0
k8s.io/api v0.33.3
k8s.io/apimachinery v0.33.3
k8s.io/client-go v0.33.3
k8s.io/component-base v0.33.3
k8s.io/klog/v2 v2.130.1
k8s.io/sample-controller v0.33.3
k8s.io/utils v0.0.0-20250604170112-4c0f3b243397
sigs.k8s.io/controller-runtime v0.21.0
sigs.k8s.io/yaml v1.6.0
)
require (
cel.dev/expr v0.19.1 // indirect
cloud.google.com/go v0.116.0 // indirect
cloud.google.com/go/auth v0.13.0 // indirect
cloud.google.com/go/auth/oauth2adapt v0.2.6 // indirect
cloud.google.com/go/compute/metadata v0.6.0 // indirect
cloud.google.com/go/iam v1.2.2 // indirect
cloud.google.com/go/monitoring v1.21.2 // indirect
cloud.google.com/go/storage v1.49.0 // indirect
cuelang.org/go v0.11.0 // indirect
dario.cat/mergo v1.0.0 // indirect
github.com/Azure/azure-sdk-for-go/sdk/azcore v1.16.0 // indirect
github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.8.0 // indirect
github.com/Azure/azure-sdk-for-go/sdk/internal v1.10.0 // indirect
github.com/Azure/azure-sdk-for-go/sdk/storage/azblob v1.5.0 // indirect
github.com/Azure/go-autorest v14.2.0+incompatible // indirect
github.com/Azure/go-autorest/autorest/to v0.4.0 // indirect
github.com/AzureAD/microsoft-authentication-library-for-go v1.2.2 // indirect
github.com/GoogleCloudPlatform/opentelemetry-operations-go/detectors/gcp v1.25.0 // indirect
github.com/GoogleCloudPlatform/opentelemetry-operations-go/exporter/metric v0.48.1 // indirect
github.com/GoogleCloudPlatform/opentelemetry-operations-go/internal/resourcemapping v0.48.1 // indirect
github.com/Masterminds/goutils v1.1.1 // indirect
github.com/Masterminds/semver/v3 v3.3.1 // indirect
github.com/Microsoft/go-winio v0.6.2 // indirect
github.com/ProtonMail/go-crypto v1.0.0 // indirect
github.com/Shopify/ejson v1.5.3 // indirect
github.com/aclements/go-moremath v0.0.0-20210112150236-f10218a38794 // indirect
github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751 // indirect
github.com/alecthomas/units v0.0.0-20211218093645-b94a6e3cc137 // indirect
github.com/antlr4-go/antlr/v4 v4.13.0 // indirect
github.com/armon/go-metrics v0.4.1 // indirect
github.com/aws/aws-sdk-go v1.55.5 // indirect
github.com/aws/aws-sdk-go-v2 v1.32.6 // indirect
github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.6.7 // indirect
github.com/aws/aws-sdk-go-v2/config v1.28.6 // indirect
github.com/aws/aws-sdk-go-v2/credentials v1.17.47 // indirect
github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.16.21 // indirect
github.com/aws/aws-sdk-go-v2/feature/s3/manager v1.17.10 // indirect
github.com/aws/aws-sdk-go-v2/internal/configsources v1.3.25 // indirect
github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.6.25 // indirect
github.com/aws/aws-sdk-go-v2/internal/ini v1.8.1 // indirect
github.com/aws/aws-sdk-go-v2/internal/v4a v1.3.25 // indirect
github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.12.1 // indirect
github.com/aws/aws-sdk-go-v2/service/internal/checksum v1.4.6 // indirect
github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.12.6 // indirect
github.com/aws/aws-sdk-go-v2/service/internal/s3shared v1.18.6 // indirect
github.com/aws/aws-sdk-go-v2/service/s3 v1.71.0 // indirect
github.com/aws/aws-sdk-go-v2/service/secretsmanager v1.34.7 // indirect
github.com/aws/aws-sdk-go-v2/service/ssm v1.56.1 // indirect
github.com/aws/aws-sdk-go-v2/service/sso v1.24.7 // indirect
github.com/aws/aws-sdk-go-v2/service/ssooidc v1.28.6 // indirect
github.com/aws/aws-sdk-go-v2/service/sts v1.33.2 // indirect
github.com/aws/smithy-go v1.22.1 // indirect
github.com/beorn7/perks v1.0.1 // indirect
github.com/blang/semver/v4 v4.0.0 // indirect
github.com/cespare/xxhash/v2 v2.2.0 // indirect
github.com/brancz/gojsontoyaml v0.1.0 // indirect
github.com/campoy/embedmd v1.0.0 // indirect
github.com/cenkalti/backoff/v4 v4.3.0 // indirect
github.com/census-instrumentation/opencensus-proto v0.4.1 // indirect
github.com/cespare/xxhash/v2 v2.3.0 // indirect
github.com/cloudflare/circl v1.3.9 // indirect
github.com/cncf/xds/go v0.0.0-20240905190251-b4127c9b8d78 // indirect
github.com/cockroachdb/apd/v3 v3.2.1 // indirect
github.com/coreos/go-systemd/v22 v22.5.0 // indirect
github.com/cyphar/filepath-securejoin v0.2.5 // indirect
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect
github.com/emicklei/go-restful/v3 v3.9.0 // indirect
github.com/evanphx/json-patch v5.6.0+incompatible // indirect
github.com/go-kit/log v0.2.1 // indirect
github.com/go-logfmt/logfmt v0.5.1 // indirect
github.com/go-logr/logr v1.4.1 // indirect
github.com/go-openapi/jsonpointer v0.19.6 // indirect
github.com/dustin/gojson v0.0.0-20160307161227-2e71ec9dd5ad // indirect
github.com/elliotchance/orderedmap/v2 v2.2.0 // indirect
github.com/emicklei/go-restful/v3 v3.11.0 // indirect
github.com/emirpasic/gods v1.18.1 // indirect
github.com/envoyproxy/go-control-plane v0.13.1 // indirect
github.com/envoyproxy/protoc-gen-validate v1.1.0 // indirect
github.com/fatih/color v1.17.0 // indirect
github.com/felixge/httpsnoop v1.0.4 // indirect
github.com/fxamacker/cbor/v2 v2.7.0 // indirect
github.com/ghodss/yaml v1.0.0 // indirect
github.com/go-git/gcfg v1.5.1-0.20230307220236-3a3c6141e376 // indirect
github.com/go-git/go-billy/v5 v5.6.0 // indirect
github.com/go-jose/go-jose/v4 v4.0.2 // indirect
github.com/go-logr/stdr v1.2.2 // indirect
github.com/go-openapi/jsonpointer v0.21.0 // indirect
github.com/go-openapi/jsonreference v0.20.2 // indirect
github.com/go-openapi/swag v0.22.3 // indirect
github.com/go-openapi/swag v0.23.0 // indirect
github.com/go-viper/mapstructure/v2 v2.3.0 // indirect
github.com/gogo/protobuf v1.3.2 // indirect
github.com/golang/protobuf v1.5.3 // indirect
github.com/google/gnostic-models v0.6.8 // indirect
github.com/google/gofuzz v1.2.0 // indirect
github.com/google/uuid v1.4.0 // indirect
github.com/golang-jwt/jwt/v5 v5.2.1 // indirect
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect
github.com/google/cel-go v0.23.2 // indirect
github.com/google/gnostic-models v0.6.9 // indirect
github.com/google/go-jsonnet v0.20.0 // indirect
github.com/google/s2a-go v0.1.8 // indirect
github.com/google/uuid v1.6.0 // indirect
github.com/google/wire v0.6.0 // indirect
github.com/googleapis/enterprise-certificate-proxy v0.3.4 // indirect
github.com/googleapis/gax-go/v2 v2.14.1 // indirect
github.com/gosimple/slug v1.14.0 // indirect
github.com/gosimple/unidecode v1.0.1 // indirect
github.com/grpc-ecosystem/grpc-gateway/v2 v2.24.0 // indirect
github.com/hack-pad/hackpadfs v0.2.4 // indirect
github.com/hairyhenderson/go-fsimpl v0.2.1 // indirect
github.com/hairyhenderson/go-git/v5 v5.12.1-0.20240530140403-1b868a7b8a3c // indirect
github.com/hairyhenderson/gomplate/v4 v4.3.0 // indirect
github.com/hairyhenderson/toml v0.4.2-0.20210923231440-40456b8e66cf // indirect
github.com/hairyhenderson/xignore v0.3.3-0.20230403012150-95fe86932830 // indirect
github.com/hairyhenderson/yaml v0.0.0-20220618171115-2d35fca545ce // indirect
github.com/hashicorp/consul/api v1.30.0 // indirect
github.com/hashicorp/errwrap v1.1.0 // indirect
github.com/hashicorp/go-cleanhttp v0.5.2 // indirect
github.com/hashicorp/go-hclog v1.6.3 // indirect
github.com/hashicorp/go-immutable-radix v1.3.1 // indirect
github.com/hashicorp/go-multierror v1.1.1 // indirect
github.com/hashicorp/go-retryablehttp v0.7.7 // indirect
github.com/hashicorp/go-rootcerts v1.0.2 // indirect
github.com/hashicorp/go-secure-stdlib/awsutil v0.3.0 // indirect
github.com/hashicorp/go-secure-stdlib/parseutil v0.1.8 // indirect
github.com/hashicorp/go-secure-stdlib/strutil v0.1.2 // indirect
github.com/hashicorp/go-sockaddr v1.0.7 // indirect
github.com/hashicorp/go-uuid v1.0.3 // indirect
github.com/hashicorp/golang-lru v1.0.2 // indirect
github.com/hashicorp/hcl v1.0.0 // indirect
github.com/imdario/mergo v0.3.6 // indirect
github.com/hashicorp/serf v0.10.1 // indirect
github.com/hashicorp/vault/api v1.15.0 // indirect
github.com/hashicorp/vault/api/auth/approle v0.8.0 // indirect
github.com/hashicorp/vault/api/auth/aws v0.8.0 // indirect
github.com/hashicorp/vault/api/auth/userpass v0.8.0 // indirect
github.com/inconshreveable/mousetrap v1.1.0 // indirect
github.com/itchyny/gojq v0.12.17 // indirect
github.com/itchyny/timefmt-go v0.1.6 // indirect
github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99 // indirect
github.com/jmespath/go-jmespath v0.4.0 // indirect
github.com/joho/godotenv v1.5.1 // indirect
github.com/josharian/intern v1.0.0 // indirect
github.com/jpillora/backoff v1.0.0 // indirect
github.com/json-iterator/go v1.1.12 // indirect
github.com/magiconair/properties v1.8.7 // indirect
github.com/jsonnet-bundler/jsonnet-bundler v0.6.0 // indirect
github.com/kevinburke/ssh_config v1.2.0 // indirect
github.com/kylelemons/godebug v1.1.0 // indirect
github.com/lmittmann/tint v1.0.6 // indirect
github.com/mailru/easyjson v0.7.7 // indirect
github.com/mattn/go-colorable v0.1.13 // indirect
github.com/mattn/go-isatty v0.0.20 // indirect
github.com/mdlayher/socket v0.4.1 // indirect
github.com/mdlayher/vsock v1.2.1 // indirect
github.com/mitchellh/go-homedir v1.1.0 // indirect
github.com/mitchellh/mapstructure v1.5.0 // indirect
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
github.com/modern-go/reflect2 v1.0.2 // indirect
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
github.com/mwitkow/go-conntrack v0.0.0-20190716064945-2f068394615f // indirect
github.com/pelletier/go-toml/v2 v2.1.0 // indirect
github.com/pbnjay/memory v0.0.0-20210728143218-7b4eea64cf58 // indirect
github.com/pelletier/go-toml/v2 v2.2.3 // indirect
github.com/pjbgf/sha1cd v0.3.0 // indirect
github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c // indirect
github.com/pkg/errors v0.9.1 // indirect
github.com/planetscale/vtprotobuf v0.6.1-0.20240319094008-0393e58bdf10 // indirect
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect
github.com/prometheus/procfs v0.12.0 // indirect
github.com/sagikazarmark/locafero v0.4.0 // indirect
github.com/sagikazarmark/slog-shim v0.1.0 // indirect
github.com/prometheus/procfs v0.16.1 // indirect
github.com/ryanuber/go-glob v1.0.0 // indirect
github.com/sagikazarmark/locafero v0.7.0 // indirect
github.com/sergi/go-diff v1.3.2-0.20230802210424-5b0b94c5c0d3 // indirect
github.com/skeema/knownhosts v1.2.2 // indirect
github.com/sourcegraph/conc v0.3.0 // indirect
github.com/spf13/afero v1.11.0 // indirect
github.com/spf13/cast v1.6.0 // indirect
github.com/spf13/pflag v1.0.5 // indirect
github.com/spf13/afero v1.12.0 // indirect
github.com/spf13/cast v1.7.1 // indirect
github.com/spf13/pflag v1.0.6 // indirect
github.com/stoewer/go-strcase v1.3.0 // indirect
github.com/subosito/gotenv v1.6.0 // indirect
github.com/ugorji/go/codec v1.2.12 // indirect
github.com/x448/float16 v0.8.4 // indirect
github.com/xanzy/ssh-agent v0.3.3 // indirect
go.opencensus.io v0.24.0 // indirect
go.opentelemetry.io/auto/sdk v1.1.0 // indirect
go.opentelemetry.io/contrib/detectors/gcp v1.29.0 // indirect
go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.58.0 // indirect
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.58.0 // indirect
go.opentelemetry.io/otel v1.33.0 // indirect
go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.33.0 // indirect
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.33.0 // indirect
go.opentelemetry.io/otel/metric v1.33.0 // indirect
go.opentelemetry.io/otel/sdk v1.33.0 // indirect
go.opentelemetry.io/otel/sdk/metric v1.29.0 // indirect
go.opentelemetry.io/otel/trace v1.33.0 // indirect
go.opentelemetry.io/proto/otlp v1.4.0 // indirect
go.uber.org/multierr v1.11.0 // indirect
golang.org/x/crypto v0.18.0 // indirect
golang.org/x/exp v0.0.0-20230905200255-921286631fa9 // indirect
golang.org/x/net v0.20.0 // indirect
golang.org/x/oauth2 v0.16.0 // indirect
golang.org/x/sync v0.5.0 // indirect
golang.org/x/sys v0.16.0 // indirect
golang.org/x/term v0.16.0 // indirect
golang.org/x/text v0.14.0 // indirect
golang.org/x/time v0.5.0 // indirect
google.golang.org/appengine v1.6.7 // indirect
google.golang.org/protobuf v1.32.0 // indirect
go.yaml.in/yaml/v2 v2.4.2 // indirect
go.yaml.in/yaml/v3 v3.0.3 // indirect
go4.org/intern v0.0.0-20230525184215-6c62f75575cb // indirect
go4.org/netipx v0.0.0-20231129151722-fdeea329fbba // indirect
go4.org/unsafe/assume-no-moving-gc v0.0.0-20231121144256-b99613f794b6 // indirect
gocloud.dev v0.40.0 // indirect
golang.org/x/crypto v0.40.0 // indirect
golang.org/x/exp v0.0.0-20240719175910-8a7402abbf56 // indirect
golang.org/x/mod v0.25.0 // indirect
golang.org/x/net v0.41.0 // indirect
golang.org/x/oauth2 v0.30.0 // indirect
golang.org/x/perf v0.0.0-20250214215153-c95ad7d5b636 // indirect
golang.org/x/sync v0.16.0 // indirect
golang.org/x/sys v0.34.0 // indirect
golang.org/x/term v0.33.0 // indirect
golang.org/x/text v0.27.0 // indirect
golang.org/x/time v0.9.0 // indirect
golang.org/x/xerrors v0.0.0-20240716161551-93cc26a95ae9 // indirect
google.golang.org/api v0.215.0 // indirect
google.golang.org/genproto v0.0.0-20241118233622-e639e219e697 // indirect
google.golang.org/genproto/googleapis/api v0.0.0-20241209162323-e6fa225c2576 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20241223144023-3abc09e42ca8 // indirect
google.golang.org/grpc v1.68.1 // indirect
google.golang.org/grpc/stats/opentelemetry v0.0.0-20240907200651-3ffb98b2c93a // indirect
google.golang.org/protobuf v1.36.6 // indirect
gopkg.in/alecthomas/kingpin.v2 v2.2.6 // indirect
gopkg.in/evanphx/json-patch.v4 v4.12.0 // indirect
gopkg.in/inf.v0 v0.9.1 // indirect
gopkg.in/ini.v1 v1.67.0 // indirect
gopkg.in/warnings.v0 v0.1.2 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
k8s.io/kube-openapi v0.0.0-20230717233707-2695361300d9 // indirect
sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd // indirect
sigs.k8s.io/structured-merge-diff/v4 v4.2.3 // indirect
sigs.k8s.io/yaml v1.3.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
inet.af/netaddr v0.0.0-20230525184311-b8eac61e914a // indirect
k8s.io/apiserver v0.33.0 // indirect
k8s.io/kube-openapi v0.0.0-20250318190949-c8a335a9a2ff // indirect
sigs.k8s.io/apiserver-network-proxy/konnectivity-client v0.31.2 // indirect
sigs.k8s.io/json v0.0.0-20241010143419-9aa6b5e7a4b3 // indirect
sigs.k8s.io/randfill v1.0.0 // indirect
sigs.k8s.io/structured-merge-diff/v4 v4.6.0 // indirect
)
tool (
github.com/brancz/gojsontoyaml
github.com/campoy/embedmd
github.com/google/go-jsonnet/cmd/jsonnet
github.com/hairyhenderson/gomplate/v4/cmd/gomplate
github.com/jsonnet-bundler/jsonnet-bundler/cmd/jb
golang.org/x/perf/cmd/benchstat
)

953
go.sum

File diff suppressed because it is too large Load Diff

View File

@ -64,8 +64,8 @@ func (r *CRDiscoverer) StartDiscovery(ctx context.Context, config *rest.Config)
},
Plural: p,
}
r.AppendToMap(gotGVKP)
r.SafeWrite(func() {
r.AppendToMap(gotGVKP)
r.WasUpdated = true
})
}
@ -89,8 +89,8 @@ func (r *CRDiscoverer) StartDiscovery(ctx context.Context, config *rest.Config)
},
Plural: p,
}
r.RemoveFromMap(gotGVKP)
r.SafeWrite(func() {
r.RemoveFromMap(gotGVKP)
r.WasUpdated = true
})
}
@ -127,23 +127,20 @@ func (r *CRDiscoverer) ResolveGVKToGVKPs(gvk schema.GroupVersionKind) (resolvedG
hasKind := k != "" && k != "*"
// No need to resolve, return.
if hasVersion && hasKind {
var p string
for _, el := range r.Map[g][v] {
if el.Kind == k {
p = el.Plural
break
return []groupVersionKindPlural{
{
GroupVersionKind: schema.GroupVersionKind{
Group: g,
Version: v,
Kind: k,
},
Plural: el.Plural,
},
}, nil
}
}
return []groupVersionKindPlural{
{
GroupVersionKind: schema.GroupVersionKind{
Group: g,
Version: v,
Kind: k,
},
Plural: p,
},
}, nil
}
if hasVersion && !hasKind {
kinds := r.Map[g][v]
@ -203,10 +200,6 @@ func (r *CRDiscoverer) PollForCacheUpdates(
) {
// The interval at which we will check the cache for updates.
t := time.NewTicker(Interval)
// Track previous context to allow refreshing cache.
olderContext, olderCancel := context.WithCancel(ctx)
// Prevent context leak (kill the last metric handler instance).
defer olderCancel()
generateMetrics := func() {
// Get families for discovered factories.
customFactories, err := factoryGenerator()
@ -216,7 +209,16 @@ func (r *CRDiscoverer) PollForCacheUpdates(
// Update the list of enabled custom resources.
var enabledCustomResources []string
for _, factory := range customFactories {
gvrString := util.GVRFromType(factory.Name(), factory.ExpectedType()).String()
gvr, err := util.GVRFromType(factory.Name(), factory.ExpectedType())
if err != nil {
klog.ErrorS(err, "failed to update custom resource stores")
}
var gvrString string
if gvr != nil {
gvrString = gvr.String()
} else {
gvrString = factory.Name()
}
enabledCustomResources = append(enabledCustomResources, gvrString)
}
// Create clients for discovered factories.
@ -239,21 +241,8 @@ func (r *CRDiscoverer) PollForCacheUpdates(
r.SafeWrite(func() {
r.WasUpdated = false
})
// Run the metrics handler with updated configs.
olderContext, olderCancel = context.WithCancel(ctx)
go func() {
// Blocks indefinitely until the unbuffered context is cancelled to serve metrics for that duration.
err = m.Run(olderContext)
if err != nil {
// Check if context was cancelled.
select {
case <-olderContext.Done():
// Context cancelled, don't really need to log this though.
default:
klog.ErrorS(err, "failed to run metrics handler")
}
}
}()
// Update metric handler with the new configs.
m.BuildWriters(ctx)
}
go func() {
for range t.C {
@ -269,7 +258,6 @@ func (r *CRDiscoverer) PollForCacheUpdates(
shouldGenerateMetrics = r.WasUpdated
})
if shouldGenerateMetrics {
olderCancel()
generateMetrics()
klog.InfoS("discovery finished, cache updated")
}

View File

@ -1,14 +1,14 @@
/*
Copyright 2023 The Kubernetes Authors All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
Copyright 2023 The Kubernetes Authors All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package discovery
@ -26,7 +26,6 @@ func TestGVKMapsResolveGVK(t *testing.T) {
desc string
gvkmaps *CRDiscoverer
gvk schema.GroupVersionKind
got []groupVersionKindPlural
want []groupVersionKindPlural
}
testcases := []testcase{
@ -164,6 +163,23 @@ func TestGVKMapsResolveGVK(t *testing.T) {
},
},
},
{
desc: "fixed version and kind, no matching cache entry",
gvkmaps: &CRDiscoverer{
Map: map[string]map[string][]kindPlural{
"testgroup": {
"v1": {
kindPlural{
Kind: "TestObject2",
Plural: "testobjects2",
},
},
},
},
},
gvk: schema.GroupVersionKind{Group: "testgroup", Version: "v1", Kind: "TestObject1"},
want: nil,
},
}
for _, tc := range testcases {
got, err := tc.gvkmaps.ResolveGVKToGVKPs(tc.gvk)

View File

@ -37,18 +37,20 @@ type kindPlural struct {
// CRDiscoverer provides a cache of the collected GVKs, along with helper utilities.
type CRDiscoverer struct {
// m is a mutex to protect the cache.
m sync.RWMutex
// Map is a cache of the collected GVKs.
Map map[string]map[string][]kindPlural
// ShouldUpdate is a flag that indicates whether the cache was updated.
WasUpdated bool
// CRDsAddEventsCounter tracks the number of times that the CRD informer triggered the "add" event.
CRDsAddEventsCounter prometheus.Counter
// CRDsDeleteEventsCounter tracks the number of times that the CRD informer triggered the "remove" event.
CRDsDeleteEventsCounter prometheus.Counter
// CRDsCacheCountGauge tracks the net amount of CRDs affecting the cache at this point.
CRDsCacheCountGauge prometheus.Gauge
// Map is a cache of the collected GVKs.
Map map[string]map[string][]kindPlural
// GVKToReflectorStopChanMap is a map of GVKs to channels that can be used to stop their corresponding reflector.
GVKToReflectorStopChanMap map[string]chan struct{}
// m is a mutex to protect the cache.
m sync.RWMutex
// ShouldUpdate is a flag that indicates whether the cache was updated.
WasUpdated bool
}
// SafeRead executes the given function while holding a read lock.
@ -70,6 +72,9 @@ func (r *CRDiscoverer) AppendToMap(gvkps ...groupVersionKindPlural) {
if r.Map == nil {
r.Map = map[string]map[string][]kindPlural{}
}
if r.GVKToReflectorStopChanMap == nil {
r.GVKToReflectorStopChanMap = map[string]chan struct{}{}
}
for _, gvkp := range gvkps {
if _, ok := r.Map[gvkp.Group]; !ok {
r.Map[gvkp.Group] = map[string][]kindPlural{}
@ -78,6 +83,7 @@ func (r *CRDiscoverer) AppendToMap(gvkps ...groupVersionKindPlural) {
r.Map[gvkp.Group][gvkp.Version] = []kindPlural{}
}
r.Map[gvkp.Group][gvkp.Version] = append(r.Map[gvkp.Group][gvkp.Version], kindPlural{Kind: gvkp.Kind, Plural: gvkp.Plural})
r.GVKToReflectorStopChanMap[gvkp.GroupVersionKind.String()] = make(chan struct{})
}
}
@ -92,6 +98,8 @@ func (r *CRDiscoverer) RemoveFromMap(gvkps ...groupVersionKindPlural) {
}
for i, el := range r.Map[gvkp.Group][gvkp.Version] {
if el.Kind == gvkp.Kind {
close(r.GVKToReflectorStopChanMap[gvkp.GroupVersionKind.String()])
delete(r.GVKToReflectorStopChanMap, gvkp.GroupVersionKind.String())
if len(r.Map[gvkp.Group][gvkp.Version]) == 1 {
delete(r.Map[gvkp.Group], gvkp.Version)
if len(r.Map[gvkp.Group]) == 0 {

View File

@ -20,7 +20,7 @@ import (
"context"
"fmt"
"reflect"
"sort"
"slices"
"strconv"
"strings"
"time"
@ -38,6 +38,7 @@ import (
policyv1 "k8s.io/api/policy/v1"
rbacv1 "k8s.io/api/rbac/v1"
storagev1 "k8s.io/api/storage/v1"
"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
clientset "k8s.io/client-go/kubernetes"
"k8s.io/client-go/tools/cache"
"k8s.io/klog/v2"
@ -65,24 +66,27 @@ var _ ksmtypes.BuilderInterface = &Builder{}
// Builder helps to build store. It follows the builder pattern
// (https://en.wikipedia.org/wiki/Builder_pattern).
type Builder struct {
kubeClient clientset.Interface
customResourceClients map[string]interface{}
namespaces options.NamespaceList
// namespaceFilter is inside fieldSelectorFilter
fieldSelectorFilter string
kubeClient clientset.Interface
ctx context.Context
enabledResources []string
familyGeneratorFilter generator.FamilyGeneratorFilter
customResourceClients map[string]interface{}
listWatchMetrics *watch.ListWatchMetrics
shardingMetrics *sharding.Metrics
shard int32
totalShards int
buildStoresFunc ksmtypes.BuildStoresFunc
buildCustomResourceStoresFunc ksmtypes.BuildCustomResourceStoresFunc
allowAnnotationsList map[string][]string
allowLabelsList map[string][]string
useAPIServerCache bool
utilOptions *options.Options
// namespaceFilter is inside fieldSelectorFilter
fieldSelectorFilter string
namespaces options.NamespaceList
enabledResources []string
totalShards int
shard int32
useAPIServerCache bool
objectLimit int64
GVKToReflectorStopChanMap *map[string]chan struct{}
}
// NewBuilder returns a new builder.
@ -113,12 +117,10 @@ func (b *Builder) WithEnabledResources(r []string) error {
}
}
var sortedResources []string
sortedResources = append(sortedResources, r...)
b.enabledResources = append(b.enabledResources, r...)
slices.Sort(b.enabledResources)
b.enabledResources = slices.Compact(b.enabledResources)
sort.Strings(sortedResources)
b.enabledResources = append(b.enabledResources, sortedResources...)
return nil
}
@ -167,6 +169,12 @@ func (b *Builder) WithUsingAPIServerCache(u bool) {
b.useAPIServerCache = u
}
// WithObjectLimit sets a limit on how many objects you can list from the APIServer.
// This is to protect kube-state-metrics from running out of memory if the APIServer has a lot of objects.
func (b *Builder) WithObjectLimit(l int64) {
b.objectLimit = l
}
// WithFamilyGeneratorFilter configures the family generator filter which decides which
// metrics are to be exposed by the store build by the Builder.
func (b *Builder) WithFamilyGeneratorFilter(l generator.FamilyGeneratorFilter) {
@ -197,7 +205,10 @@ func (b *Builder) DefaultGenerateCustomResourceStoresFunc() ksmtypes.BuildCustom
func (b *Builder) WithCustomResourceStoreFactories(fs ...customresource.RegistryFactory) {
for i := range fs {
f := fs[i]
gvr := util.GVRFromType(f.Name(), f.ExpectedType())
gvr, err := util.GVRFromType(f.Name(), f.ExpectedType())
if err != nil {
klog.ErrorS(err, "Failed to get GVR from type", "resourceName", f.Name(), "expectedType", f.ExpectedType())
}
var gvrString string
if gvr != nil {
gvrString = gvr.String()
@ -214,6 +225,7 @@ func (b *Builder) WithCustomResourceStoreFactories(fs ...customresource.Registry
f.ExpectedType(),
f.ListWatch,
b.useAPIServerCache,
b.objectLimit,
)
}
}
@ -362,150 +374,150 @@ func availableResources() []string {
}
func (b *Builder) buildConfigMapStores() []cache.Store {
return b.buildStoresFunc(configMapMetricFamilies(b.allowAnnotationsList["configmaps"], b.allowLabelsList["configmaps"]), &v1.ConfigMap{}, createConfigMapListWatch, b.useAPIServerCache)
return b.buildStoresFunc(configMapMetricFamilies(b.allowAnnotationsList["configmaps"], b.allowLabelsList["configmaps"]), &v1.ConfigMap{}, createConfigMapListWatch, b.useAPIServerCache, b.objectLimit)
}
func (b *Builder) buildCronJobStores() []cache.Store {
return b.buildStoresFunc(cronJobMetricFamilies(b.allowAnnotationsList["cronjobs"], b.allowLabelsList["cronjobs"]), &batchv1.CronJob{}, createCronJobListWatch, b.useAPIServerCache)
return b.buildStoresFunc(cronJobMetricFamilies(b.allowAnnotationsList["cronjobs"], b.allowLabelsList["cronjobs"]), &batchv1.CronJob{}, createCronJobListWatch, b.useAPIServerCache, b.objectLimit)
}
func (b *Builder) buildDaemonSetStores() []cache.Store {
return b.buildStoresFunc(daemonSetMetricFamilies(b.allowAnnotationsList["daemonsets"], b.allowLabelsList["daemonsets"]), &appsv1.DaemonSet{}, createDaemonSetListWatch, b.useAPIServerCache)
return b.buildStoresFunc(daemonSetMetricFamilies(b.allowAnnotationsList["daemonsets"], b.allowLabelsList["daemonsets"]), &appsv1.DaemonSet{}, createDaemonSetListWatch, b.useAPIServerCache, b.objectLimit)
}
func (b *Builder) buildDeploymentStores() []cache.Store {
return b.buildStoresFunc(deploymentMetricFamilies(b.allowAnnotationsList["deployments"], b.allowLabelsList["deployments"]), &appsv1.Deployment{}, createDeploymentListWatch, b.useAPIServerCache)
return b.buildStoresFunc(deploymentMetricFamilies(b.allowAnnotationsList["deployments"], b.allowLabelsList["deployments"]), &appsv1.Deployment{}, createDeploymentListWatch, b.useAPIServerCache, b.objectLimit)
}
func (b *Builder) buildEndpointsStores() []cache.Store {
return b.buildStoresFunc(endpointMetricFamilies(b.allowAnnotationsList["endpoints"], b.allowLabelsList["endpoints"]), &v1.Endpoints{}, createEndpointsListWatch, b.useAPIServerCache)
return b.buildStoresFunc(endpointMetricFamilies(b.allowAnnotationsList["endpoints"], b.allowLabelsList["endpoints"]), &v1.Endpoints{}, createEndpointsListWatch, b.useAPIServerCache, b.objectLimit)
}
func (b *Builder) buildEndpointSlicesStores() []cache.Store {
return b.buildStoresFunc(endpointSliceMetricFamilies(b.allowAnnotationsList["endpointslices"], b.allowLabelsList["endpointslices"]), &discoveryv1.EndpointSlice{}, createEndpointSliceListWatch, b.useAPIServerCache)
return b.buildStoresFunc(endpointSliceMetricFamilies(b.allowAnnotationsList["endpointslices"], b.allowLabelsList["endpointslices"]), &discoveryv1.EndpointSlice{}, createEndpointSliceListWatch, b.useAPIServerCache, b.objectLimit)
}
func (b *Builder) buildHPAStores() []cache.Store {
return b.buildStoresFunc(hpaMetricFamilies(b.allowAnnotationsList["horizontalpodautoscalers"], b.allowLabelsList["horizontalpodautoscalers"]), &autoscaling.HorizontalPodAutoscaler{}, createHPAListWatch, b.useAPIServerCache)
return b.buildStoresFunc(hpaMetricFamilies(b.allowAnnotationsList["horizontalpodautoscalers"], b.allowLabelsList["horizontalpodautoscalers"]), &autoscaling.HorizontalPodAutoscaler{}, createHPAListWatch, b.useAPIServerCache, b.objectLimit)
}
func (b *Builder) buildIngressStores() []cache.Store {
return b.buildStoresFunc(ingressMetricFamilies(b.allowAnnotationsList["ingresses"], b.allowLabelsList["ingresses"]), &networkingv1.Ingress{}, createIngressListWatch, b.useAPIServerCache)
return b.buildStoresFunc(ingressMetricFamilies(b.allowAnnotationsList["ingresses"], b.allowLabelsList["ingresses"]), &networkingv1.Ingress{}, createIngressListWatch, b.useAPIServerCache, b.objectLimit)
}
func (b *Builder) buildJobStores() []cache.Store {
return b.buildStoresFunc(jobMetricFamilies(b.allowAnnotationsList["jobs"], b.allowLabelsList["jobs"]), &batchv1.Job{}, createJobListWatch, b.useAPIServerCache)
return b.buildStoresFunc(jobMetricFamilies(b.allowAnnotationsList["jobs"], b.allowLabelsList["jobs"]), &batchv1.Job{}, createJobListWatch, b.useAPIServerCache, b.objectLimit)
}
func (b *Builder) buildLimitRangeStores() []cache.Store {
return b.buildStoresFunc(limitRangeMetricFamilies, &v1.LimitRange{}, createLimitRangeListWatch, b.useAPIServerCache)
return b.buildStoresFunc(limitRangeMetricFamilies, &v1.LimitRange{}, createLimitRangeListWatch, b.useAPIServerCache, b.objectLimit)
}
func (b *Builder) buildMutatingWebhookConfigurationStores() []cache.Store {
return b.buildStoresFunc(mutatingWebhookConfigurationMetricFamilies, &admissionregistrationv1.MutatingWebhookConfiguration{}, createMutatingWebhookConfigurationListWatch, b.useAPIServerCache)
return b.buildStoresFunc(mutatingWebhookConfigurationMetricFamilies, &admissionregistrationv1.MutatingWebhookConfiguration{}, createMutatingWebhookConfigurationListWatch, b.useAPIServerCache, b.objectLimit)
}
func (b *Builder) buildNamespaceStores() []cache.Store {
return b.buildStoresFunc(namespaceMetricFamilies(b.allowAnnotationsList["namespaces"], b.allowLabelsList["namespaces"]), &v1.Namespace{}, createNamespaceListWatch, b.useAPIServerCache)
return b.buildStoresFunc(namespaceMetricFamilies(b.allowAnnotationsList["namespaces"], b.allowLabelsList["namespaces"]), &v1.Namespace{}, createNamespaceListWatch, b.useAPIServerCache, b.objectLimit)
}
func (b *Builder) buildNetworkPolicyStores() []cache.Store {
return b.buildStoresFunc(networkPolicyMetricFamilies(b.allowAnnotationsList["networkpolicies"], b.allowLabelsList["networkpolicies"]), &networkingv1.NetworkPolicy{}, createNetworkPolicyListWatch, b.useAPIServerCache)
return b.buildStoresFunc(networkPolicyMetricFamilies(b.allowAnnotationsList["networkpolicies"], b.allowLabelsList["networkpolicies"]), &networkingv1.NetworkPolicy{}, createNetworkPolicyListWatch, b.useAPIServerCache, b.objectLimit)
}
func (b *Builder) buildNodeStores() []cache.Store {
return b.buildStoresFunc(nodeMetricFamilies(b.allowAnnotationsList["nodes"], b.allowLabelsList["nodes"]), &v1.Node{}, createNodeListWatch, b.useAPIServerCache)
return b.buildStoresFunc(nodeMetricFamilies(b.allowAnnotationsList["nodes"], b.allowLabelsList["nodes"]), &v1.Node{}, createNodeListWatch, b.useAPIServerCache, b.objectLimit)
}
func (b *Builder) buildPersistentVolumeClaimStores() []cache.Store {
return b.buildStoresFunc(persistentVolumeClaimMetricFamilies(b.allowAnnotationsList["persistentvolumeclaims"], b.allowLabelsList["persistentvolumeclaims"]), &v1.PersistentVolumeClaim{}, createPersistentVolumeClaimListWatch, b.useAPIServerCache)
return b.buildStoresFunc(persistentVolumeClaimMetricFamilies(b.allowAnnotationsList["persistentvolumeclaims"], b.allowLabelsList["persistentvolumeclaims"]), &v1.PersistentVolumeClaim{}, createPersistentVolumeClaimListWatch, b.useAPIServerCache, b.objectLimit)
}
func (b *Builder) buildPersistentVolumeStores() []cache.Store {
return b.buildStoresFunc(persistentVolumeMetricFamilies(b.allowAnnotationsList["persistentvolumes"], b.allowLabelsList["persistentvolumes"]), &v1.PersistentVolume{}, createPersistentVolumeListWatch, b.useAPIServerCache)
return b.buildStoresFunc(persistentVolumeMetricFamilies(b.allowAnnotationsList["persistentvolumes"], b.allowLabelsList["persistentvolumes"]), &v1.PersistentVolume{}, createPersistentVolumeListWatch, b.useAPIServerCache, b.objectLimit)
}
func (b *Builder) buildPodDisruptionBudgetStores() []cache.Store {
return b.buildStoresFunc(podDisruptionBudgetMetricFamilies(b.allowAnnotationsList["poddisruptionbudgets"], b.allowLabelsList["poddisruptionbudgets"]), &policyv1.PodDisruptionBudget{}, createPodDisruptionBudgetListWatch, b.useAPIServerCache)
return b.buildStoresFunc(podDisruptionBudgetMetricFamilies(b.allowAnnotationsList["poddisruptionbudgets"], b.allowLabelsList["poddisruptionbudgets"]), &policyv1.PodDisruptionBudget{}, createPodDisruptionBudgetListWatch, b.useAPIServerCache, b.objectLimit)
}
func (b *Builder) buildReplicaSetStores() []cache.Store {
return b.buildStoresFunc(replicaSetMetricFamilies(b.allowAnnotationsList["replicasets"], b.allowLabelsList["replicasets"]), &appsv1.ReplicaSet{}, createReplicaSetListWatch, b.useAPIServerCache)
return b.buildStoresFunc(replicaSetMetricFamilies(b.allowAnnotationsList["replicasets"], b.allowLabelsList["replicasets"]), &appsv1.ReplicaSet{}, createReplicaSetListWatch, b.useAPIServerCache, b.objectLimit)
}
func (b *Builder) buildReplicationControllerStores() []cache.Store {
return b.buildStoresFunc(replicationControllerMetricFamilies, &v1.ReplicationController{}, createReplicationControllerListWatch, b.useAPIServerCache)
return b.buildStoresFunc(replicationControllerMetricFamilies, &v1.ReplicationController{}, createReplicationControllerListWatch, b.useAPIServerCache, b.objectLimit)
}
func (b *Builder) buildResourceQuotaStores() []cache.Store {
return b.buildStoresFunc(resourceQuotaMetricFamilies(b.allowAnnotationsList["resourcequotas"], b.allowLabelsList["resourcequotas"]), &v1.ResourceQuota{}, createResourceQuotaListWatch, b.useAPIServerCache)
return b.buildStoresFunc(resourceQuotaMetricFamilies(b.allowAnnotationsList["resourcequotas"], b.allowLabelsList["resourcequotas"]), &v1.ResourceQuota{}, createResourceQuotaListWatch, b.useAPIServerCache, b.objectLimit)
}
func (b *Builder) buildSecretStores() []cache.Store {
return b.buildStoresFunc(secretMetricFamilies(b.allowAnnotationsList["secrets"], b.allowLabelsList["secrets"]), &v1.Secret{}, createSecretListWatch, b.useAPIServerCache)
return b.buildStoresFunc(secretMetricFamilies(b.allowAnnotationsList["secrets"], b.allowLabelsList["secrets"]), &v1.Secret{}, createSecretListWatch, b.useAPIServerCache, b.objectLimit)
}
func (b *Builder) buildServiceAccountStores() []cache.Store {
return b.buildStoresFunc(serviceAccountMetricFamilies(b.allowAnnotationsList["serviceaccounts"], b.allowLabelsList["serviceaccounts"]), &v1.ServiceAccount{}, createServiceAccountListWatch, b.useAPIServerCache)
return b.buildStoresFunc(serviceAccountMetricFamilies(b.allowAnnotationsList["serviceaccounts"], b.allowLabelsList["serviceaccounts"]), &v1.ServiceAccount{}, createServiceAccountListWatch, b.useAPIServerCache, b.objectLimit)
}
func (b *Builder) buildServiceStores() []cache.Store {
return b.buildStoresFunc(serviceMetricFamilies(b.allowAnnotationsList["services"], b.allowLabelsList["services"]), &v1.Service{}, createServiceListWatch, b.useAPIServerCache)
return b.buildStoresFunc(serviceMetricFamilies(b.allowAnnotationsList["services"], b.allowLabelsList["services"]), &v1.Service{}, createServiceListWatch, b.useAPIServerCache, b.objectLimit)
}
func (b *Builder) buildStatefulSetStores() []cache.Store {
return b.buildStoresFunc(statefulSetMetricFamilies(b.allowAnnotationsList["statefulsets"], b.allowLabelsList["statefulsets"]), &appsv1.StatefulSet{}, createStatefulSetListWatch, b.useAPIServerCache)
return b.buildStoresFunc(statefulSetMetricFamilies(b.allowAnnotationsList["statefulsets"], b.allowLabelsList["statefulsets"]), &appsv1.StatefulSet{}, createStatefulSetListWatch, b.useAPIServerCache, b.objectLimit)
}
func (b *Builder) buildStorageClassStores() []cache.Store {
return b.buildStoresFunc(storageClassMetricFamilies(b.allowAnnotationsList["storageclasses"], b.allowLabelsList["storageclasses"]), &storagev1.StorageClass{}, createStorageClassListWatch, b.useAPIServerCache)
return b.buildStoresFunc(storageClassMetricFamilies(b.allowAnnotationsList["storageclasses"], b.allowLabelsList["storageclasses"]), &storagev1.StorageClass{}, createStorageClassListWatch, b.useAPIServerCache, b.objectLimit)
}
func (b *Builder) buildPodStores() []cache.Store {
return b.buildStoresFunc(podMetricFamilies(b.allowAnnotationsList["pods"], b.allowLabelsList["pods"]), &v1.Pod{}, createPodListWatch, b.useAPIServerCache)
return b.buildStoresFunc(podMetricFamilies(b.allowAnnotationsList["pods"], b.allowLabelsList["pods"]), &v1.Pod{}, createPodListWatch, b.useAPIServerCache, b.objectLimit)
}
func (b *Builder) buildCsrStores() []cache.Store {
return b.buildStoresFunc(csrMetricFamilies(b.allowAnnotationsList["certificatesigningrequests"], b.allowLabelsList["certificatesigningrequests"]), &certv1.CertificateSigningRequest{}, createCSRListWatch, b.useAPIServerCache)
return b.buildStoresFunc(csrMetricFamilies(b.allowAnnotationsList["certificatesigningrequests"], b.allowLabelsList["certificatesigningrequests"]), &certv1.CertificateSigningRequest{}, createCSRListWatch, b.useAPIServerCache, b.objectLimit)
}
func (b *Builder) buildValidatingWebhookConfigurationStores() []cache.Store {
return b.buildStoresFunc(validatingWebhookConfigurationMetricFamilies, &admissionregistrationv1.ValidatingWebhookConfiguration{}, createValidatingWebhookConfigurationListWatch, b.useAPIServerCache)
return b.buildStoresFunc(validatingWebhookConfigurationMetricFamilies, &admissionregistrationv1.ValidatingWebhookConfiguration{}, createValidatingWebhookConfigurationListWatch, b.useAPIServerCache, b.objectLimit)
}
func (b *Builder) buildVolumeAttachmentStores() []cache.Store {
return b.buildStoresFunc(volumeAttachmentMetricFamilies, &storagev1.VolumeAttachment{}, createVolumeAttachmentListWatch, b.useAPIServerCache)
return b.buildStoresFunc(volumeAttachmentMetricFamilies, &storagev1.VolumeAttachment{}, createVolumeAttachmentListWatch, b.useAPIServerCache, b.objectLimit)
}
func (b *Builder) buildLeasesStores() []cache.Store {
return b.buildStoresFunc(leaseMetricFamilies, &coordinationv1.Lease{}, createLeaseListWatch, b.useAPIServerCache)
return b.buildStoresFunc(leaseMetricFamilies, &coordinationv1.Lease{}, createLeaseListWatch, b.useAPIServerCache, b.objectLimit)
}
func (b *Builder) buildClusterRoleStores() []cache.Store {
return b.buildStoresFunc(clusterRoleMetricFamilies(b.allowAnnotationsList["clusterroles"], b.allowLabelsList["clusterroles"]), &rbacv1.ClusterRole{}, createClusterRoleListWatch, b.useAPIServerCache)
return b.buildStoresFunc(clusterRoleMetricFamilies(b.allowAnnotationsList["clusterroles"], b.allowLabelsList["clusterroles"]), &rbacv1.ClusterRole{}, createClusterRoleListWatch, b.useAPIServerCache, b.objectLimit)
}
func (b *Builder) buildRoleStores() []cache.Store {
return b.buildStoresFunc(roleMetricFamilies(b.allowAnnotationsList["roles"], b.allowLabelsList["roles"]), &rbacv1.Role{}, createRoleListWatch, b.useAPIServerCache)
return b.buildStoresFunc(roleMetricFamilies(b.allowAnnotationsList["roles"], b.allowLabelsList["roles"]), &rbacv1.Role{}, createRoleListWatch, b.useAPIServerCache, b.objectLimit)
}
func (b *Builder) buildClusterRoleBindingStores() []cache.Store {
return b.buildStoresFunc(clusterRoleBindingMetricFamilies(b.allowAnnotationsList["clusterrolebindings"], b.allowLabelsList["clusterrolebindings"]), &rbacv1.ClusterRoleBinding{}, createClusterRoleBindingListWatch, b.useAPIServerCache)
return b.buildStoresFunc(clusterRoleBindingMetricFamilies(b.allowAnnotationsList["clusterrolebindings"], b.allowLabelsList["clusterrolebindings"]), &rbacv1.ClusterRoleBinding{}, createClusterRoleBindingListWatch, b.useAPIServerCache, b.objectLimit)
}
func (b *Builder) buildRoleBindingStores() []cache.Store {
return b.buildStoresFunc(roleBindingMetricFamilies(b.allowAnnotationsList["rolebindings"], b.allowLabelsList["rolebindings"]), &rbacv1.RoleBinding{}, createRoleBindingListWatch, b.useAPIServerCache)
return b.buildStoresFunc(roleBindingMetricFamilies(b.allowAnnotationsList["rolebindings"], b.allowLabelsList["rolebindings"]), &rbacv1.RoleBinding{}, createRoleBindingListWatch, b.useAPIServerCache, b.objectLimit)
}
func (b *Builder) buildIngressClassStores() []cache.Store {
return b.buildStoresFunc(ingressClassMetricFamilies(b.allowAnnotationsList["ingressclasses"], b.allowLabelsList["ingressclasses"]), &networkingv1.IngressClass{}, createIngressClassListWatch, b.useAPIServerCache)
return b.buildStoresFunc(ingressClassMetricFamilies(b.allowAnnotationsList["ingressclasses"], b.allowLabelsList["ingressclasses"]), &networkingv1.IngressClass{}, createIngressClassListWatch, b.useAPIServerCache, b.objectLimit)
}
func (b *Builder) buildStores(
metricFamilies []generator.FamilyGenerator,
expectedType interface{},
listWatchFunc func(kubeClient clientset.Interface, ns string, fieldSelector string) cache.ListerWatcher,
useAPIServerCache bool,
useAPIServerCache bool, objectLimit int64,
) []cache.Store {
metricFamilies = generator.FilterFamilyGenerators(b.familyGeneratorFilter, metricFamilies)
composedMetricGenFuncs := generator.ComposeMetricGenFuncs(metricFamilies)
@ -520,7 +532,7 @@ func (b *Builder) buildStores(
klog.InfoS("FieldSelector is used", "fieldSelector", b.fieldSelectorFilter)
}
listWatcher := listWatchFunc(b.kubeClient, v1.NamespaceAll, b.fieldSelectorFilter)
b.startReflector(expectedType, store, listWatcher, useAPIServerCache)
b.startReflector(expectedType, store, listWatcher, useAPIServerCache, objectLimit)
return []cache.Store{store}
}
@ -534,7 +546,7 @@ func (b *Builder) buildStores(
klog.InfoS("FieldSelector is used", "fieldSelector", b.fieldSelectorFilter)
}
listWatcher := listWatchFunc(b.kubeClient, ns, b.fieldSelectorFilter)
b.startReflector(expectedType, store, listWatcher, useAPIServerCache)
b.startReflector(expectedType, store, listWatcher, useAPIServerCache, objectLimit)
stores = append(stores, store)
}
@ -546,14 +558,17 @@ func (b *Builder) buildCustomResourceStores(resourceName string,
metricFamilies []generator.FamilyGenerator,
expectedType interface{},
listWatchFunc func(customResourceClient interface{}, ns string, fieldSelector string) cache.ListerWatcher,
useAPIServerCache bool,
useAPIServerCache bool, objectLimit int64,
) []cache.Store {
metricFamilies = generator.FilterFamilyGenerators(b.familyGeneratorFilter, metricFamilies)
composedMetricGenFuncs := generator.ComposeMetricGenFuncs(metricFamilies)
familyHeaders := generator.ExtractMetricFamilyHeaders(metricFamilies)
gvr := util.GVRFromType(resourceName, expectedType)
gvr, err := util.GVRFromType(resourceName, expectedType)
if err != nil {
klog.ErrorS(err, "Failed to get GVR from type", "resourceName", resourceName, "expectedType", expectedType)
}
var gvrString string
if gvr != nil {
gvrString = gvr.String()
@ -575,7 +590,7 @@ func (b *Builder) buildCustomResourceStores(resourceName string,
klog.InfoS("FieldSelector is used", "fieldSelector", b.fieldSelectorFilter)
}
listWatcher := listWatchFunc(customResourceClient, v1.NamespaceAll, b.fieldSelectorFilter)
b.startReflector(expectedType, store, listWatcher, useAPIServerCache)
b.startReflector(expectedType, store, listWatcher, useAPIServerCache, objectLimit)
return []cache.Store{store}
}
@ -587,7 +602,7 @@ func (b *Builder) buildCustomResourceStores(resourceName string,
)
klog.InfoS("FieldSelector is used", "fieldSelector", b.fieldSelectorFilter)
listWatcher := listWatchFunc(customResourceClient, ns, b.fieldSelectorFilter)
b.startReflector(expectedType, store, listWatcher, useAPIServerCache)
b.startReflector(expectedType, store, listWatcher, useAPIServerCache, objectLimit)
stores = append(stores, store)
}
@ -601,10 +616,15 @@ func (b *Builder) startReflector(
store cache.Store,
listWatcher cache.ListerWatcher,
useAPIServerCache bool,
objectLimit int64,
) {
instrumentedListWatch := watch.NewInstrumentedListerWatcher(listWatcher, b.listWatchMetrics, reflect.TypeOf(expectedType).String(), useAPIServerCache)
reflector := cache.NewReflector(sharding.NewShardedListWatch(b.shard, b.totalShards, instrumentedListWatch), expectedType, store, 0)
go reflector.Run(b.ctx.Done())
instrumentedListWatch := watch.NewInstrumentedListerWatcher(listWatcher, b.listWatchMetrics, reflect.TypeOf(expectedType).String(), useAPIServerCache, objectLimit)
reflector := cache.NewReflectorWithOptions(sharding.NewShardedListWatch(b.shard, b.totalShards, instrumentedListWatch), expectedType, store, cache.ReflectorOptions{ResyncPeriod: 0})
if cr, ok := expectedType.(*unstructured.Unstructured); ok {
go reflector.Run((*b.GVKToReflectorStopChanMap)[cr.GroupVersionKind().String()])
} else {
go reflector.Run(b.ctx.Done())
}
}
// cacheStoresToMetricStores converts []cache.Store into []*metricsstore.MetricsStore

View File

@ -18,6 +18,7 @@ package store
import (
"reflect"
"slices"
"testing"
"k8s.io/kube-state-metrics/v2/pkg/options"
@ -196,3 +197,64 @@ func TestWithAllowAnnotations(t *testing.T) {
}
}
}
func TestWithEnabledResources(t *testing.T) {
tests := []struct {
Desc string
EnabledResources []string
Wanted []string
err expectedError
}{
{
Desc: "sorts enabled resources",
EnabledResources: []string{"pods", "cronjobs", "deployments"},
Wanted: []string{
"cronjobs",
"deployments",
"pods",
},
},
{
Desc: "de-duplicates enabled resources",
EnabledResources: []string{"pods", "cronjobs", "deployments", "pods"},
Wanted: []string{
"cronjobs",
"deployments",
"pods",
},
},
{
Desc: "error if not exist",
EnabledResources: []string{"pods", "cronjobs", "deployments", "foo"},
Wanted: []string{},
err: expectedError{
expectedResourceError: true,
},
},
}
for _, test := range tests {
b := NewBuilder()
// Set the enabled resources.
err := b.WithEnabledResources(test.EnabledResources)
if test.err.expectedResourceError {
if err == nil {
t.Log("Did not expect error while setting resources (--resources).")
t.Fatalf("Test error for Desc: %s. Got Error: %v", test.Desc, err)
} else {
return
}
}
if err != nil {
t.Log("...")
t.Fatal("...", test.Desc, err)
}
// Evaluate.
if !slices.Equal(b.enabledResources, test.Wanted) {
t.Log("Expected enabled resources to be equal.")
t.Errorf("Test error for Desc: %s\n Want: \n%+v\n Got: \n%#+v", test.Desc, test.Wanted, b.enabledResources)
}
}
}

View File

@ -91,7 +91,7 @@ func clusterRoleMetricFamilies(allowAnnotationsList, allowLabelsList []string) [
metric.Gauge,
basemetrics.ALPHA,
"",
wrapClusterRoleFunc(func(r *rbacv1.ClusterRole) *metric.Family {
wrapClusterRoleFunc(func(_ *rbacv1.ClusterRole) *metric.Family {
return &metric.Family{
Metrics: []*metric.Metric{{
LabelKeys: []string{},
@ -131,7 +131,7 @@ func clusterRoleMetricFamilies(allowAnnotationsList, allowLabelsList []string) [
"",
wrapClusterRoleFunc(func(r *rbacv1.ClusterRole) *metric.Family {
return &metric.Family{
Metrics: resourceVersionMetric(r.ObjectMeta.ResourceVersion),
Metrics: resourceVersionMetric(r.ResourceVersion),
}
}),
),

View File

@ -133,7 +133,7 @@ func clusterRoleBindingMetricFamilies(allowAnnotationsList, allowLabelsList []st
"",
wrapClusterRoleBindingFunc(func(r *rbacv1.ClusterRoleBinding) *metric.Family {
return &metric.Family{
Metrics: resourceVersionMetric(r.ObjectMeta.ResourceVersion),
Metrics: resourceVersionMetric(r.ResourceVersion),
}
}),
),

View File

@ -87,7 +87,7 @@ func configMapMetricFamilies(allowAnnotationsList, allowLabelsList []string) []g
metric.Gauge,
basemetrics.STABLE,
"",
wrapConfigMapFunc(func(c *v1.ConfigMap) *metric.Family {
wrapConfigMapFunc(func(_ *v1.ConfigMap) *metric.Family {
return &metric.Family{
Metrics: []*metric.Metric{{
LabelKeys: []string{},
@ -127,7 +127,7 @@ func configMapMetricFamilies(allowAnnotationsList, allowLabelsList []string) []g
"",
wrapConfigMapFunc(func(c *v1.ConfigMap) *metric.Family {
return &metric.Family{
Metrics: resourceVersionMetric(c.ObjectMeta.ResourceVersion),
Metrics: resourceVersionMetric(c.ResourceVersion),
}
}),
),

View File

@ -96,11 +96,15 @@ func cronJobMetricFamilies(allowAnnotationsList, allowLabelsList []string) []gen
basemetrics.STABLE,
"",
wrapCronJobFunc(func(j *batchv1.CronJob) *metric.Family {
timeZone := "local"
if j.Spec.TimeZone != nil {
timeZone = *j.Spec.TimeZone
}
return &metric.Family{
Metrics: []*metric.Metric{
{
LabelKeys: []string{"schedule", "concurrency_policy"},
LabelValues: []string{j.Spec.Schedule, string(j.Spec.ConcurrencyPolicy)},
LabelKeys: []string{"schedule", "concurrency_policy", "timezone"},
LabelValues: []string{j.Spec.Schedule, string(j.Spec.ConcurrencyPolicy), timeZone},
Value: 1,
},
},
@ -245,7 +249,7 @@ func cronJobMetricFamilies(allowAnnotationsList, allowLabelsList []string) []gen
ms := []*metric.Metric{}
// If the cron job is suspended, don't track the next scheduled time
nextScheduledTime, err := getNextScheduledTime(j.Spec.Schedule, j.Status.LastScheduleTime, j.CreationTimestamp)
nextScheduledTime, err := getNextScheduledTime(j.Spec.Schedule, j.Status.LastScheduleTime, j.CreationTimestamp, j.Spec.TimeZone)
if err != nil {
panic(err)
} else if !*j.Spec.Suspend {
@ -269,7 +273,7 @@ func cronJobMetricFamilies(allowAnnotationsList, allowLabelsList []string) []gen
"",
wrapCronJobFunc(func(j *batchv1.CronJob) *metric.Family {
return &metric.Family{
Metrics: resourceVersionMetric(j.ObjectMeta.ResourceVersion),
Metrics: resourceVersionMetric(j.ResourceVersion),
}
}),
),
@ -347,10 +351,14 @@ func createCronJobListWatch(kubeClient clientset.Interface, ns string, fieldSele
}
}
func getNextScheduledTime(schedule string, lastScheduleTime *metav1.Time, createdTime metav1.Time) (time.Time, error) {
func getNextScheduledTime(schedule string, lastScheduleTime *metav1.Time, createdTime metav1.Time, timeZone *string) (time.Time, error) {
if timeZone != nil {
schedule = fmt.Sprintf("CRON_TZ=%s %s", *timeZone, schedule)
}
sched, err := cron.ParseStandard(schedule)
if err != nil {
return time.Time{}, fmt.Errorf("Failed to parse cron job schedule '%s': %w", schedule, err)
return time.Time{}, fmt.Errorf("failed to parse cron job schedule '%s': %w", schedule, err)
}
if !lastScheduleTime.IsZero() {
return sched.Next(lastScheduleTime.Time), nil

View File

@ -40,68 +40,163 @@ var (
ActiveRunningCronJob1LastScheduleTime = time.Unix(1520742896, 0)
SuspendedCronJob1LastScheduleTime = time.Unix(1520742896+5.5*3600, 0) // 5.5 hours later
ActiveCronJob1NoLastScheduledCreationTimestamp = time.Unix(1520742896+6.5*3600, 0)
TimeZone = "Asia/Shanghai"
)
func TestCronJobStore(t *testing.T) {
hour := ActiveRunningCronJob1LastScheduleTime.Hour()
ActiveRunningCronJob1NextScheduleTime := time.Time{}
func calculateNextSchedule6h(timestamp time.Time, timezone string) time.Time {
loc, _ := time.LoadLocation(timezone)
hour := timestamp.In(loc).Hour()
switch {
case hour < 6:
ActiveRunningCronJob1NextScheduleTime = time.Date(
ActiveRunningCronJob1LastScheduleTime.Year(),
ActiveRunningCronJob1LastScheduleTime.Month(),
ActiveRunningCronJob1LastScheduleTime.Day(),
return time.Date(
timestamp.Year(),
timestamp.Month(),
timestamp.Day(),
6,
0,
0, 0, time.Local)
0, 0, loc)
case hour < 12:
ActiveRunningCronJob1NextScheduleTime = time.Date(
ActiveRunningCronJob1LastScheduleTime.Year(),
ActiveRunningCronJob1LastScheduleTime.Month(),
ActiveRunningCronJob1LastScheduleTime.Day(),
return time.Date(
timestamp.Year(),
timestamp.Month(),
timestamp.Day(),
12,
0,
0, 0, time.Local)
0, 0, loc)
case hour < 18:
ActiveRunningCronJob1NextScheduleTime = time.Date(
ActiveRunningCronJob1LastScheduleTime.Year(),
ActiveRunningCronJob1LastScheduleTime.Month(),
ActiveRunningCronJob1LastScheduleTime.Day(),
return time.Date(
timestamp.Year(),
timestamp.Month(),
timestamp.Day(),
18,
0,
0, 0, time.Local)
case hour < 24:
ActiveRunningCronJob1NextScheduleTime = time.Date(
ActiveRunningCronJob1LastScheduleTime.Year(),
ActiveRunningCronJob1LastScheduleTime.Month(),
ActiveRunningCronJob1LastScheduleTime.Day(),
24,
0, 0, loc)
default:
return time.Date(
timestamp.Year(),
timestamp.Month(),
timestamp.Day()+1,
0,
0, 0, time.Local)
0,
0, 0, loc)
}
}
minute := ActiveCronJob1NoLastScheduledCreationTimestamp.Minute()
ActiveCronJob1NoLastScheduledNextScheduleTime := time.Time{}
func calculateNextSchedule25m(timestamp time.Time, timezone string) time.Time {
loc, _ := time.LoadLocation(timezone)
minute := timestamp.In(loc).Minute()
switch {
case minute < 25:
ActiveCronJob1NoLastScheduledNextScheduleTime = time.Date(
ActiveCronJob1NoLastScheduledCreationTimestamp.Year(),
ActiveCronJob1NoLastScheduledCreationTimestamp.Month(),
ActiveCronJob1NoLastScheduledCreationTimestamp.Day(),
ActiveCronJob1NoLastScheduledCreationTimestamp.Hour(),
return time.Date(
timestamp.Year(),
timestamp.Month(),
timestamp.Day(),
timestamp.Hour(),
25,
0, 0, time.Local)
0, 0, loc)
default:
ActiveCronJob1NoLastScheduledNextScheduleTime = time.Date(
ActiveCronJob1NoLastScheduledNextScheduleTime.Year(),
ActiveCronJob1NoLastScheduledNextScheduleTime.Month(),
ActiveCronJob1NoLastScheduledNextScheduleTime.Day(),
ActiveCronJob1NoLastScheduledNextScheduleTime.Hour()+1,
return time.Date(
timestamp.Year(),
timestamp.Month(),
timestamp.Day(),
timestamp.Hour()+1,
25,
0, 0, time.Local)
0, 0, loc)
}
}
func TestCronJobStore(t *testing.T) {
ActiveRunningCronJob1NextScheduleTime := calculateNextSchedule6h(ActiveRunningCronJob1LastScheduleTime, "Local")
ActiveRunningCronJobWithTZ1NextScheduleTime := calculateNextSchedule6h(ActiveRunningCronJob1LastScheduleTime, TimeZone)
ActiveCronJob1NoLastScheduledNextScheduleTime := calculateNextSchedule25m(ActiveCronJob1NoLastScheduledCreationTimestamp, "Local")
cases := []generateMetricsTestCase{
{
AllowAnnotationsList: []string{
"app.k8s.io/owner",
},
Obj: &batchv1.CronJob{
ObjectMeta: metav1.ObjectMeta{
Name: "ActiveRunningCronJobWithTZ1",
Namespace: "ns1",
Generation: 1,
ResourceVersion: "11111",
Labels: map[string]string{
"app": "example-active-running-with-tz-1",
},
Annotations: map[string]string{
"app": "mysql-server",
"app.k8s.io/owner": "@foo",
},
},
Status: batchv1.CronJobStatus{
Active: []v1.ObjectReference{{Name: "FakeJob1"}, {Name: "FakeJob2"}},
LastScheduleTime: &metav1.Time{Time: ActiveRunningCronJob1LastScheduleTime},
LastSuccessfulTime: nil,
},
Spec: batchv1.CronJobSpec{
StartingDeadlineSeconds: &StartingDeadlineSeconds300,
ConcurrencyPolicy: "Forbid",
Suspend: &SuspendFalse,
Schedule: "0 */6 * * *",
SuccessfulJobsHistoryLimit: &SuccessfulJobHistoryLimit3,
FailedJobsHistoryLimit: &FailedJobHistoryLimit1,
TimeZone: &TimeZone,
},
},
Want: `
# HELP kube_cronjob_created [STABLE] Unix creation timestamp
# HELP kube_cronjob_info [STABLE] Info about cronjob.
# HELP kube_cronjob_annotations Kubernetes annotations converted to Prometheus labels.
# HELP kube_cronjob_labels [STABLE] Kubernetes labels converted to Prometheus labels.
# HELP kube_cronjob_next_schedule_time [STABLE] Next time the cronjob should be scheduled. The time after lastScheduleTime, or after the cron job's creation time if it's never been scheduled. Use this to determine if the job is delayed.
# HELP kube_cronjob_spec_failed_job_history_limit Failed job history limit tells the controller how many failed jobs should be preserved.
# HELP kube_cronjob_spec_starting_deadline_seconds [STABLE] Deadline in seconds for starting the job if it misses scheduled time for any reason.
# HELP kube_cronjob_spec_successful_job_history_limit Successful job history limit tells the controller how many completed jobs should be preserved.
# HELP kube_cronjob_spec_suspend [STABLE] Suspend flag tells the controller to suspend subsequent executions.
# HELP kube_cronjob_status_active [STABLE] Active holds pointers to currently running jobs.
# HELP kube_cronjob_metadata_resource_version [STABLE] Resource version representing a specific version of the cronjob.
# HELP kube_cronjob_status_last_schedule_time [STABLE] LastScheduleTime keeps information of when was the last time the job was successfully scheduled.
# TYPE kube_cronjob_created gauge
# TYPE kube_cronjob_info gauge
# TYPE kube_cronjob_annotations gauge
# TYPE kube_cronjob_labels gauge
# TYPE kube_cronjob_next_schedule_time gauge
# TYPE kube_cronjob_spec_failed_job_history_limit gauge
# TYPE kube_cronjob_spec_starting_deadline_seconds gauge
# TYPE kube_cronjob_spec_successful_job_history_limit gauge
# TYPE kube_cronjob_spec_suspend gauge
# TYPE kube_cronjob_status_active gauge
# TYPE kube_cronjob_metadata_resource_version gauge
# TYPE kube_cronjob_status_last_schedule_time gauge
kube_cronjob_info{concurrency_policy="Forbid",cronjob="ActiveRunningCronJobWithTZ1",namespace="ns1",schedule="0 */6 * * *",timezone="Asia/Shanghai"} 1
kube_cronjob_annotations{annotation_app_k8s_io_owner="@foo",cronjob="ActiveRunningCronJobWithTZ1",namespace="ns1"} 1
kube_cronjob_spec_failed_job_history_limit{cronjob="ActiveRunningCronJobWithTZ1",namespace="ns1"} 1
kube_cronjob_spec_starting_deadline_seconds{cronjob="ActiveRunningCronJobWithTZ1",namespace="ns1"} 300
kube_cronjob_spec_successful_job_history_limit{cronjob="ActiveRunningCronJobWithTZ1",namespace="ns1"} 3
kube_cronjob_spec_suspend{cronjob="ActiveRunningCronJobWithTZ1",namespace="ns1"} 0
kube_cronjob_status_active{cronjob="ActiveRunningCronJobWithTZ1",namespace="ns1"} 2
kube_cronjob_metadata_resource_version{cronjob="ActiveRunningCronJobWithTZ1",namespace="ns1"} 11111
kube_cronjob_status_last_schedule_time{cronjob="ActiveRunningCronJobWithTZ1",namespace="ns1"} 1.520742896e+09
` + fmt.Sprintf("kube_cronjob_next_schedule_time{cronjob=\"ActiveRunningCronJobWithTZ1\",namespace=\"ns1\"} %ve+09\n",
float64(ActiveRunningCronJobWithTZ1NextScheduleTime.Unix())/math.Pow10(9)),
MetricNames: []string{
"kube_cronjob_next_schedule_time",
"kube_cronjob_spec_starting_deadline_seconds",
"kube_cronjob_status_active",
"kube_cronjob_metadata_resource_version",
"kube_cronjob_spec_suspend",
"kube_cronjob_info",
"kube_cronjob_created",
"kube_cronjob_annotations",
"kube_cronjob_labels",
"kube_cronjob_status_last_schedule_time",
"kube_cronjob_spec_successful_job_history_limit",
"kube_cronjob_spec_failed_job_history_limit",
},
},
{
AllowAnnotationsList: []string{
"app.k8s.io/owner",
@ -159,7 +254,7 @@ func TestCronJobStore(t *testing.T) {
# TYPE kube_cronjob_status_active gauge
# TYPE kube_cronjob_metadata_resource_version gauge
# TYPE kube_cronjob_status_last_schedule_time gauge
kube_cronjob_info{concurrency_policy="Forbid",cronjob="ActiveRunningCronJob1",namespace="ns1",schedule="0 */6 * * *"} 1
kube_cronjob_info{concurrency_policy="Forbid",cronjob="ActiveRunningCronJob1",namespace="ns1",schedule="0 */6 * * *",timezone="local"} 1
kube_cronjob_annotations{annotation_app_k8s_io_owner="@foo",cronjob="ActiveRunningCronJob1",namespace="ns1"} 1
kube_cronjob_spec_failed_job_history_limit{cronjob="ActiveRunningCronJob1",namespace="ns1"} 1
kube_cronjob_spec_starting_deadline_seconds{cronjob="ActiveRunningCronJob1",namespace="ns1"} 300
@ -206,6 +301,7 @@ func TestCronJobStore(t *testing.T) {
ConcurrencyPolicy: "Forbid",
Suspend: &SuspendTrue,
Schedule: "0 */3 * * *",
TimeZone: &TimeZone,
SuccessfulJobsHistoryLimit: &SuccessfulJobHistoryLimit3,
FailedJobsHistoryLimit: &FailedJobHistoryLimit1,
},
@ -233,7 +329,7 @@ func TestCronJobStore(t *testing.T) {
# TYPE kube_cronjob_metadata_resource_version gauge
# TYPE kube_cronjob_status_last_schedule_time gauge
# TYPE kube_cronjob_status_last_successful_time gauge
kube_cronjob_info{concurrency_policy="Forbid",cronjob="SuspendedCronJob1",namespace="ns1",schedule="0 */3 * * *"} 1
kube_cronjob_info{concurrency_policy="Forbid",cronjob="SuspendedCronJob1",namespace="ns1",schedule="0 */3 * * *",timezone="Asia/Shanghai"} 1
kube_cronjob_spec_failed_job_history_limit{cronjob="SuspendedCronJob1",namespace="ns1"} 1
kube_cronjob_spec_starting_deadline_seconds{cronjob="SuspendedCronJob1",namespace="ns1"} 300
kube_cronjob_spec_successful_job_history_limit{cronjob="SuspendedCronJob1",namespace="ns1"} 3
@ -292,7 +388,7 @@ func TestCronJobStore(t *testing.T) {
# TYPE kube_cronjob_metadata_resource_version gauge
# TYPE kube_cronjob_status_last_schedule_time gauge
# TYPE kube_cronjob_status_last_successful_time gauge
kube_cronjob_info{concurrency_policy="Forbid",cronjob="SuspendedCronJob1",namespace="ns1",schedule="0 */3 * * *"} 1
kube_cronjob_info{concurrency_policy="Forbid",cronjob="SuspendedCronJob1",namespace="ns1",schedule="0 */3 * * *",timezone="local"} 1
kube_cronjob_spec_failed_job_history_limit{cronjob="SuspendedCronJob1",namespace="ns1"} 1
kube_cronjob_spec_starting_deadline_seconds{cronjob="SuspendedCronJob1",namespace="ns1"} 300
kube_cronjob_spec_successful_job_history_limit{cronjob="SuspendedCronJob1",namespace="ns1"} 3
@ -351,7 +447,7 @@ func TestCronJobStore(t *testing.T) {
# TYPE kube_cronjob_spec_successful_job_history_limit gauge
# TYPE kube_cronjob_spec_suspend gauge
# TYPE kube_cronjob_status_active gauge
# TYPE kube_cronjob_metadata_resource_version gauge
# TYPE kube_cronjob_metadata_resource_version gauge
# TYPE kube_cronjob_status_last_successful_time gauge
kube_cronjob_spec_starting_deadline_seconds{cronjob="ActiveCronJob1NoLastScheduled",namespace="ns1"} 300
kube_cronjob_status_active{cronjob="ActiveCronJob1NoLastScheduled",namespace="ns1"} 0
@ -359,7 +455,7 @@ func TestCronJobStore(t *testing.T) {
kube_cronjob_spec_failed_job_history_limit{cronjob="ActiveCronJob1NoLastScheduled",namespace="ns1"} 1
kube_cronjob_spec_successful_job_history_limit{cronjob="ActiveCronJob1NoLastScheduled",namespace="ns1"} 3
kube_cronjob_spec_suspend{cronjob="ActiveCronJob1NoLastScheduled",namespace="ns1"} 0
kube_cronjob_info{concurrency_policy="Forbid",cronjob="ActiveCronJob1NoLastScheduled",namespace="ns1",schedule="25 * * * *"} 1
kube_cronjob_info{concurrency_policy="Forbid",cronjob="ActiveCronJob1NoLastScheduled",namespace="ns1",schedule="25 * * * *",timezone="local"} 1
kube_cronjob_created{cronjob="ActiveCronJob1NoLastScheduled",namespace="ns1"} 1.520766296e+09
` +
fmt.Sprintf("kube_cronjob_next_schedule_time{cronjob=\"ActiveCronJob1NoLastScheduled\",namespace=\"ns1\"} %ve+09\n",
@ -375,3 +471,37 @@ func TestCronJobStore(t *testing.T) {
}
}
}
func TestGetNextScheduledTime(t *testing.T) {
testCases := []struct {
schedule string
lastScheduleTime metav1.Time
createdTime metav1.Time
timeZone string
expected time.Time
}{
{
schedule: "0 */6 * * *",
lastScheduleTime: metav1.Time{Time: ActiveRunningCronJob1LastScheduleTime},
createdTime: metav1.Time{Time: ActiveRunningCronJob1LastScheduleTime},
timeZone: "UTC",
expected: ActiveRunningCronJob1LastScheduleTime.Add(time.Second*4 + time.Minute*25 + time.Hour),
},
{
schedule: "0 */6 * * *",
lastScheduleTime: metav1.Time{Time: ActiveRunningCronJob1LastScheduleTime},
createdTime: metav1.Time{Time: ActiveRunningCronJob1LastScheduleTime},
timeZone: TimeZone,
expected: ActiveRunningCronJob1LastScheduleTime.Add(time.Second*4 + time.Minute*25 + time.Hour*5),
},
}
for _, test := range testCases {
actual, _ := getNextScheduledTime(test.schedule, &test.lastScheduleTime, test.createdTime, &test.timeZone) // #nosec G601
if !actual.Equal(test.expected) {
t.Fatalf("%v: expected %v, actual %v", test.schedule, test.expected, actual)
}
}
}

Some files were not shown because too many files have changed in this diff Show More