Skip to content

Commit b9ed7b1

Browse files
chore(stackable-operator): Demote kube_runtime::controller::Error::QueueError to warning (#1168)
* ci(pre-commit): Don't doc-test dependencies * refactor(stackable-operator): Move report_controller_error logic into the caller * chore(stackable-operator): Demote kube_runtime::controller::Error::QueueError to warning Note: This is because _everything_ was appearing as an error even when it was non-actionable. For example, when the crd maintainer updates the CA bundle on the CRD, the `metadata.resourceVersion changes` as expected. That leads to a controller error. Unfortunately there is currently no good way to discriminate error types. Something might need to be done upstream. * chore: Update changelog --------- Co-authored-by: Techassi <git@techassi.dev>
1 parent 1653faf commit b9ed7b1

3 files changed

Lines changed: 28 additions & 20 deletions

File tree

.pre-commit-config.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,15 +58,15 @@ repos:
5858
- id: cargo-doc-no-default-features
5959
name: cargo-doc-no-default-features
6060
language: system
61-
entry: cargo doc --no-default-features --document-private-items
61+
entry: cargo doc --no-deps --no-default-features --document-private-items
6262
stages: [pre-commit, pre-merge-commit]
6363
pass_filenames: false
6464
files: \.rs$|Cargo\.(toml|lock)
6565

6666
- id: cargo-doc-all-features
6767
name: cargo-doc-all-features
6868
language: system
69-
entry: cargo doc --all-features --document-private-items
69+
entry: cargo doc --no-deps --all-features --document-private-items
7070
stages: [pre-commit, pre-merge-commit]
7171
pass_filenames: false
7272
files: \.rs$|Cargo\.(toml|lock)

crates/stackable-operator/CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,12 @@ All notable changes to this project will be documented in this file.
88

99
- Add CRD established signal/helper ([#1167]).
1010

11+
## Changed
12+
13+
- Demote `kube_runtime::controller::Error::QueueError` to warning ([#1168]).
14+
1115
[#1167]: https://github.com/stackabletech/operator-rs/pull/1167
16+
[#1168]: https://github.com/stackabletech/operator-rs/pull/1168
1217

1318
## [0.107.0] - 2026-03-09
1419

crates/stackable-operator/src/logging/controller.rs

Lines changed: 21 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -61,23 +61,26 @@ pub async fn report_controller_reconciled<K, ReconcileErr, QueueErr>(
6161
"Reconciled object"
6262
);
6363
}
64-
Err(err) => report_controller_error(recorder, controller_name, err).await,
65-
}
66-
}
64+
Err(controller_error) => {
65+
match controller_error {
66+
// Errors raised from queued stuff we will mark as _warning_.
67+
// We can't easily discriminate any further.
68+
controller::Error::QueueError(queue_error) => tracing::warn!(
69+
controller.name = controller_name,
70+
error = queue_error as &dyn std::error::Error,
71+
"Queued reconcile resulted in an error"
72+
),
73+
// Assume others are _error_ level.
74+
// NOTE (@NickLarsenNZ): Keeping the same error message as before,
75+
// but am not sure if it is correct
76+
_ => tracing::error!(
77+
controller.name = controller_name,
78+
error = controller_error as &dyn std::error::Error,
79+
"Failed to reconcile object"
80+
),
81+
};
6782

68-
/// Reports an error to the operator administrator and, if relevant, the end user
69-
async fn report_controller_error<ReconcileErr, QueueErr>(
70-
recorder: &Recorder,
71-
controller_name: &str,
72-
error: &controller::Error<ReconcileErr, QueueErr>,
73-
) where
74-
ReconcileErr: ReconcilerError,
75-
QueueErr: std::error::Error,
76-
{
77-
tracing::error!(
78-
controller.name = controller_name,
79-
error = error as &dyn std::error::Error,
80-
"Failed to reconcile object",
81-
);
82-
publish_controller_error_as_k8s_event(recorder, error).await;
83+
publish_controller_error_as_k8s_event(recorder, controller_error).await;
84+
}
85+
}
8386
}

0 commit comments

Comments
 (0)