Commit graph

102 commits

Author SHA1 Message Date
Damien Grisonnet
01b29a6578 *: fix openapi-gen options
Signed-off-by: Damien Grisonnet <dgrisonn@redhat.com>
2024-05-16 14:26:37 +02:00
bogo
a5bcb39046
replace "endpoint" with "path" 2023-10-23 11:15:51 +08:00
bogo
2a4a4316dd run make update-lint and set EnabledMetrics=false in the server config 2023-10-13 20:14:34 +08:00
bogo
a53ee9eed1
replace "endpoint" with "path"
Co-authored-by: Simon Pasquier <spasquie@redhat.com>
2023-10-07 10:40:52 +08:00
bogo
e772844ed8
normalize import order 2023-09-04 11:01:25 +08:00
bogo
0032610ace change the latency metric and dependency inject prometheus registry 2023-08-29 17:19:47 +08:00
bogo
7cf3ac5d90
Update metric buckets 2023-08-17 20:57:47 +08:00
bogo
966ef227fe Fix metric unregistered 2023-08-17 20:23:01 +08:00
Damien Grisonnet
e69388346f *: bump go to 1.20 and k8s deps to 0.27.2
Signed-off-by: Damien Grisonnet <dgrisonn@redhat.com>
2023-06-20 18:39:50 +02:00
Damien Grisonnet
86efb37019 Update golangci-lint to 1.53.2
Signed-off-by: Damien Grisonnet <dgrisonn@redhat.com>
2023-06-13 15:02:46 +02:00
Olivier Lemasle
03cd31007e Add stylecheck linter 2022-12-08 23:12:26 +01:00
Olivier Lemasle
0ea1c1b8d3 Use Golangci-lint 2022-11-28 23:17:16 +01:00
Kubernetes Prow Robot
dd85956fbf
Merge pull request #509 from ksauzz/feature/query-verb
Add --prometheus-verb to support POST requests to prometheus servers
2022-08-12 05:34:43 -07:00
Damien Grisonnet
cca107d97c *: support new MetricsGetter interface
Signed-off-by: Damien Grisonnet <dgrisonn@redhat.com>
2022-08-11 15:04:45 +02:00
Damien Grisonnet
9321bf0162 zz_generated.openapi.go: regenerate
Signed-off-by: Damien Grisonnet <dgrisonn@redhat.com>
2022-08-11 15:04:45 +02:00
Damien Grisonnet
d2ae4c1569 go.mod: bump golang and k8s deps to 0.24.3
Signed-off-by: Damien Grisonnet <dgrisonn@redhat.com>
2022-08-11 15:04:43 +02:00
Kazuhiro Suzuki
a8742cff28 Add --prometheus-verb to support POST requests to prometheus servers 2022-06-28 18:23:52 +09:00
lokichoggio
df3080de31
fix: close file 2022-04-11 17:54:51 +08:00
Leo Lei
bb4722e38b Fix external metrics provider not respecting metrics-max-age 2021-09-24 18:42:24 +08:00
Damien Grisonnet
8b85c68c9e pkg: propagate metric providers context
In custom-metrics-apiserver v1.22.0, contexts were added to the metric
providers. We can benefit from that by propagating the context given to
the provider down to the requests.

Signed-off-by: Damien Grisonnet <dgrisonn@redhat.com>
2021-08-11 17:04:01 +02:00
Damien Grisonnet
4eb6c313a1 go.mod: update custom-metrics-apiserver to v1.22.0
Signed-off-by: Damien Grisonnet <dgrisonn@redhat.com>
2021-08-11 13:56:45 +02:00
Kubernetes Prow Robot
97236f92ed
Merge pull request #432 from discordianfish/prometheus-request-headers
Support setting headers on requests to Prometheus
2021-07-19 05:34:51 -07:00
Johannes 'fish' Ziemke
d84340cc85 Support setting headers on requests to Prometheus 2021-07-17 14:44:35 +02:00
Damien Grisonnet
0b3ac78d19 pkg/resourceprovider: guard from negative metrics
When serving the resource metrics API, prometheus-adapter may return
negative values for pods/nodes memory and CPU usage. This happens
because Prometheus sees counter resets which results in Prometheus
interpolating data incorrectly to avoid the counter value going down.
To prevent that, we need to add some guards in prometheus-adapter to
replace the negative value by zero whenever it detects one.

Signed-off-by: Damien Grisonnet <dgrisonn@redhat.com>
2021-07-13 12:19:02 +02:00
Kubernetes Prow Robot
815fa20931
Merge pull request #404 from dgrisonnet/module
Move prometheus-adapter to sigs.k8s.io golang package
2021-06-02 02:30:06 -07:00
Damien Grisonnet
9dfbca09ca go.mod: move to sigs.k8s.io golang package
Signed-off-by: Damien Grisonnet <dgrisonn@redhat.com>
2021-06-01 17:35:45 +02:00
Damien Grisonnet
76e61d47f6 pkg/resourceprovider: prevent metrics-server panic
The code that we are reusing from metrics-server to call
GetContainerMetrics and GetNodeMetrics requires that both functions
returns arrays of lengths of the number of pods/nodes given as
arguments. In some cases, prometheus-adapter was returning nil which
caused panics in metrics-server code.

Signed-off-by: Damien Grisonnet <dgrisonn@redhat.com>
2021-06-01 16:32:58 +02:00
Damien Grisonnet
c67e8f5956 go.mod: bump dependencies
Signed-off-by: Damien Grisonnet <dgrisonn@redhat.com>
2021-06-01 15:25:56 +02:00
Kubernetes Prow Robot
c893b1140c
Merge pull request #380 from carsonoid/issue-324-carsonoid
Allow metrics to be defined as `namespaced: false`
2021-05-12 06:12:17 -07:00
Carson Anderson
6c1d85ccf9 Split ExternalMetricsQuery and MetricsQuery funcs 2021-05-11 14:49:11 -06:00
Carson Anderson
c0ae5d6dd4 fix tests 2021-04-23 11:39:47 -06:00
Carson Anderson
fa5f8cd742 Add requested fixes 2021-04-23 11:27:38 -06:00
Carson Anderson
510c3724ce Add docs, tests, and move namespaced to metricsQuery 2021-04-08 11:07:50 -06:00
aackerman
0e105eeeb1 Update tests to use container and pod labels instead of container_name and pod_name 2021-03-23 12:41:44 -05:00
Carson Anderson
3ae38c7417 Allow metrics to be defined as namespaced: false
When set to false, no namespace label will be set by the adapter based on the namespace
portion of the url in the request path.

This allows individual consumers to set namespace independent of the source kubernetes resource.

---

Example:

Given an adapter config like this:

```
    externalRules:
    - seriesQuery: 'nsq_topic_depth'
      resources:
        namespaced: false
```

An HPA could target a different namespace by setting it in the selector:

```
  - type: External
    external:
      metric:
        name: nsq_topic_depth
        selector:
          labelSelector:
            topic: my-topic
            namespace: nsq
```

This is useful for scaling on metrics from services that run in a differnt namespace than the source resource.
2021-03-05 15:25:37 -07:00
Kubernetes Prow Robot
7e11fe30ee
Merge pull request #372 from paulfantom/json
pkg/config: allow configuration to be read from json schema
2021-03-01 05:22:46 -08:00
paulfantom
cd55a67b89
*: move all imports to github.com/kubernetes-sigs/prometheus-adapter
Signed-off-by: paulfantom <pawel@krupa.net.pl>
2021-02-22 15:49:03 +01:00
paulfantom
1cc7bed020
pkg/config: allow configuration to be read from json schema 2021-02-22 10:17:27 +01:00
Sergiusz Urbaniak
f33fc94229
Merge pull request #348 from dgrisonnet/populate-selector
Populate metric selector for custom metrics
2020-12-15 15:54:52 +01:00
Sergiusz Urbaniak
147b5c8858
pkg/api/generated: regenerate 2020-12-14 12:43:59 +01:00
Damien Grisonnet
76020f6618 pkg/custom-provider: populate metric selector
When querying custom-metrics, the metric label selectors weren't
populated in the resulting values.

Signed-off-by: Damien Grisonnet <dgrisonn@redhat.com>
2020-12-10 16:14:22 +01:00
Johannes Würbach
b09c680295
ensure openapi is up-to-date and use same kube-openapi version 2020-11-10 16:07:17 +01:00
Sergiusz Urbaniak
87c429b5c6
Merge pull request #330 from joelsmith/master
Populate both CPU and Memory resource container metrics if one is specified
2020-10-30 07:30:26 +01:00
Sergiusz Urbaniak
69569bf7ab pkg/client: refactor to klog/v2 api 2020-10-28 15:57:23 +01:00
Sergiusz Urbaniak
752ce84723 cmd/*,pkg/*,docs,go.mod: bump custom-metrics-apiserver, metrics-server 2020-10-28 15:52:12 +01:00
Sergiusz Urbaniak
a858d53495 pkg/*,cmd/*: move to k8s.io/klog/v2 2020-10-28 15:48:05 +01:00
Joel Smith
bdc8b487ba Populate both CPU and Memory resource container metrics if one is specified 2020-10-27 19:39:13 -06:00
Johannes Würbach
1d44cbbbb8
Serve openapi spec 2020-10-23 11:06:41 +02:00
Johannes Würbach
47a5ed8047
Adjustments after metrics-server update 2020-10-23 11:06:40 +02:00
Aya Igarashi
5a6322b4ce Fix NaN not to be cast to int64 2020-08-11 20:49:27 +09:00