-
Notifications
You must be signed in to change notification settings - Fork 68
✨ Add human-readable boxcutter report summaries to logs #2354
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
✨ Add human-readable boxcutter report summaries to logs #2354
Conversation
✅ Deploy Preview for olmv1 ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: 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 |
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
7033b55 to
53634dd
Compare
There was a problem hiding this 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()andSummarizeRevisionTeardownResult()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 Report❌ Patch coverage is 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
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
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 boxcuttersummary: Human-readable explanation showing 2 colliding ServiceAccountsScenario 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:
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:
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:
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:
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:
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