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

12 Commits

Author SHA1 Message Date
Simon Pasquier
80553769d5 feat: avoid statefulset's rollout due to new rule configmaps
This commit avoids the situation where the operator would update the
StatefulSet because the concatenation of configured rules exceeds the
maximum ConfigMap size. To alleviate the issue, the operator now
configures the StatefulSet to always mount 3 "rule" ConfigMaps with
"optional: true". When the operator generates an additional ConfigMap,
it will get mounted automatically into the pod and the config-reloader
sidecar will detect and apply the new configuration. When the
number of "concrete" ConfigMaps decreases, the operation is also
non-disruptive.

The number has been chosen arbitrarily and it could change in the future
but 3 seems a good choice (original reports were complaining about the
number of ConfigMaps fluctuating between 1 and 2).

The change applies both to Prometheus and ThanosRuler.

Closes #5085

Signed-off-by: Simon Pasquier <spasquie@redhat.com>
2025-10-15 11:04:23 +02:00
Arthur Silva Sens
bfe114257c Enable revive (#6207)
* Enable revive linter in test/framework

Signed-off-by: Arthur Silva Sens <arthur.sens@coralogix.com>

* Fix revive issues

Signed-off-by: Arthur Silva Sens <arthur.sens@coralogix.com>

---------

Signed-off-by: Arthur Silva Sens <arthur.sens@coralogix.com>
2024-01-15 11:03:57 +01:00
Arthur Silva Sens
0a2b02340a Fully enable depguard (#6103)
Signed-off-by: Arthur Silva Sens <arthur.sens@coralogix.com>
2023-11-17 13:28:48 -03: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
34f15c366c chore: update to Kubernetes v1.27.1 (#5530)
The Kubernetes version used in the e2e tests is v1.26.3 because v1.27.1
doesn't work yet with kind.

Signed-off-by: Simon Pasquier <spasquie@redhat.com>
2023-04-28 14:38:26 +01:00
Jayapriya Pai
822706545b test/framework: Remove context from framework struct
Pass context as argument to methods

Signed-off-by: Jayapriya Pai <slashpai9@gmail.com>
2021-09-27 17:38:52 +05:30
Jayapriya Pai
05a8e6f8cc Remove context.TODO() from client_go function calls (#4104)
* pkg/prometheus/operator.go: Remove context.TODO()

Related to #3158

Signed-off-by: Jayapriya Pai <slashpai9@gmail.com>

* test/framework/*.go: Remove context.TODO()

Propagate context from framework struct instead of using context.TODO()

Related to #3158

Signed-off-by: Jayapriya Pai <slashpai9@gmail.com>

* test/e2e/*.go Remove context.TODO()

Propagate context from Framework struct instead of using context.TODO()

Related to #3158

Signed-off-by: Jayapriya Pai <slashpai9@gmail.com>
2021-06-16 12:17:14 +02:00
Yoni Bettan
be0bf2fc26 Added support for configuring RemoteWrite TLS via Secret or Configmap.
Now we can configure the operator to use mTLS RemoteWrite by referencing
the CA, cert and key directly from k8s Secrets/ConfigMaps.

If the key and the cert are both Secrets, they can exist as a single
Secret which contain both 'cert.pem' and 'key.pem' otherwise they can
exist as 2 different Secrets (or a Secret for the key and ConfigMap for
the cert).

Signed-off-by: Yoni Bettan <ybettan@redhat.com>
2020-07-12 14:42:17 +03:00
Joe Lanford
bfbb40ae56 *: update kubernetes deps to v1.18.2
This commit bumps the kubernetes version dependencies from v1.17
to v1.18.

The kubernetes client-go library introduced breaking
changes in v1.18 by adding context.Context to many of its function
signatures. The kubernetes-sigs/clientgofix tools was used in this
commit to automatically add the necessary context.TODO() arguments
to all client-go usage in the repo.

Fixes #3146
2020-04-21 08:53:31 -04:00
Max Leonard Inden
767c36bb2d prometheus: Use hashstructure package for input checksum
Instead of marshalling all StatefulSet inputs to JSON and hashing that
string, use hashstructure [1] package. In addition do not generate new
rule config maps if underlying rules did not change.

[1] github.com/mitchellh/hashstructure
2018-08-02 19:55:41 +02:00
Max Leonard Inden
06018c0445 prometheus: Split rule config map if it exceeds Kubernetes limit
`k8s.io/api/core/v1.MaxSecretSize` specifies the hard limit Kubernetes
has on the size of config maps [1]. If a set of Prometheus Rule Files
exceeds this limits, they are split onto multiple config maps. If there
is more than one rule config map for a Prometheus, its configuration
secret and its statefulset spec are adjusted accordingly.

The smallest entity to split by is a Prometheus rule file. This patch
does not split an individual rule file, if it exeeds the limit by
itself.

[1] https://github.com/kubernetes/kubernetes/pull/19909/
2018-07-05 16:51:32 +02:00
Max Leonard Inden
89fc4e3069 prometheus: Introduce RuleFile Custom Resource Definition
This patch introduces a new Custom Resource Definition to the
Prometheus Operator - the Rule CRD. It addresses two main
needs:

1. Prometheus (alerting and recording) Rule validation during creation time
via Kubernetes Custom Resource Definition validation.

2. Life-cycle management of Prometheus application Rules alongside the
application itself, inside the applications Kubernetes namespace, not
necessarily the namespace of the scraping Prometheus instance.

A user defines Prometheus alerting and recording Rules via a Kubernetes
Custom Resource Definition. These Custom Resource Definitions can be
fully validated by the Kubernetes API server during creation time via
automatically generated OpenAPI specifications. Instead of the
restriction of a Prometheus instance to only select Rule definitions
inside its own namespace, the Prometheus specification is extended to
also specify namespaces to look for Rule Custom Resource Definitions
outside its own namespace.

---

Dependent technical changes:

- prometheus: Use github.com/jimmidyson/configmap-reload to reload rules

- prometheus: Remove Prometheus Statefulset deletion function. Starting
with K8s >=1.8 this is handled via OwnerReferences.

- prometheus: Do not add rule files checksum to Prometheus configuration
secret

- prometheus: Update StatefulSet only on relevant changes. Instead of
updating the Prometheus StatefulSet on every `sync()` run, only update
it if the input parameters to `makeStatefulSet` change.  Enforce this
via a checksum of the parameters which is saved inside the annotations
of the statefulset.

- e2e/prometheus: Check how often resources (Secret, ConfigMap,
Prometheus CRD, Service) are updated to enforce that Prometheus Operator
only updated created resources if necessary.

- contrib/prometheus-config-reloader: Remove logic to retriev K8s
ConfigMaps. These are mounted into the pod right away now.
2018-05-18 16:27:20 +02:00