Class CustomResourceConditions

java.lang.Object
io.strimzi.api.kafka.model.common.CustomResourceConditions

public class CustomResourceConditions extends Object
CustomResourceConditions supplies convenience predicates that are intended to reduce boilerplate code when using fabric8 clients to wait for a CRD to enter some anticipated state. This class provides a generic implementation that can be used internally, public Predicates are exposed on the CRD classes.

An example usage of one of the public predicates (Kafka::isReady):

 Crds.kafkaOperation(client).inNamespace(NAMESPACE).resource(kafka).create();
 Crds.kafkaOperation(client).inNamespace(NAMESPACE).withName(NAME).waitUntilCondition(Kafka.isReady(), 5, TimeUnit.MINUTES);
 
and to wait on a specific KafkaRebalance state using KafkaRebalance::isInState:
 Crds.kafkaRebalanceOperation(client).inNamespace(NAMESPACE).withName(REBALANCE_NAME)
     .waitUntilCondition(KafkaRebalance.isInState(KafkaRebalanceState.ProposalReady), 5, TimeUnit.MINUTES);
 
  • Method Details

    • isReady

      public static <Y extends Status, T extends io.fabric8.kubernetes.client.CustomResource<?, Y>> Predicate<T> isReady()
      Returns a predicate that determines if CRD is ready. A CRD is ready if the observedGeneration of its status is equal to the generation of its metadata and any of the conditions of its status has type:"Ready" and status:"True"
      Returns:
      a predicate that checks if a CRD is ready
    • isLatestGenerationAndAnyConditionMatches

      public static <Y extends Status, T extends io.fabric8.kubernetes.client.CustomResource<?, Y>> Predicate<T> isLatestGenerationAndAnyConditionMatches(String type, String status)
      Checks if the observedGeneration of its status is equal to the generation of its metadata and any of the conditions of its status contains given type and status parameter.
      Type Parameters:
      Y - Type of status
      T - Type of Custom resource
      Parameters:
      type - State of the Custom resource
      status - Status of the Custom resource
      Returns:
      a predicate based on the check