Search in sources :

Example 86 with KafkaRebalance

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

the class KafkaRebalanceAssemblyOperatorTest method testNewToProposalReadyToRebalancingToStoppedRebalance.

/**
 * Tests the transition from 'New' to to 'ProposalReady'
 * The rebalance proposal is approved and the resource moves to 'Rebalancing' then to 'Stopped' (via annotation)
 *
 * 1. A new KafkaRebalance resource is created; it is in the 'New' state
 * 2. The operator requests a rebalance proposal through the Cruise Control REST API
 * 3. The rebalance proposal is ready on the first call
 * 4. The KafkaRebalance resource moves to the 'ProposalReady' state
 * 9. The KafkaRebalance resource is annotated with 'strimzi.io/rebalance=approve'
 * 10. The operator requests the rebalance operation through the Cruise Control REST API
 * 11. The rebalance operation is not done immediately; the operator starts polling the Cruise Control REST API
 * 12. The KafkaRebalance resource moves to the 'Rebalancing' state
 * 13. While the operator is waiting for the rebalance to be done, the KafkaRebalance resource is annotated with 'strimzi.io/rebalance=stop'
 * 14. The operator stops polling the Cruise Control REST API and requests a stop execution
 * 15. The KafkaRebalance resource moves to the 'Stopped' state
 */
@Test
public void testNewToProposalReadyToRebalancingToStoppedRebalance(VertxTestContext context) throws IOException, URISyntaxException {
    KafkaRebalance kr = createKafkaRebalance(CLUSTER_NAMESPACE, CLUSTER_NAME, RESOURCE_NAME, EMPTY_KAFKA_REBALANCE_SPEC);
    this.krNewToPendingProposalDelete(context, 0, 0, 2, CruiseControlEndpoints.REBALANCE, kr);
}
Also used : KafkaRebalance(io.strimzi.api.kafka.model.KafkaRebalance) Test(org.junit.jupiter.api.Test)

Example 87 with KafkaRebalance

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

the class KafkaRebalanceAssemblyOperatorTest method testNewToProposalReadyRebalance.

/**
 * Tests the transition from 'New' to 'ProposalReady'
 *
 * 1. A new KafkaRebalance resource is created; it is in the New state
 * 2. The operator requests a rebalance proposal via the Cruise Control REST API
 * 3. The rebalance proposal is ready on the first call
 * 4. The KafkaRebalance resource moves to the 'ProposalReady' state
 */
@Test
public void testNewToProposalReadyRebalance(VertxTestContext context) throws IOException, URISyntaxException {
    KafkaRebalance kr = createKafkaRebalance(CLUSTER_NAMESPACE, CLUSTER_NAME, RESOURCE_NAME, EMPTY_KAFKA_REBALANCE_SPEC);
    this.krNewToProposalReady(context, 0, CruiseControlEndpoints.REBALANCE, kr);
}
Also used : KafkaRebalance(io.strimzi.api.kafka.model.KafkaRebalance) Test(org.junit.jupiter.api.Test)

Example 88 with KafkaRebalance

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

the class KafkaRebalanceAssemblyOperatorTest method testNewToPendingProposalDeleteRebalance.

/**
 * Tests the transition from 'New' to 'PendingProposal' then the resource is deleted
 *
 * 1. A new KafkaRebalance resource is created; it is in the New state
 * 2. The operator requests a rebalance proposal through the Cruise Control REST API
 * 3. The rebalance proposal is not ready on the first call; the operator starts polling the Cruise Control REST API
 * 4. The KafkaRebalance resource moves to the 'PendingProposal' state
 * 5. The KafkaRebalance resource is deleted
 */
@Test
public void testNewToPendingProposalDeleteRebalance(VertxTestContext context) throws IOException, URISyntaxException {
    KafkaRebalance kr = createKafkaRebalance(CLUSTER_NAMESPACE, CLUSTER_NAME, RESOURCE_NAME, EMPTY_KAFKA_REBALANCE_SPEC);
    this.krNewToPendingProposalDelete(context, 2, CruiseControlEndpoints.REBALANCE, kr);
}
Also used : KafkaRebalance(io.strimzi.api.kafka.model.KafkaRebalance) Test(org.junit.jupiter.api.Test)

Example 89 with KafkaRebalance

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

the class KafkaRebalanceStateMachineTest method testProposalReadyNoChange.

@Test
public void testProposalReadyNoChange(Vertx vertx, VertxTestContext context) throws IOException, URISyntaxException {
    KafkaRebalance kcRebalance = createKafkaRebalance(KafkaRebalanceState.ProposalReady, null, null, EMPTY_KAFKA_REBALANCE_SPEC);
    this.krProposalReadyNoChange(vertx, context, 0, CruiseControlEndpoints.REBALANCE, kcRebalance);
    kcRebalance = createKafkaRebalance(KafkaRebalanceState.ProposalReady, null, null, ADD_BROKER_KAFKA_REBALANCE_SPEC);
    this.krProposalReadyNoChange(vertx, context, 0, CruiseControlEndpoints.ADD_BROKER, kcRebalance);
    kcRebalance = createKafkaRebalance(KafkaRebalanceState.ProposalReady, null, null, REMOVE_BROKER_KAFKA_REBALANCE_SPEC);
    this.krProposalReadyNoChange(vertx, context, 0, CruiseControlEndpoints.REMOVE_BROKER, kcRebalance);
}
Also used : KafkaRebalance(io.strimzi.api.kafka.model.KafkaRebalance) Test(org.junit.jupiter.api.Test)

Example 90 with KafkaRebalance

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

the class KafkaRebalanceStateMachineTest method testProposalReadyRefreshNoChange.

@Test
public void testProposalReadyRefreshNoChange(Vertx vertx, VertxTestContext context) throws IOException, URISyntaxException {
    KafkaRebalance kcRebalance = createKafkaRebalance(KafkaRebalanceState.ProposalReady, null, null, EMPTY_KAFKA_REBALANCE_SPEC);
    this.krProposalReadyRefreshNoChange(vertx, context, 0, CruiseControlEndpoints.REBALANCE, kcRebalance);
    kcRebalance = createKafkaRebalance(KafkaRebalanceState.ProposalReady, null, null, ADD_BROKER_KAFKA_REBALANCE_SPEC);
    this.krProposalReadyRefreshNoChange(vertx, context, 0, CruiseControlEndpoints.ADD_BROKER, kcRebalance);
    kcRebalance = createKafkaRebalance(KafkaRebalanceState.ProposalReady, null, null, REMOVE_BROKER_KAFKA_REBALANCE_SPEC);
    this.krProposalReadyRefreshNoChange(vertx, context, 0, CruiseControlEndpoints.REMOVE_BROKER, kcRebalance);
}
Also used : KafkaRebalance(io.strimzi.api.kafka.model.KafkaRebalance) Test(org.junit.jupiter.api.Test)

Aggregations

KafkaRebalance (io.strimzi.api.kafka.model.KafkaRebalance)200 Test (org.junit.jupiter.api.Test)182 KafkaRebalanceSpec (io.strimzi.api.kafka.model.KafkaRebalanceSpec)76 KafkaRebalanceSpecBuilder (io.strimzi.api.kafka.model.KafkaRebalanceSpecBuilder)72 ConfigMap (io.fabric8.kubernetes.api.model.ConfigMap)60 Condition (io.strimzi.api.kafka.model.status.Condition)58 KubernetesClient (io.fabric8.kubernetes.client.KubernetesClient)56 KafkaRebalanceList (io.strimzi.api.kafka.KafkaRebalanceList)56 KafkaRebalanceBuilder (io.strimzi.api.kafka.model.KafkaRebalanceBuilder)56 InvalidResourceException (io.strimzi.operator.cluster.model.InvalidResourceException)56 NoSuchResourceException (io.strimzi.operator.cluster.model.NoSuchResourceException)56 ResourceOperatorSupplier (io.strimzi.operator.cluster.operator.resource.ResourceOperatorSupplier)56 CruiseControlApi (io.strimzi.operator.cluster.operator.resource.cruisecontrol.CruiseControlApi)56 CruiseControlApiImpl (io.strimzi.operator.cluster.operator.resource.cruisecontrol.CruiseControlApiImpl)56 CruiseControlRestException (io.strimzi.operator.cluster.operator.resource.cruisecontrol.CruiseControlRestException)56 Reconciliation (io.strimzi.operator.common.Reconciliation)56 ConfigMapOperator (io.strimzi.operator.common.operator.resource.ConfigMapOperator)56 Map (java.util.Map)56 Secret (io.fabric8.kubernetes.api.model.Secret)54 KafkaList (io.strimzi.api.kafka.KafkaList)54