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]
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.
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.
This commit switches to using the boilerplate versions of
a couple different utilities, including the metric info normalization
and the common error types.
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.
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).
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.
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.
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.
This adds `verify-gofmt` and `gofmt` make targets for quick go-fmting.
It also adds a `verify` target which verifies `gofmt` and the runs the
unit tests.
Travis now runs `make verify` instead of just `make test` as the 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).