Commit graph

488 commits

Author SHA1 Message Date
Solly Ross
f9a9893093 Merge pull request #20 from DirectXMan12/docs/walkthrough
[docs] Add walkthrough
2017-09-07 14:54:32 -04:00
Solly Ross
4e99936e4f [docs] Add walkthrough
This adds a walkthrough to the docs covering setting up Prometheus and
the adapter, as well as autoscaling a sample application on custom
metrics.
2017-09-07 14:53:37 -04:00
Solly Ross
b6602e1724 Merge pull request #15 from DirectXMan12/refactor/update-todos
Cleanups from initial development
2017-08-04 15:14:59 -04:00
Solly Ross
58a9769eaa Refactor to remove duplicate code from boilerplate
This commit switches to using the boilerplate versions of
a couple different utilities, including the metric info normalization
and the common error types.
2017-08-02 15:48:12 -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
766cd07c3a Link to luxas's demo
luxas has an excellent demo up, tying everything together.  This adds a
link (with a brief description) to that demo repo.
2017-08-02 15:22:42 -04:00
Solly Ross
5f963b6a02 Merge pull request #17 from luxas/add_dockerized_vendor
add option to fetch vendor dockerized
2017-07-06 14:19:24 -04:00
Lucas Käldström
bc8fd52523
add option to fetch vendor dockerized 2017-07-06 14:31:32 +03:00
Solly Ross
c912e1e3be Return proper errors from provider
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).
2017-06-27 20:18:37 -04:00
Solly Ross
696fe9015a Clean up minor TODOs
This commit cleans up some TODOs where were done or no longer
applicable, and fixes a couple other minor TODOs, such as returning
proper errors.
2017-06-27 20:13:17 -04:00
Solly Ross
823b8051c9 Continue on error when processing series
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.
2017-06-27 20:13:17 -04:00
Solly Ross
01755d5acb Extract timeout from context in Prom client
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.
2017-06-27 20:13:16 -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
895183e503 Merge pull request #14 from DirectXMan12/build/initial-travis-setup
[build] set up Travis CI to run the unit tests
2017-06-27 19:07:18 -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
Solly Ross
417f5a9f99 [build] Add gofmt-related Makefile targets
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.
2017-06-27 19:01:39 -04:00
Solly Ross
bbf23f18d0 Fix out-of-date 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).
2017-06-27 19:01:39 -04:00
Solly Ross
c1b9a7faab Use special client-go for fake dynamic client
Until kubernetes/kubernetes#45431 merges, we have to use a special
version of client go (at
https://github.com/DirectXMan12/client-go/tree/feature/fake-dynamic-client)
in order to actually run our tests.  When the above PR merges, we should
revert these changes.
2017-06-27 19:01:38 -04:00
Solly Ross
349128f5a5 [build] set up Travis CI to run the unit tests
This commit sets up Travis CI to run the unit tests.
It installs glide, initializes the vendor directory,
and then runs `make test`.
2017-06-27 16:49:19 -04:00
Solly Ross
2ef3de3434 Merge pull request #9 from luxas/new_demo
Add RBAC and API Aggregation rules to example manifest
2017-06-27 15:47:44 -04:00
Solly Ross
78d9749971 Merge pull request #10 from DirectXMan12/refactor/glide-makefile-tweaks
Makefile Tweaks
2017-06-27 11:08:33 -04:00
Solly Ross
d46c73ae6f [build] mark phony targets as such
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).
2017-06-27 11:07:35 -04:00
Solly Ross
88b3531ef5 [build] add a test target
This commit adds a target for running `go test`.
2017-06-27 11:07:34 -04:00
Solly Ross
91bc1dcd71 [build] cause all to trigger build
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.
2017-06-26 16:27:53 -04:00
Solly Ross
a723582f58 [build] add make rule for vendor
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.
2017-06-26 16:27:53 -04:00
Solly Ross
3618aafca4 [build] fix build makefile target path
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
2017-06-26 16:27:26 -04:00
Solly Ross
6f4f0ea2f9 Merge pull request #8 from luxas/move_cmd
Move the adapter binary to a separate subdir
2017-06-26 16:25:37 -04:00
Lucas Käldström
98a6cd5bce
Add RBAC and API Aggregation rules to example manifest 2017-06-26 22:18:29 +03:00
Lucas Käldström
a4aac78cca
Move the adapter binary to a separate subdir 2017-06-26 22:09:22 +03:00
Solly Ross
365c8fb112 Merge pull request #5 from luxas/patch-1
Update Makefile to release and build for multiple platforms
2017-06-26 14:57:46 -04:00
Lucas Käldström
c4e6f3307f
Update Makefile to release and build for multiple platforms 2017-06-26 20:11:15 +03:00
Solly Ross
66cf5eaafb Provide basic deployment instructions
This commit introduces a Dockerfile with some basic deployment
instructions, as well as a makefile for convinience.
2017-06-24 01:42:10 -04:00
Solly Ross
4dd94c3c85 Update dependencies
This commit updates the dependencies to the latest
custom-metrics-boilerplate, plus newer Kube libraries.
2017-06-24 01:42:10 -04: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
f68a69461a Add README
The readme contains a basic description of configuration, as well as
details on how underlying Prometheus metrics map to custom metrics API
metrics.
2017-06-24 01:42:09 -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