Commit graph

488 commits

Author SHA1 Message Date
Arunprasad Rajkumar
aed49ff54f
fix: incorrect type used for openapi spec
Prior to this fix, openapi spec for prometheus-adapter apiextension was based on the type "k8s.io/sample-apiserver/pkg/apiserver" which is incorrect. Due to the incorrect type, `kubectl explain podmetrics` (or nodemetrics) wasn't showing any doc for any resources from metrics.k8s.io/v1beta1.

This changeset fixes the problem by using the right type(sigs.k8s.io/metrics-server/pkg/api) for the openapi generation.

This also helped to remove the sample-apiserver dependency from
prometheus-adapter.

Signed-off-by: Arunprasad Rajkumar <arajkuma@redhat.com>
2021-07-15 19:39:59 +05:30
fpetkovski
134774884c Document image registries
Signed-off-by: fpetkovski <filip.petkovsky@gmail.com>
2021-07-15 09:18:13 +02:00
Damien Grisonnet
0b3ac78d19 pkg/resourceprovider: guard from negative metrics
When serving the resource metrics API, prometheus-adapter may return
negative values for pods/nodes memory and CPU usage. This happens
because Prometheus sees counter resets which results in Prometheus
interpolating data incorrectly to avoid the counter value going down.
To prevent that, we need to add some guards in prometheus-adapter to
replace the negative value by zero whenever it detects one.

Signed-off-by: Damien Grisonnet <dgrisonn@redhat.com>
2021-07-13 12:19:02 +02:00
Damien Grisonnet
93450fc29f
Merge pull request #424 from dgrisonnet/cloudbuild-timeout
Increase cloudbuild timeout to 1h
2021-07-06 17:01:57 +02:00
Damien Grisonnet
c8ee46b6b4
Merge pull request #423 from dgrisonnet/fix-push-multi-arch
Fix push-multi-arch image deployment
2021-07-06 17:01:36 +02:00
Damien Grisonnet
4a22d18a5d cloudbuild: increase timeout to 1h
Signed-off-by: Damien Grisonnet <dgrisonn@redhat.com>
2021-07-06 16:52:52 +02:00
Damien Grisonnet
9fd8918914 image: fix push-multi-arch image deployment
Signed-off-by: Damien Grisonnet <dgrisonn@redhat.com>
2021-07-06 16:51:17 +02:00
Damien Grisonnet
731e852494
Merge pull request #420 from dgrisonnet/fix-prow-deploy
Stop populating IMAGE env variable
2021-07-06 15:18:15 +02:00
Kubernetes Prow Robot
2dbb46f158
Merge pull request #421 from ashishranjan1457/issue-412-ashishranjan1457
Fix external rule tag in documentation
2021-07-02 08:06:13 -07:00
Ashish Ranjan
4256683587
Fix the tag for external rules 2021-07-02 16:23:28 +05:30
Ashish Ranjan
0ceb09085c
Fix external rule tag in documentation
Replaced external: by externalRules: in documentation for external rules
2021-07-02 12:17:59 +05:30
Damien Grisonnet
670b3def30 Makefile: stop populating IMAGE env variable
The IMAGE env variable is used by prow when building images, so it was
replacing what we would have expected to be the `prometheus-adapter`
image by the container image used to build the prometheus-adapter image.

Signed-off-by: Damien Grisonnet <dgrisonn@redhat.com>
2021-07-01 15:18:12 +02:00
Kubernetes Prow Robot
7cd63baccf
Merge pull request #418 from dgrisonnet/remove-travis
Remove travis in favor of prow.k8s.io
2021-07-01 04:29:54 -07:00
Kubernetes Prow Robot
89425b72cc
Merge pull request #419 from dgrisonnet/default-gcr
Default images to the official k8s.gcr.io and gcr.io registries
2021-07-01 04:25:54 -07:00
Kubernetes Prow Robot
5e59822274
Merge pull request #417 from dgrisonnet/release
RELEASE.md: update with gcr promotion guidelines
2021-07-01 04:15:54 -07:00
Damien Grisonnet
467f24d45c image: default to gcr.io instead of hub.docker.com
Signed-off-by: Damien Grisonnet <dgrisonn@redhat.com>
2021-06-30 19:27:04 +02:00
Damien Grisonnet
231446751c deploy: remove travis in favor of prow.k8s.io
Signed-off-by: Damien Grisonnet <dgrisonn@redhat.com>
2021-06-30 19:19:17 +02:00
Damien Grisonnet
a057c04b09 RELEASE.md: update with gcr promotion guidelines
Signed-off-by: Damien Grisonnet <dgrisonn@redhat.com>
2021-06-30 18:54:15 +02:00
Kubernetes Prow Robot
ae1765153a
Merge pull request #416 from dgrisonnet/cloudbuild
Add cloudbuild.yaml
2021-06-30 06:31:03 -07:00
Kubernetes Prow Robot
e4d11e44e3
Merge pull request #415 from dgrisonnet/container-push
Improve container push rules
2021-06-30 06:27:03 -07:00
Damien Grisonnet
06e41b486c deploy: add cloudbuild.yaml
Add cloudbuild.yaml file required by the image pushing job.

Signed-off-by: Damien Grisonnet <dgrisonn@redhat.com>
2021-06-30 15:07:54 +02:00
Damien Grisonnet
046b970edb deploy: improve container push rules
Improve and cleanup container push rules to prepare for the move to the
official gcr.k8s.io registry.
As part of the improvements, I replaced the non cross platform busybox
image by gcr.io/distroless/static:latest which is platform agnostic.

Signed-off-by: Damien Grisonnet <dgrisonn@redhat.com>
2021-06-30 15:03:49 +02:00
Kubernetes Prow Robot
70418fdbf8
Merge pull request #410 from dgrisonnet/fix-pod-informer
Fix pod lister by running the pod informer
2021-06-07 07:54:40 -07:00
Damien Grisonnet
91b9b7afc2 .travis.yml: update go version to 1.16
Signed-off-by: Damien Grisonnet <dgrisonn@redhat.com>
2021-06-07 16:17:37 +02:00
Damien Grisonnet
152cf3bbaa cmd: run pod informer
Signed-off-by: Damien Grisonnet <dgrisonn@redhat.com>
2021-06-07 16:10:13 +02:00
Kubernetes Prow Robot
407217728b
Merge pull request #407 from dgrisonnet/localvendor
Remove localvendor directory
2021-06-03 08:23:38 -07:00
Kubernetes Prow Robot
82a71ebb6f
Merge pull request #408 from paulfantom/version-file
*: add version file
2021-06-03 07:07:38 -07:00
paulfantom
aae4ef6b51
*: add version file
Signed-off-by: paulfantom <pawel@krupa.net.pl>
2021-06-03 16:02:21 +02:00
Kubernetes Prow Robot
89b6c7e31c
Merge pull request #406 from dgrisonnet/fix-build
Makefile: consolidate docker-build
2021-06-03 06:49:38 -07:00
Kubernetes Prow Robot
a7ff3cb9c2
Merge pull request #405 from dgrisonnet/filter-pods
Filter non-running pods
2021-06-03 06:45:38 -07:00
Damien Grisonnet
ef7bb58ff2 go.mod: remove localvendor
The latest version of metrics-server, v0.5.0 doesn't seem to require
having kubelet dependencies locally anymore. Thus, we can safely remove
the localvendor directory that was used to store them.

Signed-off-by: Damien Grisonnet <dgrisonn@redhat.com>
2021-06-02 17:26:03 +02:00
Damien Grisonnet
03e8eb8ddb Makefile: consolidate docker-build
As part of this commit, I upgraded the golang image used for building to
1.16 and consolidated how the docker-build rule was working. Previously,
it was failing in master's CI because the go modules were not downloaded
in the build image. To improve that, I replaced the combination of
docker run and docker build by a multi-stage Dockerfile responsible for
building the adapter and running it.

In addition to that, I removed the `_output` directory completely as it
wasn't really meaningful to have it anymore. I also removed the
`build-local-image` rule as it was a duplicate of the `docker-build`
rule with the only different of using a scratch base image.

Also, since all the base images that we are using by default are based
on busybox, I change the UID used in the image to 65534 which correspond
to the nobody user in busybox.

Signed-off-by: Damien Grisonnet <dgrisonn@redhat.com>
2021-06-02 17:12:27 +02:00
Damien Grisonnet
cf45915a4a pkg: only account for Pods in running state
Create the pod lister based on a filtered informer factory that will
filter non-running pods so that prometheus-adapter don't expect metrics
from them.

Signed-off-by: Damien Grisonnet <dgrisonn@redhat.com>
2021-06-02 11:38:09 +02:00
Kubernetes Prow Robot
815fa20931
Merge pull request #404 from dgrisonnet/module
Move prometheus-adapter to sigs.k8s.io golang package
2021-06-02 02:30:06 -07:00
Damien Grisonnet
9dfbca09ca go.mod: move to sigs.k8s.io golang package
Signed-off-by: Damien Grisonnet <dgrisonn@redhat.com>
2021-06-01 17:35:45 +02:00
Kubernetes Prow Robot
215cb0c292
Merge pull request #395 from dgrisonnet/panic-ms
Prevent metrics-server panics on GetContainerMetrics and GetNodeMetrics
2021-06-01 07:58:27 -07:00
Damien Grisonnet
76e61d47f6 pkg/resourceprovider: prevent metrics-server panic
The code that we are reusing from metrics-server to call
GetContainerMetrics and GetNodeMetrics requires that both functions
returns arrays of lengths of the number of pods/nodes given as
arguments. In some cases, prometheus-adapter was returning nil which
caused panics in metrics-server code.

Signed-off-by: Damien Grisonnet <dgrisonn@redhat.com>
2021-06-01 16:32:58 +02:00
Kubernetes Prow Robot
09334d3a6d
Merge pull request #399 from dgrisonnet/deps
go.mod: bump dependencies
2021-06-01 07:22:27 -07:00
Damien Grisonnet
c67e8f5956 go.mod: bump dependencies
Signed-off-by: Damien Grisonnet <dgrisonn@redhat.com>
2021-06-01 15:25:56 +02:00
Kubernetes Prow Robot
dd7a263002
Merge pull request #401 from dgrisonnet/vendor
Remove vendor directory
2021-06-01 06:22:27 -07:00
Damien Grisonnet
9148122308 chore: update gitignore
Signed-off-by: Damien Grisonnet <dgrisonn@redhat.com>
2021-05-26 09:45:52 +02:00
Damien Grisonnet
39b782bce9 chore: remove vendor directory
Signed-off-by: Damien Grisonnet <dgrisonn@redhat.com>
2021-05-26 09:41:03 +02:00
Kubernetes Prow Robot
f3aafa7c8f
Merge pull request #400 from dgrisonnet/openapi
hack/tools: remove openapi-gen install in vendor
2021-05-26 00:17:21 -07:00
Damien Grisonnet
7bc0f0473d hack/tools: remove openapi-gen install in vendor
Signed-off-by: Damien Grisonnet <dgrisonn@redhat.com>
2021-05-25 19:13:16 +02:00
Kubernetes Prow Robot
c893b1140c
Merge pull request #380 from carsonoid/issue-324-carsonoid
Allow metrics to be defined as `namespaced: false`
2021-05-12 06:12:17 -07:00
Carson Anderson
6c1d85ccf9 Split ExternalMetricsQuery and MetricsQuery funcs 2021-05-11 14:49:11 -06:00
Carson Anderson
c0ae5d6dd4 fix tests 2021-04-23 11:39:47 -06:00
Carson Anderson
fa5f8cd742 Add requested fixes 2021-04-23 11:27:38 -06:00
Carson Anderson
510c3724ce Add docs, tests, and move namespaced to metricsQuery 2021-04-08 11:07:50 -06:00
Kubernetes Prow Robot
4b40c1796d
Merge pull request #391 from andrewpollack/fix-docu-links-deploy
Updating deploy/README.md to fix links
2021-04-06 01:53:35 -07:00