condition_changed

Function condition_changed 

Source
pub fn condition_changed(
    existing: &Option<Condition>,
    new_condition: &Condition,
) -> bool
Expand description

Check if a condition has changed compared to the existing status.

This function compares a new condition against an existing condition from the resource’s status. It returns true if the condition has changed and should be updated, or false if it’s unchanged.

A condition is considered changed if:

  • The condition type is different
  • The status value is different (“True” vs “False”)
  • The message is different

The reason and lastTransitionTime are not compared, as these typically change with the condition itself.

§Arguments

  • existing - The existing condition from the resource’s status (if any)
  • new_condition - The new condition to compare against

§Returns

  • true - The condition has changed and should be updated
  • false - The condition is unchanged, skip the update

§Example

let existing = Some(create_condition("Ready", "False", "Pending", "Waiting"));
let new_cond = create_condition("Ready", "True", "Running", "All pods ready");

if condition_changed(&existing, &new_cond) {
    // Update the status
}