Skip to content
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

Track the reason for object reconciliation #571

Merged
merged 5 commits into from
Jun 30, 2021

Conversation

nightkr
Copy link
Member

@nightkr nightkr commented Jun 29, 2021

See #457 (comment), #423

Generally this only tracks the first reason an object to be reconciled.

@nightkr nightkr added the runtime controller runtime related label Jun 29, 2021
@nightkr nightkr requested review from clux and kazk June 29, 2021 11:23
Copy link
Member

@clux clux left a comment

Choose a reason for hiding this comment

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

this is a really clean way of doing it. looking forward to seeing how the spans look!

left a minor nit on clippy, but can fix that up later, feel free to merge.

@@ -37,6 +37,7 @@ pub struct FooStatus {

fn main() {
println!("Kind {}", FooCrd::kind(&()));
#[allow(clippy::blacklisted_name)]
Copy link
Member

Choose a reason for hiding this comment

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

personally i think we can just hard enable this like it's done in the Makefile tbh; .github/workflows/clippy.yml under the clippy step:

args: -- --allow clippy::blacklisted_name

Copy link
Member Author

Choose a reason for hiding this comment

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

The annoying part there is that it only applies to CI builds. I have Rust-Analyzer set up to watch-run clippy, which wouldn't pick that up.

We could do it with a crate-global #![allow(clippy::blacklisted_name)], but I'm not sure that would be a huge win (it'd still have to be applied separately to each example, kind of going against the whole point).

Comment on lines +74 to +83
jobs.delete("empty-job", &DeleteParams {
dry_run: true,
..DeleteParams::default()
})
.await?;
jobs.delete("empty-job", &DeleteParams {
dry_run: false,
..DeleteParams::default()
})
.await?;
Copy link
Member

Choose a reason for hiding this comment

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

maybe DeleteParams should have builders like ListParams 🤔 . not really a fan of the ..Default for example code for one var change.

kube-core/src/admission.rs Show resolved Hide resolved
kube-runtime/src/controller/mod.rs Show resolved Hide resolved
ReconcilerRequestedRetry,
ErrorPolicyRequestedRetry,
BulkReconcile,
Custom { reason: String },
Copy link
Member

Choose a reason for hiding this comment

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

reasons look sensible. but curious about the Custom one, it's not created anywhere, but presumably intentioned as user-facing? can they be returned from the reconciler?

Copy link
Member Author

@nightkr nightkr Jun 30, 2021

Choose a reason for hiding this comment

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

Yes, if you're using applier then custom trigger functions can inject any reason that it wants to (although it doesn't have to, since we define a ReconcileRequest<K>: From<ObjectRef<K>> that falls back to Unknown).

Maybe Controller::watches should also allow this, actually? Oops, forgot we already know the related object here so there wouldn't be much of a point.

@clux
Copy link
Member

clux commented Jun 30, 2021

this probably closes #457 with all other tasks done.

@clux clux linked an issue Jun 30, 2021 that may be closed by this pull request
3 tasks
@nightkr nightkr merged commit f1b1ced into kube-rs:master Jun 30, 2021
@nightkr nightkr deleted the feature/controller-reconcile-reason branch June 30, 2021 23:20
@clux
Copy link
Member

clux commented Jul 5, 2021

released in 0.58 :-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
runtime controller runtime related
Projects
None yet
Development

Successfully merging this pull request may close these issues.

tracing instrumentation
3 participants