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).
This commit marks the phony targets in the Makefile as phony, following
good Makefile practices (for example, so we don't have have issues with
someone creating a file with a matching name in the future, etc).
This commit causes the `all` Makefile rule to trigger `build` instead
of `docker-build`. This allows people with convoluted setups that
involve `go build`-ing and `docker build`-ing on different machines (like
@directxman12) to not complain as much.
This commit adds a Makefile rule for installing the vendor directory.
Both the `build` and `docker-build` phony rules depend on the `vendor`
rule, which in turn depends on the `glide.lock` rule. This means that
any time the `glide.lock` file is updated, the vendor directory will be
re-installed.
The `build` Makefile target attempted to place the generated artifact in
`/build`, where it should have used a local directory instead. This
commit makes the directory configurable using the `OUT_DIR` argument,
and defaults it to ./_output