Expand description
§kube-condition
Runtime support for mapping Rust errors to Kubernetes status conditions.
This crate provides:
- The
StatusConditiontrait for error types - Condition builders and update helpers
- A reconcile wrapper that automatically updates status on errors
§Usage
ⓘ
use kube_condition::{StatusCondition, ConditionExt};
use thiserror::Error;
#[derive(Error, Debug, StatusCondition)]
#[condition(default_type = "Ready")]
pub enum MyError {
#[error("Something went wrong: {0}")]
#[condition(reason = "SomethingFailed", retryable = true)]
Something(String),
}Macros§
- reconcile_
with_ status - Macro to create a reconcile wrapper with status updates
Structs§
- Condition
Builder - Builder for custom condition types
- Condition
Info - Intermediate condition info before converting to k8s Condition
- Ready
Condition - Builder for creating “ready” conditions
- Reconcile
Context - Context for the reconcile wrapper
Enums§
- Severity
- Severity level for conditions, useful for observability and alerting
Constants§
- CONDITION_
REASON_ PROGRESSING - Reason when reconciliation is in progress
- CONDITION_
REASON_ RECONCILE_ SUCCEEDED - Reason when reconciliation succeeds
- CONDITION_
STATUS_ FALSE - Condition status “False”
- CONDITION_
STATUS_ TRUE - Condition status “True”
- CONDITION_
STATUS_ UNKNOWN - Condition status “Unknown”
- CONDITION_
TYPE_ AVAILABLE - Standard “Available” condition type
- CONDITION_
TYPE_ DEGRADED - Standard “Degraded” condition type
- CONDITION_
TYPE_ PROGRESSING - Standard “Progressing” condition type
- CONDITION_
TYPE_ READY - Standard “Ready” condition type
- DEFAULT_
NON_ RETRYABLE_ REQUEUE_ SECONDS - Default requeue duration for non-retryable errors (longer backoff)
- DEFAULT_
REQUEUE_ SECONDS - Default requeue duration in seconds for retryable errors
- FIELD_
MANAGER_ NAME - Field manager name used for patch operations
Traits§
- Condition
Ext - Extension trait for resources with status conditions
- Reconcile
Ext - Extension trait for wrapping reconcile functions with automatic status updates
- Status
Condition - Trait for errors that can be mapped to Kubernetes status conditions.
Functions§
- error_
condition - Create an error condition with Ready=False
- ready_
condition - Create a Ready=True condition
- reconcile_
with_ status - Reconcile result wrapper that handles status updates automatically
Derive Macros§
- Status
Condition - Derive macro for mapping error types to Kubernetes status conditions.