Commit graph

72 commits

Author SHA1 Message Date
Matthias Loibl
bef034e699
Improve error handling in adapter.go 2018-12-03 17:18:53 +01:00
Nail Islamov
88c0ad0b6a
Add validation 2018-11-28 12:20:09 +11:00
Nail Islamov
3f1b120eda
Add a flag metrics-start-duration 2018-11-28 12:13:07 +11:00
Matthias Loibl
5d837a29dd
Add --prometheus-ca-file flag for specific ca 2018-11-23 17:25:22 +01:00
Solly Ross
5f52b29d47 Disable the custom metrics API with no rules
This disables the custom metrics API when no custom metrics rules are
given (the resource metrics API acts equivalently).  This allows a given
adapter to serve only one of the APIs, if desired.
2018-10-03 11:05:43 -04: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
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
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
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
huxiaoliang
af1dcc0cda Add support for auth when connecting to Prometheus
Currently, the adapter uses http.DefaultClient to access Prometheus.
This means that it does support using TLS client certificates, custom
CA certificates, or token-base authentication, which are all common
setups when connecting to Prometheus behind an auth proxy.

This commit adds support for using a separate kubeconfig, or in-cluster
config, to configure auth when connecting to Prometheus.

Fixes #52

[directxman12: cleanups, spelling corrections, and slight refactor]
2018-03-22 12:07:28 -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
8e5cb77e7f Use periodically updating RESTMapper
Currently, we fetch the discovery information once at the start of
of the adapter, and then never update it.  This could prove problematic,
since other API servers might come only after the adapter is started up.

The boilerplate contains a periodically updating RESTMapper that solves
this issue by refreshing the discovery information at an interval (as
specified by a flag), so that we have a chance to fetch new resources.
2017-08-02 15:25:48 -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
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
Lucas Käldström
a4aac78cca
Move the adapter binary to a separate subdir 2017-06-26 22:09:22 +03: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
3690c3ac6b Instrument Prometheus query times
This commit instruments prometheus query times by prometheus endpoint,
allowing us to see how quickly prometheus answers the queries that
back the custom-metrics API endpoints.
2017-06-02 15:07:13 -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