create_condition

Function create_condition 

Source
pub fn create_condition(
    condition_type: &str,
    status: &str,
    reason: &str,
    message: &str,
) -> Condition
Expand description

Create a new Kubernetes condition with the current timestamp.

This is a convenience function for creating conditions that follow Kubernetes conventions. The lastTransitionTime is automatically set to the current time.

§Arguments

  • condition_type - The type of condition (e.g., “Ready”, “Progressing”)
  • status - The status: “True”, “False”, or “Unknown”
  • reason - A programmatic identifier in CamelCase (e.g., “DeploymentReady”)
  • message - A human-readable explanation

§Returns

A new Condition with the current timestamp.

§Example

let condition = create_condition(
    "Ready",
    "True",
    "AllPodsRunning",
    "All 3 pods are running and ready"
);
assert_eq!(condition.r#type, "Ready");
assert_eq!(condition.status, "True");