use of io.strimzi.api.kafka.model.storage.EphemeralStorage in project strimzi 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."));
}
use of io.strimzi.api.kafka.model.storage.EphemeralStorage in project strimzi by strimzi.
the class KafkaSpecCheckerTest method checkZookeeperEvenReplicas.
@Test
public void checkZookeeperEvenReplicas() {
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, 4, 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("ZooKeeperReplicas"));
assertThat(warning.getStatus(), is("True"));
assertThat(warning.getMessage(), is("Running ZooKeeper with an odd number of replicas is recommended."));
}
use of io.strimzi.api.kafka.model.storage.EphemeralStorage in project strimzi by strimzi.
the class KafkaSpecCheckerTest method checkMultipleWarnings.
@Test
public void checkMultipleWarnings() {
Kafka kafka = ResourceUtils.createKafka(NAMESPACE, NAME, 3, IMAGE, HEALTH_DELAY, HEALTH_TIMEOUT, null, emptyMap(), emptyMap(), new EphemeralStorage(), new EphemeralStorage(), null, null, null, null);
KafkaSpecChecker checker = generateChecker(kafka);
List<Condition> warnings = checker.run();
assertThat(warnings, hasSize(2));
}
use of io.strimzi.api.kafka.model.storage.EphemeralStorage in project strimzi by strimzi.
the class Capacity method generateDiskCapacity.
/**
* Generate total disk capacity using the supplied storage configuration
*
* @param storage Storage configuration for Kafka cluster
* @return Disk capacity per broker as a Double
*/
public static Double generateDiskCapacity(Storage storage) {
if (storage instanceof PersistentClaimStorage) {
return getSizeInMiB(((PersistentClaimStorage) storage).getSize());
} else if (storage instanceof EphemeralStorage) {
if (((EphemeralStorage) storage).getSizeLimit() != null) {
return getSizeInMiB(((EphemeralStorage) storage).getSizeLimit());
} else {
return DEFAULT_BROKER_DISK_CAPACITY_IN_MIB;
}
} else if (storage instanceof JbodStorage) {
// The value generated here for JBOD storage is used for tracking the total
// disk capacity per broker. This will NOT be used for the final disk capacity
// configuration since JBOD storage requires a special disk configuration.
List<SingleVolumeStorage> volumeList = ((JbodStorage) storage).getVolumes();
double size = 0;
for (SingleVolumeStorage volume : volumeList) {
size += generateDiskCapacity(volume);
}
return size;
} else {
throw new IllegalStateException("The declared storage '" + storage.getType() + "' is not supported");
}
}
use of io.strimzi.api.kafka.model.storage.EphemeralStorage in project strimzi by strimzi.
the class ResourceUtils method createKafka.
public static Kafka createKafka(String namespace, String name, int replicas, String image, int healthDelay, int healthTimeout) {
Probe probe = new ProbeBuilder().withInitialDelaySeconds(healthDelay).withTimeoutSeconds(healthTimeout).withFailureThreshold(10).withSuccessThreshold(4).withPeriodSeconds(33).build();
ObjectMeta meta = new ObjectMetaBuilder().withNamespace(namespace).withName(name).withLabels(Labels.fromMap(singletonMap("my-user-label", "cromulent")).toMap()).build();
KafkaBuilder builder = new KafkaBuilder();
return builder.withMetadata(meta).withNewSpec().withNewKafka().withReplicas(replicas).withImage(image).withListeners(new GenericKafkaListenerBuilder().withName("plain").withPort(9092).withType(KafkaListenerType.INTERNAL).withTls(false).build(), new GenericKafkaListenerBuilder().withName("tls").withPort(9093).withType(KafkaListenerType.INTERNAL).withTls(true).build()).withLivenessProbe(probe).withReadinessProbe(probe).withStorage(new EphemeralStorage()).endKafka().withNewZookeeper().withReplicas(replicas).withImage(image + "-zk").withLivenessProbe(probe).withReadinessProbe(probe).endZookeeper().endSpec().build();
}
Aggregations