Skip to content

Conversation

@camilamacedo86
Copy link
Contributor

@camilamacedo86 camilamacedo86 commented Nov 20, 2025

Introduces utility functions to format boxcutter reconciliation and teardown reports into concise, human-readable summaries. This makes debugging easier without enabling verbose V(1) logging and solves the scenarios reported over huge logs

Example Scenarios

Scenario 1: Object Collision During Reconcile

What happens: A ServiceAccount already exists and is managed by a different controller.

Controller Logs:

{
  "level": "error",
  "ts": "2025-11-20T14:32:18.445Z",
  "logger": "cluster-extension-revision",
  "msg": "revision reconcile failed",
  "error": "apply failed: server rejected request",
  "summary": "phases with issues: deploy: 2 collision(s): ServiceAccount test-ns/argocd-operator-controller-manager, ServiceAccount test-ns/argocd-operator-metrics-reader; status: incomplete",
  "controller": "clusterextensionrevision",
  "controllerGroup": "olm.operatorframework.io",
  "controllerKind": "ClusterExtensionRevision",
  "ClusterExtensionRevision": {
    "name": "argocd-operator-1"
  },
  "namespace": "",
  "name": "argocd-operator-1",
  "reconcileID": "8f7e3d9a-b2c1-4e5f-a6d7-1c8e9f0a2b3d"
}

Key Information:

  • error: The original error from boxcutter
  • summary: Human-readable explanation showing 2 colliding ServiceAccounts
  • Easy to identify what's blocking the installation

Scenario 2: Multiple Collisions (Shows First 3)

What happens: Many resources collide, but we limit output to first 3.

Controller Logs:

{
  "level": "error",
  "ts": "2025-11-20T14:33:45.678Z",
  "logger": "cluster-extension-revision",
  "msg": "revision reconcile failed",
  "error": "apply failed: multiple conflicts detected",
  "summary": "phases with issues: deploy: 5 collision(s) [showing first 3: ConfigMap test-ns/operator-config, ServiceAccount test-ns/operator-sa, Secret test-ns/operator-token]; status: incomplete",
  "controller": "clusterextensionrevision",
  "ClusterExtensionRevision": {
    "name": "my-operator-1"
  }
}

Key Information:

  • Shows total count (5) but only lists first 3
  • Prevents log spam while still being informative

Scenario 3: Probe Failure During Rollout

What happens: Deployment is created but not becoming ready.

Controller Logs:

{
  "level": "error",
  "ts": "2025-11-20T14:35:22.891Z",
  "logger": "cluster-extension-revision",
  "msg": "revision reconcile failed",
  "error": "rollout incomplete: timeout waiting for resources",
  "summary": "phases with issues: deploy: 1 probe failure(s): Deployment test-ns/argocd-operator-controller-manager probe 'progress' failed; status: in transition",
  "controller": "clusterextensionrevision",
  "controllerGroup": "olm.operatorframework.io",
  "controllerKind": "ClusterExtensionRevision",
  "ClusterExtensionRevision": {
    "name": "argocd-operator-1"
  }
}

Key Information:

  • Identifies which specific Deployment is failing probes
  • Shows the probe name ('progress')
  • Status indicates it's still transitioning

Scenario 4: Validation Error

What happens: Preflight validation fails (e.g., CRD upgrade safety check).

Controller Logs:

{
  "level": "error",
  "ts": "2025-11-20T14:37:10.234Z",
  "logger": "cluster-extension-revision",
  "msg": "revision reconcile failed",
  "error": "validation failed",
  "summary": "validation error: CRD validation failed for CustomResourceDefinition mycrds.example.com; phases with issues: preflight: validation error",
  "controller": "clusterextensionrevision",
  "ClusterExtensionRevision": {
    "name": "example-operator-2"
  }
}

Key Information:

  • Shows validation error at the top level
  • Indicates which phase encountered the validation issue

Scenario 5: Teardown Blocked by Finalizer

What happens: Trying to teardown but resource has blocking finalizer.

Controller Logs:

{
  "level": "error",
  "ts": "2025-11-20T14:38:45.123Z",
  "logger": "cluster-extension-revision",
  "msg": "revision teardown failed",
  "error": "teardown incomplete: resources still exist",
  "summary": "waiting on phases: deploy, cleanup; incomplete phases: deploy; 1 phase(s) completed",
  "controller": "clusterextensionrevision",
  "controllerGroup": "olm.operatorframework.io",
  "controllerKind": "ClusterExtensionRevision",
  "ClusterExtensionRevision": {
    "name": "argocd-operator-1"
  }
}

Key Information:

  • Lists which phases are waiting
  • Shows which phases are incomplete vs completed
  • Helps diagnose stuck teardowns

Scenario 6: Successful Teardown (Info Level)

What happens: Teardown completes successfully.

Controller Logs:

{
  "level": "info",
  "ts": "2025-11-20T14:40:12.567Z",
  "logger": "cluster-extension-revision",
  "msg": "teardown report",
  "report": "teardown completed successfully",
  "controller": "clusterextensionrevision",
  "controllerGroup": "olm.operatorframework.io",
  "controllerKind": "ClusterExtensionRevision",
  "ClusterExtensionRevision": {
    "name": "argocd-operator-1"
  }
}

Key Information:

  • Logged at INFO level (not ERROR)
  • Confirms successful teardown
  • Clean and concise

Scenario 7: Mixed Issues in Multiple Phases

What happens: Multiple phases have different types of issues.

Controller Logs:

{
  "level": "error",
  "ts": "2025-11-20T14:42:30.890Z",
  "logger": "cluster-extension-revision",
  "msg": "revision reconcile failed",
  "error": "multiple failures during rollout",
  "summary": "phases with issues: preflight: validation error, deploy: 1 collision(s): ServiceAccount test-ns/operator-sa, configure: 1 failed object(s): ConfigMap test-ns/config (action: update); status: incomplete",
  "controller": "clusterextensionrevision",
  "ClusterExtensionRevision": {
    "name": "complex-operator-1"
  }
}

Motivation:

https://issues.redhat.com/browse/OCPBUGS-62964

Copilot AI review requested due to automatic review settings November 20, 2025 17:10
@camilamacedo86 camilamacedo86 requested a review from a team as a code owner November 20, 2025 17:10
@openshift-ci openshift-ci bot requested a review from dtfranz November 20, 2025 17:11
@netlify
Copy link

netlify bot commented Nov 20, 2025

Deploy Preview for olmv1 ready!

Name Link
🔨 Latest commit 53634dd
🔍 Latest deploy log https://app.netlify.com/projects/olmv1/deploys/691f4bd96a4c9a00081833b7
😎 Deploy Preview https://deploy-preview-2354--olmv1.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@openshift-ci openshift-ci bot requested a review from perdasilva November 20, 2025 17:11
@openshift-ci
Copy link

openshift-ci bot commented Nov 20, 2025

[APPROVALNOTIFIER] This PR is NOT APPROVED

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

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

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

Introduces utility functions to format boxcutter reconciliation and teardown
reports into concise, human-readable summaries. This makes debugging easier without enabling verbose V(1) logging and solves the scenarios reported over huge logs

Generated-by: Cursor
@camilamacedo86 camilamacedo86 force-pushed the fix-logs-readbale-boxcutter branch from 7033b55 to 53634dd Compare November 20, 2025 17:11
Copilot finished reviewing on behalf of camilamacedo86 November 20, 2025 17:12
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR introduces utility functions to format boxcutter reconciliation and teardown reports into concise, human-readable summaries for improved logging. The change makes debugging easier by providing clear summaries at the standard log level instead of requiring verbose V(1) logging to understand what's happening during reconciliation and teardown operations.

  • Added SummarizeRevisionResult() and SummarizeRevisionTeardownResult() functions to create concise summaries of boxcutter reports
  • Integrated the summarization functions into the controller's error and info logging
  • Provided comprehensive test coverage for various scenarios including collisions, probe failures, validation errors, and teardown states

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.

File Description
internal/operator-controller/util/boxcutter_report.go New utility module with summarization functions for revision results and teardown results, including helper functions for phases and objects
internal/operator-controller/util/boxcutter_report_test.go Comprehensive test suite with mock implementations and test cases covering nil handling, success cases, errors, collisions, probe failures, and teardown scenarios
internal/operator-controller/controllers/clusterextensionrevision_controller.go Updated logging to use the new summarization functions instead of verbose String() output, improving readability at standard log levels

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@codecov
Copy link

codecov bot commented Nov 20, 2025

Codecov Report

❌ Patch coverage is 79.08497% with 32 lines in your changes missing coverage. Please review.
✅ Project coverage is 74.34%. Comparing base (1355ff7) to head (53634dd).

Files with missing lines Patch % Lines
...ernal/operator-controller/util/boxcutter_report.go 79.45% 17 Missing and 13 partials ⚠️
...controllers/clusterextensionrevision_controller.go 71.42% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2354      +/-   ##
==========================================
+ Coverage   74.23%   74.34%   +0.11%     
==========================================
  Files          91       92       +1     
  Lines        7239     7387     +148     
==========================================
+ Hits         5374     5492     +118     
- Misses       1433     1450      +17     
- Partials      432      445      +13     
Flag Coverage Δ
e2e 43.27% <0.00%> (-1.08%) ⬇️
experimental-e2e 48.79% <59.47%> (+0.31%) ⬆️
unit 58.86% <72.54%> (+0.31%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant