Search in sources :

Example 1 with Storage

use of io.strimzi.api.kafka.model.storage.Storage in project strimzi by strimzi.

the class KafkaBrokerConfigurationBuilderTest method testPersistentStorageLogDirs.

@ParallelTest
public void testPersistentStorageLogDirs() {
    Storage storage = new PersistentClaimStorageBuilder().withSize("1Ti").withStorageClass("aws-ebs").withDeleteClaim(true).build();
    String configuration = new KafkaBrokerConfigurationBuilder(Reconciliation.DUMMY_RECONCILIATION).withLogDirs(VolumeUtils.createVolumeMounts(storage, "/var/lib/kafka", false)).build();
    assertThat(configuration, isEquivalent("log.dirs=/var/lib/kafka/data/kafka-log${STRIMZI_BROKER_ID}"));
}
Also used : Storage(io.strimzi.api.kafka.model.storage.Storage) SingleVolumeStorage(io.strimzi.api.kafka.model.storage.SingleVolumeStorage) PersistentClaimStorageBuilder(io.strimzi.api.kafka.model.storage.PersistentClaimStorageBuilder) CoreMatchers.containsString(org.hamcrest.CoreMatchers.containsString) ParallelTest(io.strimzi.test.annotations.ParallelTest)

Example 2 with Storage

use of io.strimzi.api.kafka.model.storage.Storage in project strimzi by strimzi.

the class ZookeeperClusterTest method testStorageValidationAfterInitialDeployment.

@ParallelTest
public void testStorageValidationAfterInitialDeployment() {
    assertThrows(InvalidResourceException.class, () -> {
        Storage oldStorage = new PersistentClaimStorageBuilder().withSize("100Gi").build();
        Kafka kafkaAssembly = new KafkaBuilder(ResourceUtils.createKafka(namespace, cluster, replicas, image, healthDelay, healthTimeout, jmxMetricsConfig, configurationJson, zooConfigurationJson)).editSpec().editZookeeper().withStorage(new PersistentClaimStorageBuilder().build()).endZookeeper().endSpec().build();
        ZookeeperCluster.fromCrd(Reconciliation.DUMMY_RECONCILIATION, kafkaAssembly, VERSIONS, oldStorage, replicas);
    });
}
Also used : Storage(io.strimzi.api.kafka.model.storage.Storage) SingleVolumeStorage(io.strimzi.api.kafka.model.storage.SingleVolumeStorage) Kafka(io.strimzi.api.kafka.model.Kafka) PersistentClaimStorageBuilder(io.strimzi.api.kafka.model.storage.PersistentClaimStorageBuilder) KafkaBuilder(io.strimzi.api.kafka.model.KafkaBuilder) ParallelTest(io.strimzi.test.annotations.ParallelTest)

Example 3 with Storage

use of io.strimzi.api.kafka.model.storage.Storage in project strimzi by strimzi.

the class StorageUtilsTest method testEphemeralStorage.

@ParallelTest
public void testEphemeralStorage() {
    Storage notEphemeral = new PersistentClaimStorageBuilder().build();
    Storage isEphemeral = new EphemeralStorageBuilder().build();
    Storage includesEphemeral = new JbodStorageBuilder().withVolumes(new EphemeralStorageBuilder().withId(1).build(), new EphemeralStorageBuilder().withId(2).build()).build();
    assertThat(StorageUtils.usesEphemeral(notEphemeral), is(false));
    assertThat(StorageUtils.usesEphemeral(isEphemeral), is(true));
    assertThat(StorageUtils.usesEphemeral(includesEphemeral), is(true));
}
Also used : JbodStorageBuilder(io.strimzi.api.kafka.model.storage.JbodStorageBuilder) Storage(io.strimzi.api.kafka.model.storage.Storage) PersistentClaimStorageBuilder(io.strimzi.api.kafka.model.storage.PersistentClaimStorageBuilder) EphemeralStorageBuilder(io.strimzi.api.kafka.model.storage.EphemeralStorageBuilder) ParallelTest(io.strimzi.test.annotations.ParallelTest)

Example 4 with Storage

use of io.strimzi.api.kafka.model.storage.Storage in project strimzi by strimzi.

the class StorageDiffTest method testSizeChanges.

@ParallelTest
public void testSizeChanges() {
    Storage persistent = new PersistentClaimStorageBuilder().withStorageClass("gp2-ssd").withDeleteClaim(false).withId(0).withSize("100Gi").build();
    Storage persistent2 = new PersistentClaimStorageBuilder().withStorageClass("gp2-ssd").withDeleteClaim(false).withId(0).withSize("1000Gi").build();
    Storage persistent3 = new PersistentClaimStorageBuilder().withStorageClass("gp2-ssd").withDeleteClaim(false).withId(0).withSize("10Gi").build();
    assertThat(new StorageDiff(Reconciliation.DUMMY_RECONCILIATION, persistent, persistent, 3, 3).shrinkSize(), is(false));
    assertThat(new StorageDiff(Reconciliation.DUMMY_RECONCILIATION, persistent, persistent2, 3, 3).shrinkSize(), is(false));
    assertThat(new StorageDiff(Reconciliation.DUMMY_RECONCILIATION, persistent, persistent3, 3, 3).shrinkSize(), is(true));
}
Also used : Storage(io.strimzi.api.kafka.model.storage.Storage) PersistentClaimStorageBuilder(io.strimzi.api.kafka.model.storage.PersistentClaimStorageBuilder) ParallelTest(io.strimzi.test.annotations.ParallelTest)

Example 5 with Storage

use of io.strimzi.api.kafka.model.storage.Storage in project strimzi by strimzi.

the class StorageDiffTest method testSizeChangesInJbod.

@ParallelTest
public void testSizeChangesInJbod() {
    Storage jbod = new JbodStorageBuilder().withVolumes(new PersistentClaimStorageBuilder().withStorageClass("gp2-ssd").withDeleteClaim(false).withId(0).withSize("1000Gi").build(), new PersistentClaimStorageBuilder().withStorageClass("gp2-ssd").withDeleteClaim(true).withId(1).withSize("1000Gi").build()).build();
    Storage jbod2 = new JbodStorageBuilder().withVolumes(new PersistentClaimStorageBuilder().withStorageClass("gp2-ssd").withDeleteClaim(false).withId(0).withSize("5000Gi").build(), new PersistentClaimStorageBuilder().withStorageClass("gp2-ssd").withDeleteClaim(true).withId(1).withSize("1000Gi").build()).build();
    Storage jbod3 = new JbodStorageBuilder().withVolumes(new PersistentClaimStorageBuilder().withStorageClass("gp2-ssd").withDeleteClaim(false).withId(0).withSize("1000Gi").build(), new PersistentClaimStorageBuilder().withStorageClass("gp2-ssd").withDeleteClaim(true).withId(1).withSize("500Gi").build()).build();
    assertThat(new StorageDiff(Reconciliation.DUMMY_RECONCILIATION, jbod, jbod, 3, 3).shrinkSize(), is(false));
    assertThat(new StorageDiff(Reconciliation.DUMMY_RECONCILIATION, jbod, jbod2, 3, 3).shrinkSize(), is(false));
    assertThat(new StorageDiff(Reconciliation.DUMMY_RECONCILIATION, jbod, jbod3, 3, 3).shrinkSize(), is(true));
}
Also used : JbodStorageBuilder(io.strimzi.api.kafka.model.storage.JbodStorageBuilder) Storage(io.strimzi.api.kafka.model.storage.Storage) PersistentClaimStorageBuilder(io.strimzi.api.kafka.model.storage.PersistentClaimStorageBuilder) ParallelTest(io.strimzi.test.annotations.ParallelTest)

Aggregations

Storage (io.strimzi.api.kafka.model.storage.Storage)56 PersistentClaimStorageBuilder (io.strimzi.api.kafka.model.storage.PersistentClaimStorageBuilder)46 ParallelTest (io.strimzi.test.annotations.ParallelTest)42 JbodStorageBuilder (io.strimzi.api.kafka.model.storage.JbodStorageBuilder)20 SingleVolumeStorage (io.strimzi.api.kafka.model.storage.SingleVolumeStorage)18 EphemeralStorageBuilder (io.strimzi.api.kafka.model.storage.EphemeralStorageBuilder)16 Kafka (io.strimzi.api.kafka.model.Kafka)14 KafkaBuilder (io.strimzi.api.kafka.model.KafkaBuilder)14 PersistentClaimStorage (io.strimzi.api.kafka.model.storage.PersistentClaimStorage)10 PersistentClaimStorageOverrideBuilder (io.strimzi.api.kafka.model.storage.PersistentClaimStorageOverrideBuilder)9 PersistentVolumeClaim (io.fabric8.kubernetes.api.model.PersistentVolumeClaim)8 Quantity (io.fabric8.kubernetes.api.model.Quantity)8 ResourceRequirements (io.fabric8.kubernetes.api.model.ResourceRequirements)8 ResourceRequirementsBuilder (io.fabric8.kubernetes.api.model.ResourceRequirementsBuilder)8 GenericKafkaListenerBuilder (io.strimzi.api.kafka.model.listener.arraylistener.GenericKafkaListenerBuilder)8 EphemeralStorage (io.strimzi.api.kafka.model.storage.EphemeralStorage)8 Checkpoint (io.vertx.junit5.Checkpoint)8 ArrayList (java.util.ArrayList)8 Container (io.fabric8.kubernetes.api.model.Container)6 DeletionPropagation (io.fabric8.kubernetes.api.model.DeletionPropagation)6