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
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
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.
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.
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.
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.
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.
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.
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.
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).
k8s.io/custom-metrics-boilerplate was "renamed" to
"github.com/directxman12/custom-metrics-boilerplate". This updates all
references to point to the correct location.