Search in sources :

Example 31 with EphemeralStorage

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

the class KafkaSpecCheckerTest method checkKafkaStorage.

@Test
public void checkKafkaStorage() {
    Kafka kafka = new KafkaBuilder(ResourceUtils.createKafka(NAMESPACE, NAME, 1, IMAGE, HEALTH_DELAY, HEALTH_TIMEOUT, null, emptyMap(), emptyMap(), new EphemeralStorage(), new EphemeralStorage(), null, null, null, null)).editSpec().editZookeeper().withReplicas(3).endZookeeper().endSpec().build();
    KafkaSpecChecker checker = generateChecker(kafka);
    List<Condition> warnings = checker.run();
    assertThat(warnings, hasSize(1));
    Condition warning = warnings.get(0);
    assertThat(warning.getReason(), is("KafkaStorage"));
    assertThat(warning.getStatus(), is("True"));
    assertThat(warning.getMessage(), is("A Kafka cluster with a single replica and ephemeral storage will lose topic messages after any restart or rolling update."));
}
Also used : Condition(io.strimzi.api.kafka.model.status.Condition) Kafka(io.strimzi.api.kafka.model.Kafka) KafkaBuilder(io.strimzi.api.kafka.model.KafkaBuilder) EphemeralStorage(io.strimzi.api.kafka.model.storage.EphemeralStorage) Test(org.junit.jupiter.api.Test)

Example 32 with EphemeralStorage

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

the class KafkaSpecCheckerTest method checkEmptyWarnings.

@Test
public void checkEmptyWarnings() {
    Map<String, Object> kafkaOptions = new HashMap<>();
    kafkaOptions.put(KafkaConfiguration.DEFAULT_REPLICATION_FACTOR, 3);
    kafkaOptions.put(KafkaConfiguration.MIN_INSYNC_REPLICAS, 2);
    Kafka kafka = ResourceUtils.createKafka(NAMESPACE, NAME, 3, IMAGE, HEALTH_DELAY, HEALTH_TIMEOUT, null, kafkaOptions, emptyMap(), new EphemeralStorage(), new EphemeralStorage(), null, null, null, null);
    KafkaSpecChecker checker = generateChecker(kafka);
    assertThat(checker.run(), empty());
}
Also used : HashMap(java.util.HashMap) Kafka(io.strimzi.api.kafka.model.Kafka) EphemeralStorage(io.strimzi.api.kafka.model.storage.EphemeralStorage) Test(org.junit.jupiter.api.Test)

Example 33 with EphemeralStorage

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

the class KafkaSpecCheckerTest method checkLogMessageFormatWithoutVersion.

@Test
public void checkLogMessageFormatWithoutVersion() {
    Map<String, Object> kafkaOptions = new HashMap<>();
    kafkaOptions.put(KafkaConfiguration.LOG_MESSAGE_FORMAT_VERSION, KafkaVersionTestUtils.PREVIOUS_FORMAT_VERSION);
    kafkaOptions.put(KafkaConfiguration.DEFAULT_REPLICATION_FACTOR, 3);
    kafkaOptions.put(KafkaConfiguration.MIN_INSYNC_REPLICAS, 2);
    Kafka kafka = ResourceUtils.createKafka(NAMESPACE, NAME, 3, IMAGE, HEALTH_DELAY, HEALTH_TIMEOUT, null, kafkaOptions, emptyMap(), new EphemeralStorage(), new EphemeralStorage(), null, null, null, null);
    KafkaSpecChecker checker = generateChecker(kafka);
    List<Condition> warnings = checker.run();
    assertThat(warnings, hasSize(1));
    Condition warning = warnings.get(0);
    assertThat(warning.getReason(), is("KafkaLogMessageFormatVersion"));
    assertThat(warning.getStatus(), is("True"));
    assertThat(warning.getMessage(), is("log.message.format.version does not match the Kafka cluster version, which suggests that an upgrade is incomplete."));
}
Also used : Condition(io.strimzi.api.kafka.model.status.Condition) HashMap(java.util.HashMap) Kafka(io.strimzi.api.kafka.model.Kafka) EphemeralStorage(io.strimzi.api.kafka.model.storage.EphemeralStorage) Test(org.junit.jupiter.api.Test)

Example 34 with EphemeralStorage

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

the class KafkaSpecCheckerTest method checkInterBrokerProtocolWithCorrectVersion.

@Test
public void checkInterBrokerProtocolWithCorrectVersion() {
    Map<String, Object> kafkaOptions = new HashMap<>();
    kafkaOptions.put(KafkaConfiguration.INTERBROKER_PROTOCOL_VERSION, KafkaVersionTestUtils.LATEST_PROTOCOL_VERSION);
    kafkaOptions.put(KafkaConfiguration.DEFAULT_REPLICATION_FACTOR, 3);
    kafkaOptions.put(KafkaConfiguration.MIN_INSYNC_REPLICAS, 2);
    Kafka kafka = ResourceUtils.createKafka(NAMESPACE, NAME, 3, IMAGE, HEALTH_DELAY, HEALTH_TIMEOUT, null, kafkaOptions, emptyMap(), new EphemeralStorage(), new EphemeralStorage(), null, null, null, null);
    KafkaSpecChecker checker = generateChecker(kafka);
    List<Condition> warnings = checker.run();
    assertThat(warnings, hasSize(0));
}
Also used : Condition(io.strimzi.api.kafka.model.status.Condition) HashMap(java.util.HashMap) Kafka(io.strimzi.api.kafka.model.Kafka) EphemeralStorage(io.strimzi.api.kafka.model.storage.EphemeralStorage) Test(org.junit.jupiter.api.Test)

Example 35 with EphemeralStorage

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

the class KafkaSpecCheckerTest method checkKafkaJbodStorage.

@Test
public void checkKafkaJbodStorage() {
    Kafka kafka = new KafkaBuilder(ResourceUtils.createKafka(NAMESPACE, NAME, 1, IMAGE, HEALTH_DELAY, HEALTH_TIMEOUT, null, emptyMap(), emptyMap(), new JbodStorageBuilder().withVolumes(new EphemeralStorageBuilder().withId(1).build(), new EphemeralStorageBuilder().withId(2).build()).build(), new EphemeralStorage(), null, null, null, null)).editSpec().editZookeeper().withReplicas(3).endZookeeper().endSpec().build();
    KafkaSpecChecker checker = generateChecker(kafka);
    List<Condition> warnings = checker.run();
    assertThat(warnings, hasSize(1));
    Condition warning = warnings.get(0);
    assertThat(warning.getReason(), is("KafkaStorage"));
    assertThat(warning.getStatus(), is("True"));
    assertThat(warning.getMessage(), is("A Kafka cluster with a single replica and ephemeral storage will lose topic messages after any restart or rolling update."));
}
Also used : Condition(io.strimzi.api.kafka.model.status.Condition) JbodStorageBuilder(io.strimzi.api.kafka.model.storage.JbodStorageBuilder) Kafka(io.strimzi.api.kafka.model.Kafka) KafkaBuilder(io.strimzi.api.kafka.model.KafkaBuilder) EphemeralStorageBuilder(io.strimzi.api.kafka.model.storage.EphemeralStorageBuilder) EphemeralStorage(io.strimzi.api.kafka.model.storage.EphemeralStorage) Test(org.junit.jupiter.api.Test)

Aggregations

EphemeralStorage (io.strimzi.api.kafka.model.storage.EphemeralStorage)56 Kafka (io.strimzi.api.kafka.model.Kafka)44 Test (org.junit.jupiter.api.Test)38 Condition (io.strimzi.api.kafka.model.status.Condition)36 HashMap (java.util.HashMap)36 KafkaBuilder (io.strimzi.api.kafka.model.KafkaBuilder)22 GenericKafkaListenerBuilder (io.strimzi.api.kafka.model.listener.arraylistener.GenericKafkaListenerBuilder)16 SingleVolumeStorage (io.strimzi.api.kafka.model.storage.SingleVolumeStorage)12 PersistentClaimStorage (io.strimzi.api.kafka.model.storage.PersistentClaimStorage)10 ArrayList (java.util.ArrayList)8 Map (java.util.Map)8 GenericKafkaListener (io.strimzi.api.kafka.model.listener.arraylistener.GenericKafkaListener)6 KafkaListenerType (io.strimzi.api.kafka.model.listener.arraylistener.KafkaListenerType)6 EphemeralStorageBuilder (io.strimzi.api.kafka.model.storage.EphemeralStorageBuilder)6 JbodStorageBuilder (io.strimzi.api.kafka.model.storage.JbodStorageBuilder)6 PersistentClaimStorageBuilder (io.strimzi.api.kafka.model.storage.PersistentClaimStorageBuilder)6 KafkaVersionTestUtils (io.strimzi.operator.cluster.KafkaVersionTestUtils)6 ResourceUtils (io.strimzi.operator.cluster.ResourceUtils)6 KafkaCluster (io.strimzi.operator.cluster.model.KafkaCluster)6 KafkaConfiguration (io.strimzi.operator.cluster.model.KafkaConfiguration)6