1
0
mirror of https://github.com/coreos/prometheus-operator.git synced 2026-02-05 06:45:27 +01:00

66 Commits

Author SHA1 Message Date
dongjiang
83ed01170f Merge pull request #8062 from kubeservice-stack/update-thanos-v0.40.1
chore: Update thanos version to v0.40.1 and golang version to 1.25
2025-11-24 21:35:15 +01:00
dongjiang
0e44c2cd20 chore: Upgrade Go version to v1.24 (#7338)
Signed-off-by: dongjiang <dongjiang1989@126.com>
2025-04-01 10:01:34 +02:00
dongjiang
408e8ebd6e chore: Optimize go runtime metrics (#7081)
* optimize go runtime metrics


---------

Signed-off-by: dongjiang1989 <dongjiang1989@126.com>
2024-11-08 10:53:37 +01:00
Simon Pasquier
5cdab7933f chore: optimize build layers
Signed-off-by: Simon Pasquier <spasquie@redhat.com>
2024-11-06 10:26:28 +01:00
Simon Pasquier
c7e2bd7ff3 fix: pass GOARCH variable to the build stage
Signed-off-by: Simon Pasquier <spasquie@redhat.com>
2024-11-04 17:18:45 +01:00
Simon Pasquier
e27dc7b52c fix: pass the GOARCH variable to the build command
Signed-off-by: Simon Pasquier <spasquie@redhat.com>
2024-11-04 15:34:25 +01:00
Simon Pasquier
fcf21f1d78 fix: fix image builds for non-amd64 architectures
Signed-off-by: Simon Pasquier <spasquie@redhat.com>
2024-11-04 14:06:19 +01:00
Jan Fajerski
79d4b56eb4 Dockerfile: drop double quotes around ARG default values
Afaiu the spec is unclear whether to quote this or not. In this case
here is certainly not requires and works fine without. Additionally,
there is some tooling which does not treat quotes values correctly and
generates image links like
`quay.io/prometheus/golang-builder:\"1.23\"-base`.

Signed-off-by: Jan Fajerski <jfajersk@redhat.com>
2024-10-17 13:24:31 +02:00
Jan Fajerski
46a4ea0b76 build: move build step to Dockerfiles
Signed-off-by: Jan Fajerski <jfajersk@redhat.com>
2024-09-27 09:24:23 +02:00
perebaj
1eb9fd96ce Update exporter toolkit to v0.13.0 2024-09-10 10:35:36 -03:00
perebaj
7b7b3a6476 replace go kit log 2024-07-17 16:54:03 -03:00
Pranshu Srivastava
0002aace2d reloader: don't fail on envvar expansion errors
Refer: https://github.com/thanos-io/thanos/pull/7429
Fixes: https://github.com/prometheus-operator/prometheus-operator/issues/6136
Signed-off-by: Pranshu Srivastava <rexagod@gmail.com>
2024-07-02 20:33:43 +05:30
dongjiang
d5d08c58df feat(env): Add automatic memory limit handling (#6591)
* add auto GOMEMLIMIT

Signed-off-by: dongjiang1989 <dongjiang1989@126.com>


---------

Signed-off-by: dongjiang1989 <dongjiang1989@126.com>
Co-authored-by: Simon Pasquier <spasquie@redhat.com>
2024-05-30 09:13:48 +02:00
Simon Pasquier
98c18408cb feat: add automatic GOMAXPROCS to admission webhook
Signed-off-by: Simon Pasquier <spasquie@redhat.com>
2024-05-21 12:16:06 +02:00
dongjiang
bac5d117fc feat(env): auto set GOMAXPROCS by go.uber.org/automaxprocs (#6576)
---------

Signed-off-by: dongjiang1989 <dongjiang1989@126.com>
2024-05-16 11:17:58 +02:00
dongjiang
ed3aede934 chore: bump to golangci-lint v1.56.2 (#6384)
* update golangci lint version

---------

Signed-off-by: dongjiang1989 <dongjiang1989@126.com>
2024-03-12 11:00:44 +01:00
Simon Pasquier
a143c8da5d feat: enable config reload via signal
This commit adds the option to reload Prometheus configuration using
signal instead of the /-/reload endpoint.

Signed-off-by: Simon Pasquier <spasquie@redhat.com>
2023-11-27 11:17:10 +01:00
Simon Pasquier
5e9eed43e4 chore: reduce code duplication in components
* Share parsing for the logging flags across all binaries.
* Refactor and share the web server implementation between the operator
  and the admission webhook.
* Refactor controller configuration structs to include only the required
  parameters.
* Parse label and field selector arguments early instead of doing it in
  each controller.

Signed-off-by: Simon Pasquier <spasquie@redhat.com>
2023-11-16 14:42:28 +01:00
Pery Lemke
3930fad1a8 [WIP] Change logs to os.Stdout (#6085)
* config-reloader: change stderr to stdout

Changed all stderr logs to stdout and include levels too

* config-reloader: remove comment line

Remove comment live

* promcfg: change stderr to stdout

Changed on line 70 to os.Stdout
2023-11-14 13:46:12 +00:00
dongjiang
dbfcf7a16c feat: Add --web-config-file flag to the config reloader (#6011)
---------

Signed-off-by: dongjiang1989 <dongjiang1989@126.com>
Co-authored-by: Simon Pasquier <spasquie@redhat.com>
2023-11-03 11:13:51 +01:00
Simon Pasquier
12580d663a chore: fix imports order
The commit also enables the gci linter in the golangci-lint
configuration.

Signed-off-by: Simon Pasquier <spasquie@redhat.com>
2023-06-15 10:03:42 +02:00
Simon Pasquier
8318c2e336 chore: use constants for env variables
The SHARD and POD_NAME variables were defined in different places.

Signed-off-by: Simon Pasquier <spasquie@redhat.com>
2023-06-14 11:35:45 +02:00
Simon Pasquier
469ab59d80 cmd/prometheus-config-reloader: add SIGTERM handler (#5617)
When a Prometheus pod is terminated, the container runtime sends a
SIGTERM signal [1] to all pod's containers. Prior this change,
prometheus-config-reloader would return a non-zero exit code in this
case which can lead to the pod being reported as failed for a brief
period of time and create additional work on the statefulset
controller's side. To be a good citizen, prometheus-config-reloader
should handle the signal and return gracefully.

[1] https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle/#pod-termination

Signed-off-by: Simon Pasquier <spasquie@redhat.com>
2023-05-31 15:39:39 +01:00
dongjiang
c7e4d95027 [feat] Add prometheus config reloader livenessProbe & readinessProbe (#5449)
Co-authored-by: Simon Pasquier <spasquie@redhat.com>
2023-04-07 12:53:42 +00:00
Manuel Rüger
a6c59d031a Update gopkg.in/alecthomas/kingpin.v2 to github.com/alecthomas/kingpin/v2
Upstream changed package name, see:
https://github.com/alecthomas/kingpin#overview

Signed-off-by: Manuel Rüger <manuel@rueg.eu>
2023-03-08 16:02:00 +01:00
JHeil
57a3e0c4ac config-reloader: add the reload-timeout argument (#5349)
* config-reloader: add the reload-timeout argument

this new argument enables you to increase (or decrease) the duration for config-reloader to wait after Prometheus' reload

Fixes #5346
2023-02-20 16:54:44 +01:00
Simon Schneider
2dffb2c03e Replace ADD with COPY (#5029)
Its a best practice to use the COPY statement instead of ADD. See https://docs.docker.com/develop/develop-images/dockerfile_best-practices/#add-or-copy for more information
2022-09-19 09:49:47 +00:00
RemcoBuddelmeijer
30b884f3ad prometheus-config-reloader: Set Client Timeout
Set Client Timeout to be equal to Dialer Timeout.
Not using an aggregate of Transport, Dialer and Response timeout.
2022-03-08 10:27:09 +01:00
RemcoBuddelmeijer
5aee971f5a prometheus-config-reloader: Remove fine tuned performance timeouts
Remove timeout for TLS, Connect and Dial.
2022-03-07 16:35:45 +01:00
RemcoBuddelmeijer
b8a976094e prometheus-config-reloader: inline TLS config
Inline TLS config rather than referring to it.
Suggested during PR review.
2022-03-07 14:16:05 +01:00
RemcoBuddelmeijer
b38afd6665 prometheus-config-reloader: add tests for HTTP Client
Add tests for HTTP client new fields.
Still working on transport.DialContext
2022-03-04 15:56:25 +01:00
RemcoBuddelmeijer
6dc462aa13 prometheus-config-reloader: Disable connection pooling
Disable collection pooling and keep alive for TCP.
2022-03-02 17:09:03 +01:00
RemcoBuddelmeijer
feaf9cc22d prometheus-config-reloader: reconstruct Transport configuration
Copy default transport and change values fit for a local setup.
Values can change if seemed necessary.
2022-03-02 16:46:10 +01:00
RemcoBuddelmeijer
a19bfa9e5b prometheus-config-reloader: rename createHttpClient to createHTTPClient
Renaming createHttpClient -> createHTTPClient to be compatible with the linter's
standards.
2022-02-23 20:12:53 +01:00
RemcoBuddelmeijer
2ccddad4b3 prometheus-config-reloader: remove tlsConfig struct
Remove tlsConfig struct in favor of inlining structs with literal
values. The InsecureSkipVerify field is not configurable and as
a result of this it can be set in the construct itself
2022-02-23 18:11:08 +01:00
RemcoBuddelmeijer
f8591aa5f6 prometheus-config-reloader: add test for HttpClient creation
Add test for HttpClient creation to ensure that the outcome is as expected.
Current downside is that the nested structs for Transport are not serialized in
readable format. They still contain the pointer value.
2022-02-23 16:30:16 +01:00
RemcoBuddelmeijer
f66d8351d4 prometheus-config-reloader: rename TlsOptions to tlsOptions
Renamed struct to adhere to the naming conventions for private structs
2022-02-23 16:18:56 +01:00
RemcoBuddelmeijer
f080deffd2 prometheus-config-reloader: remove flag for toggling TLS skip verify
Remove the flag to make TLS skip verify toggleable. Leaving in the option struct.
Now TLS verification will always be skipped with the intent to not support standalone
application setups.
2022-02-23 16:13:20 +01:00
RemcoBuddelmeijer
24338f886a prometheus-config-reloader: add toggle-able skip TLS verify
Add possibility to skip TLS certificate verification with a flag to toggle it
flag by default is false and can be called with insecure-skip-tls-verify
2022-02-23 14:56:37 +01:00
RemcoBuddelmeijer
b3bc5f072c prometheus-config-reloader: set explicit http.Client for reloader
In order for TLS configuration to be changed for the reloader, the HTTPClient
instance must be explicitly created and linked to the reloader instance
2022-02-23 13:47:32 +01:00
Philip Gough
e9861e7bdb Consolidate logging setup into a standalone package (#4445)
* internal: add a package to consolidate logging setup

* cmd:operator: Setup logger via internal package

* cmd:reloader: Setup logger via internal package
2021-12-13 11:09:57 +01:00
Simon Pasquier
f1fed965bb *: switch to github.com/go-kit/log
Using github.com/go-kit/log instead of github.com/go-kit/kit reduces the
list of things this project depends on. This commit also removes the
wrapper for k8s.io/klog because none of the k8s libraries depend on it
anymore.

Signed-off-by: Simon Pasquier <spasquie@redhat.com>
2021-07-22 16:22:28 +02:00
paulfantom
4166f11957 cmd,pkg: fix linter issues 2021-07-05 11:47:01 +02:00
Du Zheng
da8b34ad04 Added init container which applies config file once by setting --watch-interval equals to 0 (#3955)
* Added init container config-reloader with '--watch-interval=0'

* Added parameter 'name' to CreateConfigReloader to differenciate container names used in initContainers and Containers.

* Skip starting metircs server when *watchInterval==0

* Try to fix e2e

* Sync with upstream/master

* Use thanos master

* master -> main

* Trying to address comments as learning

* Fixed lint error

* Bug fixes

* clean up and aodpt new CreateConfigReloader

* Added unit tests

* Address comments

* Clean up

* thanos -> v0.20.0

* Address comments.

* Fixed lint failure.

* E2E trigger

* Timeout 55m -> 100m

* thanos -> v0.20.1

* Increase poll timeout to 10 minutes.

* Rename and remove enlarged timeout.

* Added TestConfigReloader to stateful_test of alertmanager and prometheus.

* Add config-reloader initContainer to alertmanager.

* 5 min -> 10 min

* -> 5mins

* 5min -> 10min

* 55m -> 11m

* -> 55m

* More doc string

* rm init-config-reloader from alartmanager operator and align init-containers doc string with containers doc string in PrometheusSpec.

* Update go.sum

* fix ci-failure

* Added impacted files for doc string updates.
2021-06-10 09:21:15 +02:00
Simon Pasquier
25e085a357 *: fix golint errors (#3924)
Also fix the missing Thanos Ruler and Alertmanager collector metrics.

Signed-off-by: Simon Pasquier <spasquie@redhat.com>
2021-03-23 11:21:14 +01:00
Simon Pasquier
87747de0e0 Update cmd/prometheus-config-reloader/main.go 2020-12-10 09:43:19 +01:00
fengshuaitao
7c15bf15bd log error when reloader watching file failed 2020-12-08 12:37:17 +08:00
Mateusz Szostok
2fda6f185b Add more descriptive binary version information (#3592)
* Add more descriptive binary version information

It is inspired by the Prometheus implementation and fully compatible with it:
https://github.com/prometheus/common/blob/v0.14.0/version/info.go

* Use the promethus common library
2020-10-21 09:46:45 +02:00
Simon Pasquier
dcf34c55bc *: use a single reloader for Prometheus
This change gets rid of the additional reloader that was deployed in the
Prometheus pod to monitor rules file.

It also changes the Alertmanager and Thanos ruler statefulsets to use
the container image from the `--prometheus-config-reloader` flag instead
of `--config-reloader-image`. We pick `prometheus-config-reloader`
because it supports gzipped configuration file and is "smarter" about
when to reload the configuration (e.g. it checks that the content on
disk has effectively changed before reloading).

The `--config-reloader-image` of Prometheus operator is deprecated (e.g.
it isn't used anywhere by the operator) and it may be removed in a
future release (but not before v0.45).

Since the Prometheus config reloader doesn't watch only rule directories
anymore (e.g. for Alertmanager it watches mounted secrets), it gets a
new `--watched-dir` flag that replaces the `--rules-dir` flag.

Finally the config reloader can be configured to expose metrics with the
`--listen-address` flag. The metrics are:
* `reloader_config_apply_operations_failed_total`
* `reloader_config_apply_operations_total`
* `reloader_reloads_failed_total`
* `reloader_reloads_total`
* `reloader_watch_errors_total`
* `reloader_watches`
* `reloader_watch_events_total`

Signed-off-by: Simon Pasquier <spasquie@redhat.com>
2020-09-25 17:21:02 +02:00
paulfantom
67780ccc45 repository migration to prometheus-operator organization 2020-08-05 13:13:46 +02:00