Search in sources :

Example 21 with KafkaRebalanceStatus

use of io.strimzi.api.kafka.model.status.KafkaRebalanceStatus in project strimzi-kafka-operator by strimzi.

the class CruiseControlST method testCruiseControlIntraBrokerBalancingWithoutSpecifyingJBODStorage.

@ParallelNamespaceTest
void testCruiseControlIntraBrokerBalancingWithoutSpecifyingJBODStorage(ExtensionContext extensionContext) {
    final TestStorage testStorage = new TestStorage(extensionContext);
    resourceManager.createResource(extensionContext, KafkaTemplates.kafkaWithCruiseControl(testStorage.getClusterName(), 3, 3).build());
    resourceManager.createResource(extensionContext, false, KafkaRebalanceTemplates.kafkaRebalance(testStorage.getClusterName()).editOrNewSpec().withRebalanceDisk(true).endSpec().build());
    KafkaRebalanceUtils.waitForKafkaRebalanceCustomResourceState(testStorage.getNamespaceName(), testStorage.getClusterName(), KafkaRebalanceState.NotReady);
    // The intra-broker rebalance will fail for Kafka clusters with a non-JBOD configuration.
    KafkaRebalanceStatus kafkaRebalanceStatus = KafkaRebalanceResource.kafkaRebalanceClient().inNamespace(testStorage.getNamespaceName()).withName(testStorage.getClusterName()).get().getStatus();
    assertThat(kafkaRebalanceStatus.getConditions().get(0).getReason(), is("InvalidResourceException"));
}
Also used : KafkaRebalanceStatus(io.strimzi.api.kafka.model.status.KafkaRebalanceStatus) TestStorage(io.strimzi.systemtest.storage.TestStorage) ParallelNamespaceTest(io.strimzi.systemtest.annotations.ParallelNamespaceTest)

Example 22 with KafkaRebalanceStatus

use of io.strimzi.api.kafka.model.status.KafkaRebalanceStatus in project strimzi-kafka-operator by strimzi.

the class KafkaRebalanceUtils method waitForRebalanceStatusStability.

public static void waitForRebalanceStatusStability(Reconciliation reconciliation, String namespaceName, String resourceName) {
    int[] stableCounter = { 0 };
    KafkaRebalanceStatus oldStatus = KafkaRebalanceResource.kafkaRebalanceClient().inNamespace(namespaceName).withName(resourceName).get().getStatus();
    TestUtils.waitFor("KafkaRebalance status will be stable", Constants.GLOBAL_POLL_INTERVAL, Constants.GLOBAL_STATUS_TIMEOUT, () -> {
        if (KafkaRebalanceResource.kafkaRebalanceClient().inNamespace(namespaceName).withName(resourceName).get().getStatus().equals(oldStatus)) {
            stableCounter[0]++;
            if (stableCounter[0] == Constants.GLOBAL_STABILITY_OFFSET_COUNT) {
                LOGGER.infoCr(reconciliation, "KafkaRebalance status is stable for {} polls intervals", stableCounter[0]);
                return true;
            }
        } else {
            LOGGER.infoCr(reconciliation, "KafkaRebalance status is not stable. Going to set the counter to zero.");
            stableCounter[0] = 0;
            return false;
        }
        LOGGER.infoCr(reconciliation, "KafkaRebalance status gonna be stable in {} polls", Constants.GLOBAL_STABILITY_OFFSET_COUNT - stableCounter[0]);
        return false;
    });
}
Also used : KafkaRebalanceStatus(io.strimzi.api.kafka.model.status.KafkaRebalanceStatus)

Aggregations

KafkaRebalanceStatus (io.strimzi.api.kafka.model.status.KafkaRebalanceStatus)22 Secret (io.fabric8.kubernetes.api.model.Secret)12 KafkaRebalanceBuilder (io.strimzi.api.kafka.model.KafkaRebalanceBuilder)12 KafkaRebalanceAnnotation (io.strimzi.api.kafka.model.balancing.KafkaRebalanceAnnotation)12 KafkaRebalanceState (io.strimzi.api.kafka.model.balancing.KafkaRebalanceState)12 Condition (io.strimzi.api.kafka.model.status.Condition)12 InvalidResourceException (io.strimzi.operator.cluster.model.InvalidResourceException)12 NoSuchResourceException (io.strimzi.operator.cluster.model.NoSuchResourceException)12 CruiseControlApi (io.strimzi.operator.cluster.operator.resource.cruisecontrol.CruiseControlApi)12 Reconciliation (io.strimzi.operator.common.Reconciliation)12 ConfigMap (io.fabric8.kubernetes.api.model.ConfigMap)10 KubernetesClient (io.fabric8.kubernetes.client.KubernetesClient)10 KafkaList (io.strimzi.api.kafka.KafkaList)10 KafkaRebalanceList (io.strimzi.api.kafka.KafkaRebalanceList)10 CruiseControlResources (io.strimzi.api.kafka.model.CruiseControlResources)10 Kafka (io.strimzi.api.kafka.model.Kafka)10 KafkaRebalance (io.strimzi.api.kafka.model.KafkaRebalance)10 KafkaRebalanceSpec (io.strimzi.api.kafka.model.KafkaRebalanceSpec)10 JbodStorage (io.strimzi.api.kafka.model.storage.JbodStorage)10 ClusterOperatorConfig (io.strimzi.operator.cluster.ClusterOperatorConfig)10