Commit graph

42 commits

Author SHA1 Message Date
Olivier Lemasle
0ea1c1b8d3 Use Golangci-lint 2022-11-28 23:17:16 +01: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
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
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
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
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
Aya Igarashi
5a6322b4ce Fix NaN not to be cast to int64 2020-08-11 20:49:27 +09:00
Sergii Koshel
d091fff18b Update metrics apiserver to support filtering by labels 2020-02-12 17:54:40 +02:00
Sergiusz Urbaniak
604208ef4f pkg/custom-provider: refactor MetricValue signature 2019-04-24 11:04:42 +02:00
Sergiusz Urbaniak
f18b6fd370 *: replace glog with klog 2019-04-24 11:04:42 +02:00
Sergiusz Urbaniak
d447eb1ec2
pkg/naming: add non-namespace resources
This is a merge commit back-porting PR #179
2019-03-28 21:04:42 -04:00
John Delivuk
e103a8eed2
Adding updated test 2019-03-26 19:05:32 -04:00
John Delivuk
8ef8c8a291
Fixing dependency in custom-provider 2019-02-11 12:12:57 -05:00
John Delivuk
6030912cc0
Moving metric naming to it's own package 2019-02-10 15:59:14 -05:00
Solly Ross
99104cba2a
Merge pull request #136 from nilebox/start-flag
Add a separate flag for 'start' parameter
2018-12-04 12:23:26 -08:00
Nail Islamov
3f1b120eda
Add a flag metrics-start-duration 2018-11-28 12:13:07 +11:00
Tiago Matias
2e82759ca9 fix typos
revert from less ideal wording

more typos
2018-11-20 10:09:02 -02:00
Solly Ross
49287fecc9 Extract fake Prometheus client impl
This extracts the fake prometheus client for use across different tests.
2018-10-03 11:05:43 -04:00
Solly Ross
cc08a1fb41 Switch to ginkgo/gomega for tests
This switches over to ginkgo/gomega for tests, which makes writing
certain tests easier/more fluent in the future.
2018-10-03 11:05:43 -04:00
Solly Ross
74c0c53e4f Refactor metrics query building to interface
This moves the metrics query building to a separate interface in the
naming package so that it can be used across providers.
2018-10-03 11:05:43 -04:00
Solly Ross
7dd9e94aea Extract label-resource logic to separate package
This extracts the label-to-resource conversion to a separte "naming" package for
use across different providers.

Early versions of the commit were done by antoinne85 in #79.
2018-10-02 16:57:55 -04:00
Solly Ross
d02384477a Upgrade boilerplate to latest
The latest boilerplate comes with a lot of simplifications and helpers
that let us reduce the amount of code written.
2018-10-02 16:57:55 -04:00
Solly Ross
9d7157f7cc Reduce metric namer label-GVR logspam
It's fairly common to have a label pattern that matches lots of
irrelevant labels, so this makes the "error" about being unable to
normalize/resolve a label to a GVR a V(9) info log, instead of an error
log.
2018-08-20 16:53:51 -04:00
Solly Ross
be018f76e3 Update dependencies to Kubernetes 1.11
This updates our dependencies to the Kubernetes 1.11 versions.
In the future, this will also allow us to support the external
metrics API.
2018-06-27 16:57:50 -04:00
Joel Speed
6089fa8528 Use channel for series aggregation
This fixes asynchronous read/write issues to when performing series
discovery by pushing series results onto a channel, instead of trying to
write them directly to a map.
2018-06-27 16:56:20 -04:00
Solly Ross
40a9ee2474 Add a helper to generate legacy configuration
This moves the DefaultConfig method out into a helper to generate legacy
configuration.  Passing in a config file is now required.
2018-06-27 16:56:20 -04:00
Solly Ross
2984604be8 Advanced Configuration
This commit introduces advanced configuration.  The rate-interval and
label-prefix flags are removed, and replaced by a configuration file
that allows you to specify series queries and the rules for transforming
those into metrics queries and API resources.
2018-06-22 15:37:12 -04:00
Solly Ross
0fa0d36e17 Allow setting a resource label prefix
This allows setting a prefix on the labels used to determine which
resources a series belongs to.  The prefix may be set using the
`--label-prefix` flag.
2018-02-06 14:35:40 -05:00
Solly Ross
43bd4798b5 Update deps for Kubernetes 1.8
This updates the dependencies to be compatible with Kubernetes 1.8,
including the new custom.metrics.k8s.io/v1beta1 API group and the
corresponding custom-metrics-apiserver changes.
2017-09-28 17:10:11 -04:00
Solly Ross
58a9769eaa Refactor to remove duplicate code from boilerplate
This commit switches to using the boilerplate versions of
a couple different utilities, including the metric info normalization
and the common error types.
2017-08-02 15:48:12 -04:00
Solly Ross
703e9ecf09 Use new kubenetes-incubator version of boilerplate
The boilerplate moved to
github.com/kuberntes-incubator/custom-metrics-apiserver, so we should
use that now.
2017-08-02 15:23:03 -04:00
Solly Ross
c912e1e3be Return proper errors from provider
All errors returned by the provider should be proper Kube API status
errors.  This commit cleans up a couple spots that either returned an
invalid error, or were missing an error (such as the case in when no
results matched the requested object).
2017-06-27 20:18:37 -04:00
Solly Ross
696fe9015a Clean up minor TODOs
This commit cleans up some TODOs where were done or no longer
applicable, and fixes a couple other minor TODOs, such as returning
proper errors.
2017-06-27 20:13:17 -04:00
Solly Ross
823b8051c9 Continue on error when processing series
Previously, if we encountered an error while trying to update our series
list, we'd return an error, aborting the processing of the entire batch.
This could lead to the list of available metrics being severely out of
date.  Instead, we simply log an error when we fail to process a metric
name, and skip it.
2017-06-27 20:13:17 -04:00
Solly Ross
d1d60f7f5e Have provider constructor take a stop channel
This causes the Prometheus provider to take a stop channel as an
argument, which allows us to stop the lister (which keeps the series list
up to date) in the unit tests.
2017-06-27 20:11:02 -04:00
Solly Ross
756ff0941e gofmt all files
Some of the files were not appropriately formatted.  Now that we run
`verify` in Travis, these'll need to be.
2017-06-27 19:01:39 -04:00
Solly Ross
bbf23f18d0 Fix out-of-date unit tests
Several of the unit tests were out of date with the interface or type
definitions.  Now that we're running CI, they need to be up to date
(they should have been anyway, but that's a different story).
2017-06-27 19:01:39 -04:00
Solly Ross
ff72108468 Use renamed k8s.io/custom-metrics-boilerplate
k8s.io/custom-metrics-boilerplate was "renamed" to
"github.com/directxman12/custom-metrics-boilerplate".  This updates all
references to point to the correct location.
2017-06-24 01:42:10 -04:00
Solly Ross
5bff503339 Initial Functionality
The initial functionality works.  There's still a number of TODOs to
clean up, and some edge cases to work around, and some errors that could
be handled better.
2017-05-10 00:05:32 -04:00