@Test public void checkKafkaStorage() { Kafka kafka = new KafkaBuilder(ResourceUtils.createKafka(NAMESPACE, NAME, 1, IMAGE, HEALTH_DELAY, HEALTH_TIMEOUT, Collections.emptyMap(), Collections.emptyMap(), Collections.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.")); }
private void checkKafkaStorage(List<Condition> warnings) { if (kafkaCluster.getReplicas() == 1 && StorageUtils.usesEphemeral(kafkaCluster.getStorage())) { warnings.add(StatusUtils.buildWarningCondition("KafkaStorage", "A Kafka cluster with a single replica and ephemeral storage will lose topic messages after any restart or rolling update.")); } }
KafkaSpecChecker { private void checkKafkaStorage(List<Condition> warnings) { if (kafkaCluster.getReplicas() == 1 && StorageUtils.usesEphemeral(kafkaCluster.getStorage())) { warnings.add(StatusUtils.buildWarningCondition("KafkaStorage", "A Kafka cluster with a single replica and ephemeral storage will lose topic messages after any restart or rolling update.")); } } }
KafkaSpecChecker { private void checkKafkaStorage(List<Condition> warnings) { if (kafkaCluster.getReplicas() == 1 && StorageUtils.usesEphemeral(kafkaCluster.getStorage())) { warnings.add(StatusUtils.buildWarningCondition("KafkaStorage", "A Kafka cluster with a single replica and ephemeral storage will lose topic messages after any restart or rolling update.")); } } KafkaSpecChecker(KafkaSpec spec, KafkaCluster kafkaCluster, ZookeeperCluster zkCluster); }
KafkaSpecChecker { private void checkKafkaStorage(List<Condition> warnings) { if (kafkaCluster.getReplicas() == 1 && StorageUtils.usesEphemeral(kafkaCluster.getStorage())) { warnings.add(StatusUtils.buildWarningCondition("KafkaStorage", "A Kafka cluster with a single replica and ephemeral storage will lose topic messages after any restart or rolling update.")); } } KafkaSpecChecker(KafkaSpec spec, KafkaCluster kafkaCluster, ZookeeperCluster zkCluster); List<Condition> run(); }
KafkaSpecChecker { private void checkKafkaStorage(List<Condition> warnings) { if (kafkaCluster.getReplicas() == 1 && StorageUtils.usesEphemeral(kafkaCluster.getStorage())) { warnings.add(StatusUtils.buildWarningCondition("KafkaStorage", "A Kafka cluster with a single replica and ephemeral storage will lose topic messages after any restart or rolling update.")); } } KafkaSpecChecker(KafkaSpec spec, KafkaCluster kafkaCluster, ZookeeperCluster zkCluster); List<Condition> run();  }