In custom-metrics-apiserver v1.22.0, contexts were added to the metric
providers. We can benefit from that by propagating the context given to
the provider down to the requests.
Signed-off-by: Damien Grisonnet <dgrisonn@redhat.com>
When querying custom-metrics, the metric label selectors weren't
populated in the resulting values.
Signed-off-by: Damien Grisonnet <dgrisonn@redhat.com>
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).
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.
k8s.io/custom-metrics-boilerplate was "renamed" to
"github.com/directxman12/custom-metrics-boilerplate". This updates all
references to point to the correct location.
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.