Skip to content

Fix blackbox exporter Probe reconciliation flapping#4025

Open
ygalblum wants to merge 1 commit into
red-hat-storage:mainfrom
ygalblum:fix/blackbox-probe-reconcile-flapping
Open

Fix blackbox exporter Probe reconciliation flapping#4025
ygalblum wants to merge 1 commit into
red-hat-storage:mainfrom
ygalblum:fix/blackbox-probe-reconcile-flapping

Conversation

@ygalblum

@ygalblum ygalblum commented Jul 9, 2026

Copy link
Copy Markdown

Summary

The odf-blackbox-exporter Probe is continuously updated every reconcile
cycle (generation 11550+ in ~48h) because controllerutil.CreateOrUpdate
detects a perpetual diff between the desired state and the server-returned
state. Two CRD-defaulted fields cause the drift:

  1. ProberSpec.Path: the Probe CRD defaults this to "/probe", but
    the code never sets it. Each reconcile overwrites "/probe" with "",
    triggering an Update that the API server re-defaults.

  2. bearerTokenSecret: the API server materializes an empty
    {key: "", name: ""} via CRD structural schema defaults for
    SecretKeySelector. The desired spec has this field nil, creating a
    constant diff. prometheus-operator then rejects the Probe with
    "resource name may not be empty".

Changes

  • Explicitly set ProberSpec.Path: "/probe" in the desired Probe spec to
    match the CRD default, eliminating the Path drift.
  • Preserve the server-returned bearerTokenSecret in the mutate function
    when the desired spec does not set one, preventing the nil-vs-empty diff
    from triggering an Update.
  • Update test to assert on the Path value.

Test plan

  • go build ./... — compiles
  • go test ./internal/controller/storagecluster/... -run TestCreateBlackboxProbe — passes
  • go vet ./... — no issues
  • Deploy on a cluster with the blackbox exporter enabled and verify the
    Probe generation counter stabilizes (no longer climbs every reconcile)
  • Verify prometheus-operator no longer logs
    "resource name may not be empty" for the Probe

The odf-blackbox-exporter Probe is continuously updated every reconcile
cycle because controllerutil.CreateOrUpdate detects a perpetual diff
between the desired state and the server-returned state.

Two CRD-defaulted fields cause the drift:

1. ProberSpec.Path: the Probe CRD defaults this to "/probe", but the
   code never sets it. Each reconcile overwrites the server-returned
   "/probe" with the zero value "", triggering an Update that the API
   server re-defaults.

2. bearerTokenSecret: the API server materializes an empty
   {key: "", name: ""} via CRD structural schema defaults for
   SecretKeySelector. The desired spec has this field nil, creating a
   constant diff. prometheus-operator then rejects the Probe with
   "resource name may not be empty".

Fix by explicitly setting Path to "/probe" in the desired spec and
preserving the server-returned bearerTokenSecret in the mutate function
when the desired spec does not set one.

Signed-off-by: Ygal Blum <ygal.blum@gmail.com>
@openshift-ci

openshift-ci Bot commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: ygalblum
Once this PR has been reviewed and has the lgtm label, please assign nb-ohad for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-ci openshift-ci Bot added the needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. label Jul 9, 2026
@openshift-ci

openshift-ci Bot commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

Hi @ygalblum. Thanks for your PR.

I'm waiting for a red-hat-storage member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work.

Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant