Commit graph

66 commits

Author SHA1 Message Date
Damien Grisonnet
aba25ac4aa cmd: fix OpenAPI
Signed-off-by: Damien Grisonnet <dgrisonn@redhat.com>
2024-05-16 14:26:37 +02:00
Kubernetes Prow Robot
b48bff400e
Merge pull request #599 from bogo-y/fix
Fix metric unregistered
2024-03-26 09:15:19 -07:00
machine424
ba77337ae4
Add a toggle to disable HTTP/2 on the server to mitigate CVE-2023-44487
until the Go standard library and golang.org/x/net are fully fixed.
2023-10-30 09:48:56 +01:00
bogo
2a4a4316dd run make update-lint and set EnabledMetrics=false in the server config 2023-10-13 20:14:34 +08:00
bogo
0032610ace change the latency metric and dependency inject prometheus registry 2023-08-29 17:19:47 +08:00
Damien Grisonnet
b50333c035 cmd/adapter: add support for openapi v3
Signed-off-by: Damien Grisonnet <dgrisonn@redhat.com>
2023-06-22 13:52:06 +02:00
Damien Grisonnet
e69388346f *: bump go to 1.20 and k8s deps to 0.27.2
Signed-off-by: Damien Grisonnet <dgrisonn@redhat.com>
2023-06-20 18:39:50 +02:00
Olivier Lemasle
09cc27e609 Refactor adding logging flags 2022-12-05 10:10:51 +01:00
Olivier Lemasle
dc0c0058d0 Set MinVersion: tls.VersionTLS12 in prometheus client's TLSClientConfig
Having no explicit MinVersion is reported by [gosec] as G402 (CWE-295):
`TLS MinVersion too low`

Using MinVersion: tls.VersionTLS12 because it's what client-go uses:
cf 1ac8d45935/transport/transport.go (L92)

That way, the Kubernetes API client and the Prometheus client in
prometheus-adapter use the same TLS config MinVersion.

[gosec]: https://github.com/securego/gosec
2022-11-29 17:24:50 +01:00
Olivier Lemasle
0ea1c1b8d3 Use Golangci-lint 2022-11-28 23:17:16 +01:00
Olivier Lemasle
e740fee947 Fix segfault when using --prometheus-token-file 2022-11-09 18:06:38 +01:00
Damien Grisonnet
303ac6fd45 cmd/adapter: recover klog flags
Signed-off-by: Damien Grisonnet <dgrisonn@redhat.com>
2022-08-12 18:50:41 +02:00
Kubernetes Prow Robot
dd85956fbf
Merge pull request #509 from ksauzz/feature/query-verb
Add --prometheus-verb to support POST requests to prometheus servers
2022-08-12 05:34:43 -07:00
Kazuhiro Suzuki
65abf73917 Update help about --prometheus-verb option 2022-08-12 12:45:22 +09:00
Damien Grisonnet
cca107d97c *: support new MetricsGetter interface
Signed-off-by: Damien Grisonnet <dgrisonn@redhat.com>
2022-08-11 15:04:45 +02:00
Kazuhiro Suzuki
a8742cff28 Add --prometheus-verb to support POST requests to prometheus servers 2022-06-28 18:23:52 +09:00
Leo Lei
bb4722e38b Fix external metrics provider not respecting metrics-max-age 2021-09-24 18:42:24 +08:00
Damien Grisonnet
4eb6c313a1 go.mod: update custom-metrics-apiserver to v1.22.0
Signed-off-by: Damien Grisonnet <dgrisonn@redhat.com>
2021-08-11 13:56:45 +02:00
Kubernetes Prow Robot
eef6b8fef1
Merge pull request #436 from arajkumar/openapi-for-external-and-custom-metrics
fix: add openapi spec for custom and external metrics types
2021-07-19 07:36:52 -07:00
Arunprasad Rajkumar
6cea5b88ca
fix: add openapi spec for custom and external metrics types
Signed-off-by: Arunprasad Rajkumar <arajkuma@redhat.com>
2021-07-19 19:27:43 +05:30
Kubernetes Prow Robot
97236f92ed
Merge pull request #432 from discordianfish/prometheus-request-headers
Support setting headers on requests to Prometheus
2021-07-19 05:34:51 -07:00
Johannes 'fish' Ziemke
d84340cc85 Support setting headers on requests to Prometheus 2021-07-17 14:44:35 +02:00
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
Damien Grisonnet
152cf3bbaa cmd: run pod informer
Signed-off-by: Damien Grisonnet <dgrisonn@redhat.com>
2021-06-07 16:10:13 +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
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
Damien Grisonnet
c67e8f5956 go.mod: bump dependencies
Signed-off-by: Damien Grisonnet <dgrisonn@redhat.com>
2021-06-01 15:25:56 +02:00
Damien Grisonnet
9db8d2f731 cmd/adapter: add signal handler
Add a signal handler stopping the adapter if it receives a SIGINT or
SIGTERM signal. This prevent the prometheus-adapter pod from being stuck
in "Terminating" state.

Signed-off-by: Damien Grisonnet <dgrisonn@redhat.com>
2021-03-29 17:24:49 +02:00
Kubernetes Prow Robot
019a27f200
Merge pull request #354 from iyalang/feature/add-cert-auth
add TLS auth for accessing Prometheus
2021-03-01 05:18:42 -08:00
Iya Lang
808bd76c5a add TLS auth for accessing Prometheus 2021-02-22 21:39:58 +01:00
paulfantom
cd55a67b89
*: move all imports to github.com/kubernetes-sigs/prometheus-adapter
Signed-off-by: paulfantom <pawel@krupa.net.pl>
2021-02-22 15:49:03 +01:00
Sergiusz Urbaniak
752ce84723 cmd/*,pkg/*,docs,go.mod: bump custom-metrics-apiserver, metrics-server 2020-10-28 15:52:12 +01:00
Sergiusz Urbaniak
a858d53495 pkg/*,cmd/*: move to k8s.io/klog/v2 2020-10-28 15:48:05 +01:00
Johannes Würbach
1d44cbbbb8
Serve openapi spec 2020-10-23 11:06:41 +02:00
Sergiusz Urbaniak
2678f90c5e
Merge pull request #230 from weibeld/master
Set --metrics-max-age default value equal to relist interval
2020-09-04 10:02:56 +02:00
Clayton Coleman
c6ac5cbc87
*: Update to sigs.k8s.io/metrics-server latest
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
2020-04-08 11:47:25 -04:00
Daniel Weibel
4788770bf6 Fix formatting 2019-08-14 19:40:37 +02:00
Daniel Weibel
8d8bfc7c33 Set default value of --metrics-max-age equal to --metrics-relist-interval 2019-08-14 18:47:54 +02:00
Sergiusz Urbaniak
f18b6fd370 *: replace glog with klog 2019-04-24 11:04:42 +02:00
Sergiusz Urbaniak
f69586b71c cmd/adapter: fix logs package
... as it moved.

https://github.com/kubernetes/kubernetes/pull/72890
2019-04-24 11:04:42 +02:00
John Delivuk
ff409a0994
Refactoring external to leverage naming 2019-03-26 18:57:02 -04:00
John Delivuk
3f7f249cb8
Removing RestMapper, cleaning up notification hanlder 2019-03-08 13:29:36 -05:00
John Delivuk
ed9eb31b3a
CustomProvider needed to have references updated as well 2019-02-10 19:12:29 -05:00
Solly Ross
c2e176bb23
Merge pull request #158 from linux-on-ibm-z/cross-compile
Edited Makefile to add cross build support for s390x.

Adding External Metrics Provider
2019-02-10 15:59:11 -05:00
Sergiusz Urbaniak
326bf3c276 cmd/adapter: add prometheus bearer token configuration
Often prometheus is gated by some proxy requiring an auth bearer
token. Currently there is no possibility to configure one except for
providing a full-fledged kubeconfig.

This fixes it by adding a new flag pointing to an optional file
containing the auth bearer for prometheus communication.
2018-12-05 11:45:48 +01:00
Solly Ross
99104cba2a
Merge pull request #136 from nilebox/start-flag
Add a separate flag for 'start' parameter
2018-12-04 12:23:26 -08:00
Matthias Loibl
9fb46c3c55
Create a NewCertPool for custom CA certificate 2018-12-03 19:47:37 +01:00
Matthias Loibl
4a16ae6d9a
Log info when successfully loading certificates 2018-12-03 17:57:19 +01:00
Matthias Loibl
bef034e699
Improve error handling in adapter.go 2018-12-03 17:18:53 +01:00
Nail Islamov
88c0ad0b6a
Add validation 2018-11-28 12:20:09 +11:00