Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

simonpasquier
Copy link
Contributor

@simonpasquier simonpasquier commented Jun 19, 2025

Description

Closes #6018

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.


@pull-request-size pull-request-size bot added size/L and removed size/M labels Jun 24, 2025
@simonpasquier simonpasquier force-pushed the fix-6018 branch 6 times, most recently from 2ccf24f to cf0f0ec Compare June 25, 2025 11:39
@simonpasquier simonpasquier changed the title test: add end-to-end test for #6018 fix: reconcile workload configurations when a referenced secret/configmap key is updated Jun 25, 2025
@pull-request-size pull-request-size bot added size/XL and removed size/L labels Jul 9, 2025
@simonpasquier simonpasquier force-pushed the fix-6018 branch 6 times, most recently from d348016 to bd62799 Compare July 10, 2025 09:32
@simonpasquier simonpasquier marked this pull request as ready for review July 30, 2025 15:37
@simonpasquier simonpasquier requested a review from a team as a code owner July 30, 2025 15:37
@simonpasquier simonpasquier requested a review from slashpai July 30, 2025 15:37
@simonpasquier simonpasquier force-pushed the fix-6018 branch 2 times, most recently from e24be19 to 175f021 Compare July 31, 2025 12:26
kubeletService: 'kube-system/kubelet',
kubeletEndpointsEnabled: true,
kubeletEndpointSliceEnabled: false,
watchReferencedObjectsInAllNamespaces: true,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IIUC from description of the field this should be false by default?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Correct. If enabled by default, it might create excessive load in existing setups where the operator watches for configuration and workload resources in difference namespaces (e.g. OCP). Still I wanted the E2E tests to run with the flag turned on hence setting the flag to true in the jsonnet and by consequence in examples/rbac/prometheus-operator/prometheus-operator-deployment.yaml. But after more thinking, I might as well tweak the operator's deployment in the e2e framework...

My longer-term plan would be to turn it on by default after a few releases.

Copy link
Contributor

@slashpai slashpai left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Significant fix 🎉

I just had a few questions

logger.Info("Operator's configuration",
"watch_referenced_objects_in_all_namespaces", cfg.WatchObjectRefsInAllNamespaces,
"controller_id", cfg.ControllerID,
"enable_config_reloader_probes", cfg.ReloaderConfig.EnableProbes)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

May be good to add a metric to track reconciliation triggered by referenced objects too?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You mean a different metric than prometheus_operator_triggered_total?

Copy link
Contributor

@slashpai slashpai Aug 1, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I haven't thought much but I was thinking if we could identify a specific secret triggering reconciliation that could help to understand who is culprit incase of excessive API calls? So the metric can have label triggered by:<secret>. If I am not wrong currently we have say only triggered by which controller through prometheus_operator_triggered_total

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

having the secret's name & namespace as labels would be too much in terms of cardinality.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ya you are right :)

}

for _, informer := range informerGetter.GetInformers() {
workloads, err := informer.Lister().List(labels.Everything())
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do we need debug log for error here or would it be noisy?

Copy link
Contributor Author

@simonpasquier simonpasquier Aug 1, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I fear that it would be noisy indeed.
Just for error would be ok but we'd need to pass a logger.

@slashpai
Copy link
Contributor

slashpai commented Aug 1, 2025

lgtm

@simonpasquier simonpasquier merged commit 2414d48 into prometheus-operator:main Aug 1, 2025
23 checks passed
slashpai pushed a commit to slashpai/prometheus-operator that referenced this pull request Sep 19, 2025
fix: reconcile workload configurations when a referenced secret/configmap key is updated
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.

ServiceMonitor using secrets that are created later
2 participants