Skip to content

feat: avoid statefulset's rollout due to new rule configmaps#8010

Merged
simonpasquier merged 1 commit intoprometheus-operator:mainfrom
simonpasquier:fix-5085-2
Oct 16, 2025
Merged

feat: avoid statefulset's rollout due to new rule configmaps#8010
simonpasquier merged 1 commit intoprometheus-operator:mainfrom
simonpasquier:fix-5085-2

Conversation

@simonpasquier
Copy link
Contributor

@simonpasquier simonpasquier commented Oct 9, 2025

Description

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

Type of change

What type of changes does your code introduce to the Prometheus operator? Put an x in the box that apply.

  • CHANGE (fix or feature that would cause existing functionality to not work as expected)
  • FEATURE (non-breaking change which adds functionality)
  • BUGFIX (non-breaking change which fixes an issue)
  • ENHANCEMENT (non-breaking change which improves existing functionality)
  • NONE (if none of the other choices apply. Example, tooling, build system, CI, docs, etc.)

Verification

Please check the Prometheus-Operator testing guidelines for recommendations about automated tests.

Changelog entry

Please put a one-line changelog entry below. This will be copied to the changelog file during the release process.


@simonpasquier simonpasquier marked this pull request as ready for review October 10, 2025 07:13
@simonpasquier simonpasquier requested a review from a team as a code owner October 10, 2025 07:13
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 prometheus-operator#5085

Signed-off-by: Simon Pasquier <spasquie@redhat.com>
@simonpasquier simonpasquier merged commit 79fb2e3 into prometheus-operator:main Oct 16, 2025
22 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Avoid pod restarts when the number of rule configmaps fluctuates back and forth

2 participants