Commit graph

102 commits

Author SHA1 Message Date
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
paulfantom
e84becd7ac
pkg/names: test namespaced external metrics selectors 2019-05-17 15:35:04 +02:00
Sergiusz Urbaniak
486324753e
pkg/naming/BuildExternal: respect namespace
Currently, the namespace is ignored for external labels.

This fixes it.
2019-05-17 15:02:57 +02:00
paulfantom
2374cef641
pkg/naming: fix unit test 2019-05-17 14:36:02 +02:00
Sergiusz Urbaniak
99d52a4ce8
pkg/external-provider: set metric name for scalar values 2019-05-17 14:31:41 +02:00
paulfantom
0d5c3ebd04
pkg/naming: add unit tests 2019-05-17 11:47:29 +02:00
Sergiusz Urbaniak
9e072b2b57
pkg/naming: fix LabelValuesByName rendering
According to documentation LabelValuesByName is supposed to render "|" separated values.
Currently it is returned as a slice per label name. This fixes it

Fixes #191
2019-05-07 14:04:29 +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
Jens Ulrich Hjuler Pedersen
113f90ec5e
Remove unnecessary log line - Fix #188 2019-04-24 10:03:35 +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
ff409a0994
Refactoring external to leverage naming 2019-03-26 18:57:02 -04:00
John Delivuk
3f7f249cb8
Removing RestMapper, cleaning up notification hanlder 2019-03-08 13:29:36 -05:00
John Delivuk
0bb762b367
Adding license to externalprovider and naming. 2019-02-22 10:29:24 -05:00
John Delivuk
980bc01d67
Updating Errors, and adding license 2019-02-22 10:04:10 -05: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
c2e176bb23
Merge pull request #158 from linux-on-ibm-z/cross-compile
Edited Makefile to add cross build support for s390x.

Adding External Metrics Provider
2019-02-10 15:59:11 -05: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
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
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
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
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
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
Tanner Bruce
1ec7809eaf use strict unmarshalling to ensure correct configuration 2018-08-09 16:30:06 -05: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
01755d5acb Extract timeout from context in Prom client
For vector and range queries, the Prometheus HTTP API takes a timeout
parameter.  Previously, we ignored this parameter.  Now, we check to see
if the context passed to the query contains a deadline, and if so,
compare that to the current time to calculate an appropriate timeout for
query evaulation.
2017-06-27 20:13:16 -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