Commit Graph

94 Commits

Author SHA1 Message Date
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
Lénaïc Huard 61134a08b6
Return an error instead of only logging 2025-01-23 15:55:11 +01:00
Chris Bartlett 24c2194e7e fix: deduplication of cr enabled resources 2024-09-18 17:22:38 -06: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 74d226ccf0 chore: Replace NewReflector with NewReflectorWithOptions func 2024-08-05 16:44:43 +02:00
Fabian Heib e4d2bd48c8 Support filtering annotations allowlist by "*"
Resolves: add-wilcard-allowlist-annotations
2023-11-02 17:22:02 +01:00
Kubernetes Prow Robot 535085e412
Merge pull request #2154 from chrischdi/pr-custom-metrics-missing-header
fix: custommetrics: always extract the headers but only write it when we have metrics
2023-08-28 09:43:42 -07:00
opeco17 634c04ef90 feat: enable metric-annotations-allowlist and metric-labels-allowlist for ResourceQuota 2023-08-28 13:59:14 +00:00
Christian Schlotter e57a28af2f
feat(custommetrics) always extract the metric headers but only write them when we have metrics 2023-08-18 17:42:47 +02:00
Pranshu Srivastava 25a1d8da05
Add support for variable VKs in CRS config
Add support for variable VKs in CRS config, while maintaining a cache
of discovered GVKs in the cluster, and updating it every 30s.

Signed-off-by: Pranshu Srivastava <rexagod@gmail.com>
2023-05-20 01:26:02 +05:30
Manuel Rüger cef8c1fa4c feat!: Remove VerticalPodAutoscaler
BREAKING CHANGE: VPA is now supported only via Custom Resource Metrics

Signed-off-by: Manuel Rüger <manuel@rueg.eu>
2023-03-16 14:37:44 +01:00
Manuel Rüger fa5346405a Use structured logging 2023-01-27 17:35:26 +01:00
Kubernetes Prow Robot 4e30f4e319
Merge pull request #1921 from dgrisonnet/simplify-metricswriter
Remove duplicated MetricsWriter implementation
2022-12-06 23:32:38 -08:00
Damien Grisonnet e355c48da1 Remove duplicated MetricsWriter implementation
Simplify the implementation of the MetricsWriter to avoid code
duplication between single and multi stores scenarios.

Signed-off-by: Damien Grisonnet <dgrisonn@redhat.com>
2022-12-06 21:02:19 +01:00
Manuel Rüger b4b8c23b97 Add Metrics for EndpointSlices
Implements https://pkg.go.dev/k8s.io/api/discovery/v1#EndpointSlice

This resourcetype is disabled by default as they are very verbose and
have a high cardinality.
Metrics from endpointslices can be used to identify if specific pods are
part of an endpoint and thus discoverable through a service.

Signed-off-by: Manuel Rüger <manuel@rueg.eu>
2022-11-26 01:44:29 +01:00
Kubernetes Prow Robot 3cf1b16f03
Merge pull request #1905 from kaitoii11/ingressclass
Add ingress class metrics
2022-11-24 07:40:04 -08:00
Kaito Ii 991857ccb5
Update internal/store/builder.go
Co-authored-by: Damien Grisonnet <damien.grisonnet@epita.fr>
2022-11-24 22:29:01 +09:00
JoaoBraveCoding 8f27e70760
autoscaling/v2beta2 HorizontalPodAutoscaler is deprecated in v1.23+
Issue: https://github.com/kubernetes/kube-state-metrics/issues/1711

Problem: kube-state-metrics supports up to (latest k8s release - 3) k8s
version. Since v1.25 has been release we can update it to start using
autoscaler/v2.

Solution: update packages to start using autoscaler/v2

Signed-off-by: JoaoBraveCoding <jmarcal@redhat.com>
2022-11-24 11:30:20 +00:00
Kaito Ii 4abefe268a add ingress class metrics 2022-11-23 23:16:36 +09:00
Kubernetes Prow Robot d5bd2c8274
Merge pull request #1823 from rexagod/1815
Support filtering label allowlist by "*"
2022-11-08 03:42:22 -08:00
Pranshu Srivastava d982bbc9c9
Support filtering label allowlist by "*"
Support filtering label allowlist by "*", which will expand to the
enabled resources, while infering their values based on its value(s).

Signed-off-by: Pranshu Srivastava <rexagod@gmail.com>
2022-11-07 23:59:36 +05:30
Catherine Fang f9d29ba761 Refactoring 2022-11-04 08:44:00 -04:00
Catherine Fang d523f8e0e4 Move merging fieldselectors into app/server.go and replace namespaceFitler with fieldSelectorFilter 2022-11-04 08:44:00 -04:00
Catherine Fang 87a7793c7f Clean 2022-11-04 08:44:00 -04:00
Catherine Fang 2c0c8d2e51 Sharding per node 2022-11-04 08:44:00 -04:00
Pranshu Srivastava 052f572ae7
Handle singular labels in allowlist
Handle singular labels in allowlist failing when such a label is
supplied, in order to keep the behaviour in sync with --resources.

Signed-off-by: Pranshu Srivastava <rexagod@gmail.com>
2022-09-26 12:17:32 +05:30
Kubernetes Prow Robot 3532203e8f
Merge pull request #1799 from kaitoii11/rolebinding
Add support for rolebindings
2022-08-18 12:22:12 -07:00
Kubernetes Prow Robot 4bb1b38397
Merge pull request #1807 from dmpe/strcuturedlogging_part1
feat(logging): migration to structure logging for main.go, pkg/ & internal/ folders
2022-08-16 00:17:07 -07:00
Manuel Rüger 2f20203c09 Replace pkg/errors with stdlib errors
github.com/pkg/errors is archived and not maintained anymore.
Replace it with stdlib functions.

Signed-off-by: Manuel Rüger <manuel@rueg.eu>
2022-08-15 20:25:09 +02:00
dmpe f406c1aa1d feat(logging): migrate to structured logging
Signed-off-by: dmpe <John Malc> <cincenko@outlook.com>
2022-08-13 14:18:56 +02:00
Kaito Ii de8b1b40d2 fix typo 2022-08-07 02:03:09 +09:00
Kaito Ii 51df8fe763 add rolebinding metrics 2022-08-07 01:32:57 +09:00
Kaito Ii 3c9908d0b3 add role and cluster role
Signed-off-by: Kaito Ii <kaitoii1111@gmail.com>
2022-06-30 20:55:25 +09:00
Julian van den Berkmortel 6a24f639f8
Add support for the ServiceAccount resource (Ref: #1717) 2022-06-29 23:58:01 +02:00
Brad Ison d01ad03ae6
Use v1 PodDisruptionBudget and CronJob resources
Both the PodDisruptionBudget and CronJob resources have been promoted
to v1 as of Kubernetes v1.21 release.  The previous v1beta1 versions
are now deprecated, and will be removed in v1.25 and above.  This
updates all references to the new v1 versions.
2022-01-04 14:47:41 +01:00
Kubernetes Prow Robot 081cc3c0f1
Merge pull request #1644 from Garrybest/pr_crd
Extend kube-state-metrics to support Custom Resource metrics
2022-01-04 02:07:00 -08:00
Arunprasad Rajkumar 6d7780e2ee
pdb: use plural form of resource name in allowlist key
All other allowlist selectors are using plural form of resource name
except PDB. Actually it is a typo introduced by PR[1].

[1] https://github.com/kubernetes/kube-state-metrics/pull/1623

Signed-off-by: Arunprasad Rajkumar <arajkuma@redhat.com>
2021-12-17 20:29:49 +05:30
Garrybest 3ca06c2692 Reform Builder to adapt custom resource registry
Signed-off-by: Garrybest <garrybest@foxmail.com>
2021-12-14 21:31:26 +08:00
Julian van den Berkmortel d767e99c98
Add FamilyGeneratorFilter interface and use it for the allow- / denylist 2021-11-16 17:49:13 +01:00
Arunprasad Rajkumar b5e78331cc
Implement kube_*_labels and kube_*_annotations metrics for pdb
This commit introduces kube_*_labels and kube_*_annotations metrics to
poddisruptionbudget to keep in consistency with other k8s objects.

Signed-off-by: Arunprasad Rajkumar <arajkuma@redhat.com>
2021-10-26 21:19:40 +05:30
Min Wang c6ec339eea
address comments 2021-10-19 11:20:18 -07:00
Ahmed Mezghani 73d15e3b6c
Fix BuilderInterface 2021-10-11 18:11:57 +02:00
Min Wang 1b2c05c6c9 Add fieldSelector in listWatchFunc 2021-10-04 18:54:51 -07:00
Gabi Davar 58559bf0cf
put all arguments into one line. 2021-09-21 14:53:23 +03:00
Gabi Davar 443c91ae40
Expose configmap labels and annotations 2021-09-21 12:52:40 +03:00
Philip Gough 69f1af4834 internal: Migrate HPA API version to autoscaling/v2beta2
autoscaling/v2beta1 HorizontalPodAutoscaler is deprecated in v1.22+ and becomes
unavailable in v1.25+

This change updates the client to use autoscaling/v2beta2

Signed-off-by: Philip Gough <philip.p.gough@gmail.com>
2021-08-31 13:01:23 +01:00
Sylvain Rabot 0e45534441
Merge remote-tracking branch 'origin/master' into annotations 2021-08-19 16:31:20 +02:00
Lan Liang 185687e6ad Change useApiServerCache to useAPIServerCache 2021-08-16 22:16:24 +08:00
Sylvain Rabot 96d08df5d0
Merge remote-tracking branch 'origin/master' into annotations 2021-08-16 08:50:02 +02:00
Lan Liang 3bbd8d5a88 Add arg use-api-server-cache to set resourceVersion=0 for ListWatch 2021-08-13 13:12:36 +08:00