use of io.strimzi.api.kafka.model.Kafka in project strimzi by strimzi.
the class JbodStorageTest method testReconcileWithUpdateVolumeIdJbod.
@Test
public void testReconcileWithUpdateVolumeIdJbod(VertxTestContext context) {
Checkpoint async = context.checkpoint();
// trying to update id for a volume from in the JBOD storage
volumes.get(0).setId(3);
Kafka kafkaWithUpdatedJbodVolume = new KafkaBuilder(this.kafka).editSpec().editKafka().withStorage(new JbodStorageBuilder().withVolumes(volumes).build()).endKafka().endSpec().build();
Set<String> expectedPvcs = expectedPvcs(kafka);
Set<String> expectedPvcsWithUpdatedJbodStorageVolume = expectedPvcs(kafkaWithUpdatedJbodVolume);
// reconcile for kafka cluster creation
operator.reconcile(new Reconciliation("test-trigger", Kafka.RESOURCE_KIND, NAMESPACE, NAME)).onComplete(context.succeeding(v -> context.verify(() -> {
List<PersistentVolumeClaim> pvcs = getPvcs(NAMESPACE, NAME);
Set<String> pvcsNames = pvcs.stream().map(pvc -> pvc.getMetadata().getName()).collect(Collectors.toSet());
assertThat(pvcsNames, is(expectedPvcs));
}))).compose(v -> {
Crds.kafkaOperation(mockClient).inNamespace(NAMESPACE).withName(NAME).patch(kafkaWithUpdatedJbodVolume);
// reconcile kafka cluster with a Jbod storage volume removed
return operator.reconcile(new Reconciliation("test-trigger", Kafka.RESOURCE_KIND, NAMESPACE, NAME));
}).onComplete(context.succeeding(v -> context.verify(() -> {
List<PersistentVolumeClaim> pvcs = getPvcs(NAMESPACE, NAME);
Set<String> pvcsNames = pvcs.stream().map(pvc -> pvc.getMetadata().getName()).collect(Collectors.toSet());
assertThat(pvcsNames, is(expectedPvcsWithUpdatedJbodStorageVolume));
async.flag();
})));
}
use of io.strimzi.api.kafka.model.Kafka in project strimzi by strimzi.
the class ZookeeperClusterTest method testInvalidVersion.
@ParallelTest
public void testInvalidVersion() {
assertThrows(InvalidResourceException.class, () -> {
Kafka ka = new KafkaBuilder(this.ka).editSpec().editKafka().withImage(null).withVersion("10000.0.0").endKafka().editZookeeper().withImage(null).endZookeeper().endSpec().build();
ZookeeperCluster.fromCrd(Reconciliation.DUMMY_RECONCILIATION, ka, VERSIONS);
});
}
use of io.strimzi.api.kafka.model.Kafka in project strimzi by strimzi.
the class ZookeeperClusterTest method testPvcNames.
@ParallelTest
public void testPvcNames() {
Kafka ka = new KafkaBuilder(ResourceUtils.createKafka(namespace, cluster, replicas, image, healthDelay, healthTimeout, jmxMetricsConfig, configurationJson, zooConfigurationJson)).editSpec().editZookeeper().withNewPersistentClaimStorage().withDeleteClaim(false).withSize("100Gi").endPersistentClaimStorage().endZookeeper().endSpec().build();
ZookeeperCluster zc = ZookeeperCluster.fromCrd(Reconciliation.DUMMY_RECONCILIATION, ka, VERSIONS);
PersistentVolumeClaim pvc = zc.getPersistentVolumeClaimTemplates().get(0);
for (int i = 0; i < replicas; i++) {
assertThat(pvc.getMetadata().getName() + "-" + ZookeeperCluster.zookeeperPodName(cluster, i), is(zc.VOLUME_NAME + "-" + ZookeeperCluster.zookeeperPodName(cluster, i)));
}
}
use of io.strimzi.api.kafka.model.Kafka in project strimzi by strimzi.
the class ZookeeperClusterTest method testDefaultImagePullSecrets.
@ParallelTest
public void testDefaultImagePullSecrets() {
Kafka kafkaAssembly = new KafkaBuilder(ResourceUtils.createKafka(namespace, cluster, replicas, image, healthDelay, healthTimeout, jmxMetricsConfig, configurationJson, emptyMap())).build();
ZookeeperCluster zc = ZookeeperCluster.fromCrd(Reconciliation.DUMMY_RECONCILIATION, kafkaAssembly, VERSIONS);
StatefulSet sts = zc.generateStatefulSet(true, null, null);
assertThat(sts.getSpec().getTemplate().getSpec().getImagePullSecrets(), is(nullValue()));
}
use of io.strimzi.api.kafka.model.Kafka in project strimzi by strimzi.
the class ZookeeperClusterTest method testCreateClusterWithZookeeperJmxEnabled.
@ParallelTest
public void testCreateClusterWithZookeeperJmxEnabled() {
Kafka kafka = new KafkaBuilder().withNewMetadata().withName(cluster).withNamespace(namespace).endMetadata().withNewSpec().withNewKafka().withReplicas(3).withNewEphemeralStorage().endEphemeralStorage().endKafka().withNewZookeeper().withJmxOptions(new KafkaJmxOptionsBuilder().withAuthentication(new KafkaJmxAuthenticationPasswordBuilder().build()).build()).withReplicas(3).withNewEphemeralStorage().endEphemeralStorage().endZookeeper().endSpec().build();
ZookeeperCluster zookeeperCluster = ZookeeperCluster.fromCrd(Reconciliation.DUMMY_RECONCILIATION, kafka, KafkaVersionTestUtils.getKafkaVersionLookup());
Secret jmxSecret = zookeeperCluster.generateJmxSecret();
assertThat(jmxSecret.getData(), hasKey("jmx-username"));
assertThat(jmxSecret.getData(), hasKey("jmx-password"));
}
Aggregations