Skip to content

OCPBUGS-100067: Deduplicate unchanged status upgrade events - #1526

Merged
stbenjam merged 1 commit into
openshift:mainfrom
stbenjam:agent/ocpbugs-100067-deduplicate-status-upgrade-events
Jul 29, 2026
Merged

OCPBUGS-100067: Deduplicate unchanged status upgrade events#1526
stbenjam merged 1 commit into
openshift:mainfrom
stbenjam:agent/ocpbugs-100067-deduplicate-status-upgrade-events

Conversation

@stbenjam

@stbenjam stbenjam commented Jul 28, 2026

Copy link
Copy Markdown
Member

What

  • Emit Status upgrade only when the Progressing status, reason, or message changes.
  • Continue syncing the ClusterOperator conditions on every reconciliation.
  • Cover initial upgrade entry, an identical repeated sync, a changed target, and re-entry after becoming available.

Why

During a slow SNO upgrade rollout, MAO reconciles approximately every five seconds and currently emits the same Status upgrade Kubernetes Event each time. Nine of ten jobs for 5.0.0-0.nightly-2026-07-28-003649 recorded the identical event 25 times and failed the pathological-event invariant, although the upgrades completed successfully.

The ClusterOperator condition is the durable representation of an ongoing upgrade. Repeated reconciliations of that unchanged condition should not create new occurrence Events.

Bug: https://issues.redhat.com/browse/OCPBUGS-100067

Validation

  • go test ./pkg/operator
  • make lint
  • make test

Summary by CodeRabbit

  • Bug Fixes

    • Reduced duplicate “Status upgrade” notifications when the operator’s progressing status has not changed.
    • Progress updates now generate notifications only when relevant status details change, making upgrade activity clearer.
    • Notifications continue to appear when the desired version changes or the operator transitions to a new progressing state.
  • Tests

    • Added coverage to verify notification behavior across repeated updates and version changes.

Signed-off-by: Stephen Benjamin <stephen@redhat.com>
@openshift-ci-robot openshift-ci-robot added jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. jira/invalid-bug Indicates that a referenced Jira bug is invalid for the branch this PR is targeting. labels Jul 28, 2026
@openshift-ci-robot

Copy link
Copy Markdown
Contributor

@stbenjam: This pull request references Jira Issue OCPBUGS-100067, which is invalid:

  • expected the bug to target the "5.0.0" version, but no target version was set

Comment /jira refresh to re-evaluate validity if changes to the Jira bug are made, or edit the title of this pull request to link to a different bug.

The bug has been updated to refer to the pull request using the external bug tracker.

Details

In response to this:

What

  • Emit Status upgrade only when the Progressing status, reason, or message changes.
  • Continue syncing the ClusterOperator conditions on every reconciliation.
  • Cover initial upgrade entry, an identical repeated sync, a changed target, and re-entry after becoming available.

Why

During a slow SNO upgrade rollout, MAO reconciles approximately every five seconds and currently emits the same Status upgrade Kubernetes Event each time. Nine of ten jobs for 5.0.0-0.nightly-2026-07-28-003649 recorded the identical event 25 times and failed the pathological-event invariant, although the upgrades completed successfully.

The ClusterOperator condition is the durable representation of an ongoing upgrade. Repeated reconciliations of that unchanged condition should not create new occurrence Events.

Bug: https://issues.redhat.com/browse/OCPBUGS-100067

Validation

  • go test ./pkg/operator
  • make lint
  • make test

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 openshift-eng/jira-lifecycle-plugin repository.

@coderabbitai

coderabbitai Bot commented Jul 28, 2026

Copy link
Copy Markdown

Walkthrough

The operator now emits “Status upgrade” events only when the progressing condition’s status, reason, or message changes. A unit test covers initial emission, suppression of duplicate events, version updates, and transitions through availability.

Changes

Progressing event deduplication

Layer / File(s) Summary
Condition-change event handling
pkg/operator/status.go, pkg/operator/status_test.go
statusProgressing compares the computed progressing condition with the existing condition before recording an event, while tests verify events for initial and changed states and suppress duplicates.

Estimated code review effort: 2 (Simple) | ~10 minutes

🚥 Pre-merge checks | ✅ 15
✅ Passed checks (15 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Stable And Deterministic Test Names ✅ Passed No Ginkgo titles with dynamic data were added; the new test name is static and deterministic.
Test Structure And Quality ✅ Passed New test is a focused unit test, uses fake clients/recorder like nearby tests, has a bounded event wait, and introduces no cleanup or Ginkgo-pattern issues.
Microshift Test Compatibility ✅ Passed No new Ginkgo e2e tests were added; the change is limited to Go unit tests and status logic, so MicroShift compatibility checks are not applicable.
Single Node Openshift (Sno) Test Compatibility ✅ Passed PASS: The added test is a plain unit test (TestOperatorStatusProgressingEvents), not a Ginkgo e2e test, and it has no node/topology assumptions.
Topology-Aware Scheduling Compatibility ✅ Passed Only status event/condition logic changed; no replicas, affinities, node selectors, tolerations, or topology-based scheduling were added.
Ote Binary Stdout Contract ✅ Passed The PR only changes operator status logic and a unit test; it adds no main/init/TestMain/suite stdout writes or new stdout logging paths.
Ipv6 And Disconnected Network Test Compatibility ✅ Passed No Ginkgo/e2e tests were added; status_test.go is a unit test with fake client/recorder and no IPv4 or external connectivity assumptions.
No-Weak-Crypto ✅ Passed Touched code only adjusts status/event emission and tests; no weak ciphers, custom crypto, or secret/token comparisons were introduced.
Container-Privileges ✅ Passed Only Go status logic/tests changed; no container/K8s manifests or privilege settings (privileged, hostPID, hostNetwork, hostIPC, SYS_ADMIN, allowPrivilegeEscalation) were added.
No-Sensitive-Data-In-Logs ✅ Passed No passwords, tokens, PII, hostnames, or customer data are logged; new output is only static status text plus operand version strings.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the main change: suppressing duplicate status upgrade events when nothing changed.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Comment @coderabbitai help to get the list of available commands.

@openshift-ci openshift-ci Bot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Jul 28, 2026
@openshift-ci

openshift-ci Bot commented Jul 28, 2026

Copy link
Copy Markdown
Contributor

Skipping CI for Draft Pull Request.
If you want CI signal for your change, please convert it to an actual PR.
You can still manually trigger a test run with /test all

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@pkg/operator/status_test.go`:
- Around line 193-196: Update the test around statusAvailable and
statusProgressing to assert the expected availability state immediately after
statusAvailable("") succeeds, before changing optr.operandVersions[0].Version.
Then retain the existing version change and progressing assertion to verify
re-entry after availability rather than only the changed Progressing message.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository: openshift/coderabbit/.coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: 1e394fb1-60f0-49fc-84ba-7a5628238c9c

📥 Commits

Reviewing files that changed from the base of the PR and between c24b61e and a1a2219.

📒 Files selected for processing (2)
  • pkg/operator/status.go
  • pkg/operator/status_test.go

Comment thread pkg/operator/status_test.go
@stbenjam
stbenjam marked this pull request as ready for review July 28, 2026 15:22
@openshift-ci openshift-ci Bot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Jul 28, 2026
@openshift-ci
openshift-ci Bot requested review from damdo and mdbooth July 28, 2026 15:26
@stbenjam

Copy link
Copy Markdown
Member Author

/jira refresh

@openshift-ci-robot

Copy link
Copy Markdown
Contributor

@stbenjam: This pull request references Jira Issue OCPBUGS-100067, which is invalid:

  • expected the bug to target the "5.0.0" version, but no target version was set

Comment /jira refresh to re-evaluate validity if changes to the Jira bug are made, or edit the title of this pull request to link to a different bug.

Details

In response to this:

/jira refresh

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 openshift-eng/jira-lifecycle-plugin repository.

@stbenjam

Copy link
Copy Markdown
Member Author

/jira refresh

@openshift-ci-robot

Copy link
Copy Markdown
Contributor

@stbenjam: This pull request references Jira Issue OCPBUGS-100067, which is invalid:

  • expected the bug to target the "5.0.0" version, but no target version was set

Comment /jira refresh to re-evaluate validity if changes to the Jira bug are made, or edit the title of this pull request to link to a different bug.

Details

In response to this:

/jira refresh

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 openshift-eng/jira-lifecycle-plugin repository.

@stbenjam

Copy link
Copy Markdown
Member Author

/jira refresh

@openshift-ci-robot

Copy link
Copy Markdown
Contributor

@stbenjam: This pull request references Jira Issue OCPBUGS-100067, which is invalid:

  • expected the bug to target the "5.0.0" version, but no target version was set

Comment /jira refresh to re-evaluate validity if changes to the Jira bug are made, or edit the title of this pull request to link to a different bug.

Details

In response to this:

/jira refresh

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 openshift-eng/jira-lifecycle-plugin repository.

@stbenjam

Copy link
Copy Markdown
Member Author

/jira refresh

@openshift-ci-robot openshift-ci-robot added jira/valid-bug Indicates that a referenced Jira bug is valid for the branch this PR is targeting. and removed jira/invalid-bug Indicates that a referenced Jira bug is invalid for the branch this PR is targeting. labels Jul 28, 2026
@openshift-ci-robot

Copy link
Copy Markdown
Contributor

@stbenjam: This pull request references Jira Issue OCPBUGS-100067, which is valid. The bug has been moved to the POST state.

3 validation(s) were run on this bug
  • bug is open, matching expected state (open)
  • bug target version (5.0.0) matches configured target version for branch (5.0.0)
  • bug is in the state New, which is one of the valid states (NEW, ASSIGNED, POST)
Details

In response to this:

/jira refresh

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 openshift-eng/jira-lifecycle-plugin repository.

@wking wking left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

e2e-aws-ovn-upgrade looks beautiful for the fix as far as the incoming machine-api-operator-77749d4fc is concerned (the outgoing machine-api-operator-ff54974b7 still struggles, but this patch isn't getting into that outgoing operator):

$ curl -s https://gcsweb-ci.apps.ci.l2s4.p1.openshiftapps.com/gcs/test-platform-results/pr-logs/pull/openshift_machine-api-operator/1526/pull-ci-openshift-machine-api-operator-main-e2e-aws-ovn-upgrade/2082126574756302848/artifacts/e2e-aws-ovn-upgrade/gather-extra/artifacts/events.json | jq -r '[.items[] | (.firstTimestamp // .eventTinme // .metadata.creationTimestamp) + " " + (.count | tostring) + " " + (.lastTimestamp // "-") + " " + .metadata.namespace + " " + (.involvedObject | .kind + " " + .name) + " " + .reason + ": " + .message] | sort[]' | grep Progressing | grep machine-api
2026-07-28T16:02:41Z 25 2026-07-28T16:07:18Z default ClusterOperator machine-api Status upgrade: Progressing towards operator: 5.0.0-0.ci-2026-07-28-153051-test-ci-op-l0n3k01i-initial
2026-07-28T16:49:42Z 1 2026-07-28T16:49:42Z default ClusterOperator machine-api Status upgrade: Progressing towards operator: 5.0.0-0.ci-2026-07-28-153052-test-ci-op-l0n3k01i-latest
$ curl -s https://gcsweb-ci.apps.ci.l2s4.p1.openshiftapps.com/gcs/test-platform-results/pr-logs/pull/openshift_machine-api-operator/1526/pull-ci-openshift-machine-api-operator-main-e2e-aws-ovn-upgrade/2082126574756302848/artifacts/e2e-aws-ovn-upgrade/gather-extra/artifacts/events.json | jq -r '[.items[] | (.firstTimestamp // .eventTinme // .metadata.creationTimestamp) + " " + (.count | tostring) + " " + (.lastTimestamp // "-") + " " + (.involvedObject | .kind + " " + .name) + " " + .reason + ": " + .message] | sort[]' | grep 'machine-api-operator.*Created'
2026-07-28T15:58:02Z 1 2026-07-28T15:58:02Z ReplicaSet machine-api-operator-ff54974b7 SuccessfulCreate: Created pod: machine-api-operator-ff54974b7-w9tnz
2026-07-28T16:02:41Z 1 2026-07-28T16:02:41Z Pod machine-api-operator-ff54974b7-w9tnz Created: Container created
2026-07-28T16:46:52Z 1 2026-07-28T16:46:52Z ReplicaSet machine-api-operator-77749d4fc SuccessfulCreate: Created pod: machine-api-operator-77749d4fc-spxcz
2026-07-28T16:47:02Z 1 2026-07-28T16:47:02Z Pod machine-api-operator-77749d4fc-spxcz Created: Container created

/lgtm

@openshift-ci openshift-ci Bot added the lgtm Indicates that a PR is ready to be merged. label Jul 28, 2026
@stbenjam

Copy link
Copy Markdown
Member Author

/retest-required

@nrb

nrb commented Jul 28, 2026

Copy link
Copy Markdown
Contributor

/approve

@openshift-ci

openshift-ci Bot commented Jul 28, 2026

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: nrb

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

The pull request process is described 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 approved Indicates a PR has been approved by an approver from all required OWNERS files. label Jul 28, 2026
@stbenjam

Copy link
Copy Markdown
Member Author

/verified by CI

@openshift-ci-robot openshift-ci-robot added the verified Signifies that the PR passed pre-merge verification criteria label Jul 28, 2026
@openshift-ci-robot

Copy link
Copy Markdown
Contributor

@stbenjam: This PR has been marked as verified by CI.

Details

In response to this:

/verified by CI

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 openshift-eng/jira-lifecycle-plugin repository.

@stbenjam

Copy link
Copy Markdown
Member Author

/override ci/prow/e2e-metal-ipi-virtualmedia
/override ci/prow/e2e-metal-ipi-virtualmedia

We need this to restore payloads, I don't think the metal failures are related. virtualmedia installed, test failure unrelated. IPv6 is build cluster issues.

@openshift-ci

openshift-ci Bot commented Jul 29, 2026

Copy link
Copy Markdown
Contributor

@stbenjam: Overrode contexts on behalf of stbenjam: ci/prow/e2e-metal-ipi-virtualmedia

Details

In response to this:

/override ci/prow/e2e-metal-ipi-virtualmedia
/override ci/prow/e2e-metal-ipi-virtualmedia

We need this to restore payloads, I don't think the metal failures are related. virtualmedia installed, test failure unrelated. IPv6 is build cluster issues.

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.

@stbenjam

Copy link
Copy Markdown
Member Author

/override ci/prow/e2e-metal-ipi-ovn-ipv6

@openshift-ci

openshift-ci Bot commented Jul 29, 2026

Copy link
Copy Markdown
Contributor

@stbenjam: Overrode contexts on behalf of stbenjam: ci/prow/e2e-metal-ipi-ovn-ipv6

Details

In response to this:

/override ci/prow/e2e-metal-ipi-ovn-ipv6

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.

@stbenjam

Copy link
Copy Markdown
Member Author

/override ci/prow/e2e-aws-operator
/override ci/prow/e2e-aws-ovn
/override ci/prow/e2e-aws-ovn-upgrade
/override ci/prow/e2e-metal-ipi

@openshift-ci

openshift-ci Bot commented Jul 29, 2026

Copy link
Copy Markdown
Contributor

@stbenjam: Overrode contexts on behalf of stbenjam: ci/prow/e2e-aws-operator, ci/prow/e2e-aws-ovn, ci/prow/e2e-aws-ovn-upgrade, ci/prow/e2e-metal-ipi

Details

In response to this:

/override ci/prow/e2e-aws-operator
/override ci/prow/e2e-aws-ovn
/override ci/prow/e2e-aws-ovn-upgrade
/override ci/prow/e2e-metal-ipi

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.

@stbenjam

Copy link
Copy Markdown
Member Author

/override ci/prow/okd-scos-images

@openshift-ci

openshift-ci Bot commented Jul 29, 2026

Copy link
Copy Markdown
Contributor

@stbenjam: Overrode contexts on behalf of stbenjam: ci/prow/okd-scos-images

Details

In response to this:

/override ci/prow/okd-scos-images

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.

@stbenjam
stbenjam merged commit 197b5bb into openshift:main Jul 29, 2026
15 of 16 checks passed
@openshift-ci-robot

Copy link
Copy Markdown
Contributor

@stbenjam: Jira Issue Verification Checks: Jira Issue OCPBUGS-100067
✔️ This pull request was pre-merge verified.
✔️ All associated pull requests have merged.
✔️ All associated, merged pull requests were pre-merge verified.

Jira Issue OCPBUGS-100067 has been moved to the MODIFIED state and will move to the VERIFIED state when the change is available in an accepted nightly payload. 🕓

Details

In response to this:

What

  • Emit Status upgrade only when the Progressing status, reason, or message changes.
  • Continue syncing the ClusterOperator conditions on every reconciliation.
  • Cover initial upgrade entry, an identical repeated sync, a changed target, and re-entry after becoming available.

Why

During a slow SNO upgrade rollout, MAO reconciles approximately every five seconds and currently emits the same Status upgrade Kubernetes Event each time. Nine of ten jobs for 5.0.0-0.nightly-2026-07-28-003649 recorded the identical event 25 times and failed the pathological-event invariant, although the upgrades completed successfully.

The ClusterOperator condition is the durable representation of an ongoing upgrade. Repeated reconciliations of that unchanged condition should not create new occurrence Events.

Bug: https://issues.redhat.com/browse/OCPBUGS-100067

Validation

  • go test ./pkg/operator
  • make lint
  • make test

Summary by CodeRabbit

  • Bug Fixes

  • Reduced duplicate “Status upgrade” notifications when the operator’s progressing status has not changed.

  • Progress updates now generate notifications only when relevant status details change, making upgrade activity clearer.

  • Notifications continue to appear when the desired version changes or the operator transitions to a new progressing state.

  • Tests

  • Added coverage to verify notification behavior across repeated updates and version changes.

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 openshift-eng/jira-lifecycle-plugin repository.

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

Labels

approved Indicates a PR has been approved by an approver from all required OWNERS files. jira/valid-bug Indicates that a referenced Jira bug is valid for the branch this PR is targeting. jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. lgtm Indicates that a PR is ready to be merged. verified Signifies that the PR passed pre-merge verification criteria

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants