1
0
Fork 0
mirror of https://github.com/prometheus-operator/prometheus-operator.git synced 2025-04-16 01:06:27 +00:00
Commit graph

80 commits

Author SHA1 Message Date
paulfantom
35b2954459
pkg/prometheus: remove liveness probe
Removing liveness probe to prevent killing prometheus pod during WAL
replay.

This should be reverted around kubernetes 1.21 release. At that point
startupProbe should be added.
2020-09-15 12:05:18 +02:00
Simon Pasquier
675d303ee0
pkg/prometheus: enable Thanos uploads only when needed (#3485)
When the Thanos spec doesn't configure object storage, there's no need to
configure the Thanos sidecar for block uploads and mount the
Prometheus data volume.

Signed-off-by: Simon Pasquier <spasquie@redhat.com>
2020-09-11 16:16:19 +02:00
Lili Cosic
7b4a9d740d pkg/prometheus/statefulset_test.go: Adjust tests 2020-08-10 14:49:55 +02:00
paulfantom
67780ccc45
repository migration to prometheus-operator organization 2020-08-05 13:13:46 +02:00
Jean-Baptiste Favre
c710ec3e39 Fix Go gormat 2020-07-24 14:14:13 +02:00
Jean-Baptiste Favre
dc2a4527c2 Improve unit tests for Version, Tag & SHA matrix 2020-07-24 14:07:58 +02:00
Miklós Kiss
45de764e39
refactor: decouple pod labels from selector labels (#3294)
* refactor: decouple pod labels from selector labels

prometheus pods can not be rolled out without downtime when label's are changed

Fixes #3120

* chore: run go fmt

* fix unit tests
2020-06-25 10:41:17 +02:00
Paul Gier
01f49eb0a4 types: use custom type for embedded persistent volume claims
This allows nested PersistentVolumeClaim fields to be validated and
maintain metadata information such as labels and annotations.

Signed-off-by: Paul Gier <pgier@redhat.com>
2020-04-28 10:17:34 -05:00
Paul Gier
9d2d9e7ed0 replace ObjectMeta with custom PodMeta type
Recent updates to the CRD generation caused pod labels and annotations
to be lost due to no longer recursing into the ObjectMeta type to gather
all the fields.  This change allows labels and annotations to be preserved in
the custom Promtheus, Alertmanager, and ThanosRuler custom resources.

Fixes #3041
2020-02-27 16:49:45 -06:00
Paul Gier
2fde608b79
Merge pull request #3028 from yeya24/test-ruler
Add some thanos ruler unit tests
2020-02-20 09:00:36 -06:00
Alex Conlin-Oakley
909636703d use t.Log instead of fmt.PrintLn 2020-02-17 16:42:27 +00:00
yeya24
f981936c71 add some thanos ruler unit tests
Signed-off-by: yeya24 <yb532204897@gmail.com>
2020-02-15 11:26:00 -05:00
Elisiano Petrini
752c49e819 prometheus-operator: set config-reloader containers resources
Currently when passing `--config-reloader-(cpu|memory)` values those are
used only for limits. This PR sets the same values for requests.
I wasn't sure if the options for the requests should have been passed
with separate options but I thought this was a good compromise in the
meantime.

The initial question was brought up in https://github.com/coreos/kube-prometheus/issues/376
2020-01-16 08:49:57 +01:00
paulfantom
3c1456eac3
*: switch to upstream jimmidyson/configmap-reload image 2020-01-13 13:17:28 +01:00
Julian Taylor
2aa5bbba08 fix generated statefulset being pruned by kubectl
When the operator transfers all labels and annotations from the source
prometheus object to the generated statefulset this also kubectl managed
annotations.
These annotations will cause the generated statefulset to be pruned when
the source prometheus is applied with kubectl apply --prune.
Cleanup of the statefulset is managed by the garbage collection via
owner references of the prometheus object (which can be pruned).

To fix this do not transfer any kubectl.kubernetes.io/ annotations to
the generated statefulset.

Closes gh-2642

Signed-off-by: Julian Taylor <juliantaylor108@gmail.com>
2020-01-09 18:59:16 +01:00
Karl-Fried Eisenhauer
319ad158f0 operator: modified prometheus wget probe when listenLocal
When using prometheus with listenLocal=true the wget probe in the pod
failed because the created download file prenvents further successfull
wget runs.
Using /dev/null for the wget output file fixes that.

Fixes #2921
2019-12-31 14:20:34 +01:00
Bartlomiej Plotka
78a8889a06
Do not disable compaction on sidecar without object storage configuration (#2845)
* Do not disable compaction on sidecar without object storage configuration.

... as it's not required (:


Also:
* updated Thanos docs!
* added tests
* bumped default image.

Signed-off-by: Bartek Plotka <bwplotka@gmail.com>

* Addressed comments.

Signed-off-by: Bartek Plotka <bwplotka@gmail.com>

* Update pkg/prometheus/statefulset.go

Co-Authored-By: Lili Cosic <cosiclili@gmail.com>

* Reverted prom to 2.7.1

Signed-off-by: Bartek Plotka <bwplotka@gmail.com>
2019-11-04 11:11:09 +00:00
Frederic Branczyk
395c1df715
*: Ensure containers have "FallbackToLogsOnError" termination policy 2019-10-18 11:19:58 +02:00
Max Leonard Inden
fd92cbfe94
pkg/prometheus: Enable users to configure bearer token from secret
To configure a bearer token users could only specify a file path in the
service monitor, pointing to a bearer token file in the Prometheus
container. This enables hostile users, being able to configure a service
monitor and controlling the scrape target, to retrieve arbitrary files
in the Prometheus container.

In cases where users can not be trusted, this patch adds an option to
disallow the above file path specification and replaces it by a secret
reference. This secret has to be in the same namespace as the service
monitor, shrinking the attack vector.

pkg/prometheus: Add option to deny file system access through service monitors

ArbitraryFSAccessThroughSMsConfig enables users to configure, whether
a service monitor selected by the Prometheus instance is allowed to use
arbitrary files on the file system of the Prometheus container. This is
the case when e.g. a service monitor specifies a BearerTokenFile in an
endpoint. A malicious user could create a service monitor
selecting arbitrary secret files in the Prometheus container. Those
secrets would then be send with a scrape request by Prometheus to a
malicious target. Denying the above would prevent the attack, users can
instead use the BearerTokenSecret field.

test/basic-auth-test-app: Add mTLS endpoint

pkg/prometheus: Enable users to configure tls from secret

pkg/prometheus/operator: Validate TLS configs before retrieving assets

Before retrieving TLS assets from Kubernetes secrets for a given service
monitor, make sure the user did not specify both file and secret
reference, e.g. both `CAFile` and `CASecret`.

test: Rename basic-auth-test-app to instrumented-sample-app

Given that the basic-auth-test-app not only supports basic auth, but
also bearer token as well as tls authentication, this patch renames the
app to a more generic name.

test/e2e/prometheus_test: Test ArbitraryFSAccessThroughSM option for tls

The Prometheus custom resource has the option to disable arbitrary
filesystem access configured through service monitors. This commit adds
an end-to-end test for this option in combination with the TLS
configuration via files or secret references in service monitors.

pkg/prometheus/operator: Move check for arbitrary fs access into func
2019-10-07 13:07:05 +02:00
Guy Templeton
67bccfd45b Add ListenLocal option for Thanos spec to listen on local loopback (#2728)
* Add ListenLocal option for Thanos spec to listen on local loopback

Resolves #2435

* Generated files
2019-10-02 18:09:27 +01:00
Matthias Loibl
8011f6364c
Fix TestListenLocal with new liveness and readiness probes 2019-09-23 19:04:55 +02:00
yeya24
a48fa76630 bump thanos image and version
Signed-off-by: yeya24 <yb532204897@gmail.com>
2019-09-03 15:18:50 -04:00
Chris Marchbanks
454962a809
Provide option to turn on WAL compression
Signed-off-by: Chris Marchbanks <csmarchbanks@gmail.com>
2019-07-22 11:44:14 -06:00
Johan Gonzalez
5523368a7f formating 2019-05-16 04:24:25 +00:00
Johan Gonzalez
129e8c019c Support for storage.tsdb.retention.size for prometheus 2.7+ 2019-05-16 03:49:38 +00:00
Matt Matejczyk
bb981fe29f Switch from apps/v1beta to apps/v1
Ref. https://github.com/coreos/prometheus-operator/issues/2592
2019-05-09 12:00:15 +02:00
paulfantom
af2308f7a9
support storage.tsdb.retention.time in prometheus >=2.7.0 2019-05-06 16:33:31 +02:00
Steve Mitchell
7f4045565c pkg/prometheus: add merging of prometheus container specs
Use k8sutil.MergePatchContainers() to patch the "stock" prometheus
stateful set created by the CRD with any additional containers
requested. Additional containers include generated containers like
thanos and user added ones defined by .spec.containers
2019-05-01 09:21:45 +02:00
Steve Mitchell
ad35d199b0 pkg/prometheus: add test case for extra containers
add a very basic test case asserting that additional container specs in
the prometheus crd are added to the statefulset that reflects the
current behavior
2019-05-01 08:41:01 +02:00
Frederic Branczyk
0e403effb0
*: Allow disabling limits on sidecars 2019-04-17 14:16:18 +02:00
Jessie A. Morris
675c9b8b49 Small formatting tweaks 2019-03-18 14:26:06 -06:00
Jessie A. Morris
67b3312686 Change prometheus config reloader to use existing flags 2019-03-18 13:07:47 -06:00
Jessie A. Morris
a7354963ad Fix formatting 2019-03-07 15:47:04 -07:00
Jessie A. Morris
d455cb9595 Add Prometheus Config Reloader CPU and Memory flags 2019-03-07 15:28:30 -07:00
Vasily
b6edff149d
Bump other memory limits to fix tests
Signed-off-by: Vasily <vasily.sliouniaev@jet.com>
2019-02-18 19:34:36 +00:00
Israel Sotomayor
89a6411d4b fix: config reloader memory and cpu as params 2019-02-13 17:04:45 -08:00
Matthias Loibl
70b601607b
pkg/prometheus: Test StatefulSet with new Thanos ObjectStorage field 2019-01-09 15:33:32 +01:00
Frederic Branczyk
888cf1a5c9
*: Add image fields with highest precedence 2019-01-08 11:55:28 +01:00
Matthias Loibl
ee8448fdac
pkg/prometheus: Do not pass podManagementPolicy and stick with Parallel 2018-12-14 11:27:16 +01:00
Sergiusz Urbaniak
3fdfcc7536 pkg,test,cmd: refactor operator code to generated client 2018-11-26 15:59:50 +01:00
Matthias Loibl
fa0a0ae33a
*: Update to Proemtheus v2.5.0 as default 2018-11-07 16:23:50 +01:00
Frederic Branczyk
96c8e901cf
*: Add tests for additional configmaps being mounted. 2018-10-23 17:59:24 +02:00
Manuel Rüger
049c48c931 *: Update to Prometheus v2.4.3 2018-10-09 18:35:29 +02:00
Marcin Jedyk
a614e8f9ea
update Thanos to v0.1.0 https://github.com/improbable-eng/thanos/releases/tag/v0.1.0 2018-09-28 16:05:16 +02:00
Matthias Loibl
3ad93097aa
pkg/prometheus: Use SHA field to create Thanos container in statefulset 2018-09-05 12:22:56 +02:00
Matthias Loibl
0dafdd6ad7
pkg/client: Rename to SHA field in PrometheusSpec 2018-09-04 14:27:12 +02:00
Matthias Loibl
8e9bf6f035
pkg/prometheus: Set image with @sha256 prefix 2018-09-04 14:27:11 +02:00
Matthias Loibl
b1d747bc85
pkg/client: Add sha field to PrometheusSpec 2018-09-04 14:27:11 +02:00
Max Leonard Inden
7a050d711c
Update Prometheus to v2.3.2 and Alertmanager to 0.15.2 2018-08-16 11:05:14 +02:00
Max Leonard Inden
13f97851cd
pkg/*/statefulset.go: Do not mutate shared object
Users have reported high CPU usage of the Prometheus Operator when
adding an annotation to a Prometheus object. The Operator would update
the respective StatefulSet in an infinite loop.

Whether a given StatefulSet needs updating is determined by the hash of
the inputs needed to generate the StatefulSet, which is calculated and
then attached to the StatefulSet as an annotation. On subsequent
reconciliations this hash is compared to the hash of the new inputs.

The function to build the StatefulSet definition is passed the
Prometheus object. This is done by value, not by reference. This does
not enforce a deep copy but merely a shallow copy. In the build function
the new StatefulSet would inherit the annotation map of the Prometheus
object. Next the input hash would be added to this map, resulting in
both the Statefulset having the hash annotation, as intended, as well as
the Prometheus object (same map, shared as a reference).

On subsequent reconciliations the same Prometheus object is used to
calculate the input hash, this time accidentally containing the has
annotation from the previous run. Even though the actual inputs never
changed, this results in a new hash, thereby updating the StatefulSet,
...

The solution is to deep copy the Prometheus object before using it in
the StatefulSet build function, thereby never mutating the annotations
of the Prometheus object. Same measure is taken for the Alertmanager
StatefulSet build function.
2018-08-13 15:11:32 +02:00