Commit graph

22 commits

Author SHA1 Message Date
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
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
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
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
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
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
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
47a5ed8047
Adjustments after metrics-server update 2020-10-23 11:06:40 +02:00
Clayton Coleman
c6ac5cbc87
*: Update to sigs.k8s.io/metrics-server latest
Pick up changes to 1.17 to custom-metrics-apiserver and the latest
changes in metrics-server to allow us to show table results for
podmetrics and nodemetrics. Fix import and interface changes as
necessary.

The localvendor directory is an artifact of a change in sigs.k8s.io:

sigs.k8s.io/metrics-server now requires this dependency in order to
resolve, even though we do not use the scraper package.

go: sigs.k8s.io/metrics-server@v0.3.7 requires
    k8s.io/kubernetes/pkg/kubelet/apis/stats/v1alpha1@v0.0.0: reading k8s.io/kubernetes/pkg/kubelet/apis/stats/v1alpha1/pkg/kubelet/apis/stats/v1alpha1/go.mod at revision pkg/kubelet/apis/stats/v1alpha1/v0.0.0: unknown revision pkg/kubelet/apis/stats/v1alpha1/v0.0.0
2020-04-08 11:47:25 -04:00
Sergii Koshel
d091fff18b Update metrics apiserver to support filtering by labels 2020-02-12 17:54:40 +02:00
Sergiusz Urbaniak
f18b6fd370 *: replace glog with klog 2019-04-24 11:04:42 +02:00
Frederic Branczyk
7624952870
resourceprovider: Add comments on possible nil results 2018-12-13 15:50:02 -08:00
Frederic Branczyk
e9ef0bb4d0
Fix empty pod or node list resulting in an error 2018-12-11 10:21:21 -08:00
Solly Ross
6c8f44623e Add tests for the resource metrics provider
This adds basic tests for the resource metrics provider, and fixes up
the default config slightly.
2018-10-03 11:05:43 -04:00
Solly Ross
c5801455ec Introduce support for the resource metrics API
This introduces support for the resource metrics in the adapter.
The individual queries and window sizes are fully customizable via a new
config section.  This uses just the generic machinery from
metrics-server to serve the API.
2018-10-03 11:05:43 -04:00