use of io.strimzi.operator.common.operator.MockCertManager in project strimzi-kafka-operator by strimzi.
the class PartialRollingUpdateTest method startKube.
private void startKube() {
CustomResourceDefinition kafkaAssemblyCrd = Crds.kafka();
this.mockClient = new MockKube().withCustomResourceDefinition(kafkaAssemblyCrd, Kafka.class, KafkaList.class).withInitialInstances(Collections.singleton(cluster)).end().withCustomResourceDefinition(Crds.strimziPodSet(), StrimziPodSet.class, StrimziPodSetList.class).end().withInitialStatefulSets(set(zkSts, kafkaSts)).withInitialPods(set(zkPod0, zkPod1, zkPod2, kafkaPod0, kafkaPod1, kafkaPod2, kafkaPod3, kafkaPod4)).withInitialSecrets(set(clusterCaCert, clusterCaKey, clientsCaCert, clientsCaKey)).build();
ResourceOperatorSupplier supplier = supplier(mockClient);
this.kco = new KafkaAssemblyOperator(vertx, new PlatformFeaturesAvailability(true, KubernetesVersion.V1_16), new MockCertManager(), new PasswordGenerator(10, "a", "a"), supplier, ResourceUtils.dummyClusterOperatorConfig(VERSIONS, 2_000));
LOGGER.info("Started test KafkaAssemblyOperator");
}
use of io.strimzi.operator.common.operator.MockCertManager in project strimzi by strimzi.
the class PartialRollingUpdateTest method beforeEach.
@BeforeEach
public void beforeEach(VertxTestContext context) throws InterruptedException, ExecutionException, TimeoutException {
this.cluster = new KafkaBuilder().withMetadata(new ObjectMetaBuilder().withName(CLUSTER_NAME).withNamespace(NAMESPACE).build()).withNewSpec().withNewKafka().withReplicas(5).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()).withNewPersistentClaimStorage().withSize("123").withStorageClass("foo").withDeleteClaim(true).endPersistentClaimStorage().endKafka().withNewZookeeper().withReplicas(3).withNewPersistentClaimStorage().withSize("123").withStorageClass("foo").withDeleteClaim(true).endPersistentClaimStorage().endZookeeper().endSpec().build();
CustomResourceDefinition kafkaAssemblyCrd = Crds.kafka();
KubernetesClient bootstrapClient = new MockKube().withCustomResourceDefinition(kafkaAssemblyCrd, Kafka.class, KafkaList.class).withInitialInstances(Collections.singleton(cluster)).end().withCustomResourceDefinition(Crds.strimziPodSet(), StrimziPodSet.class, StrimziPodSetList.class).end().build();
ResourceOperatorSupplier supplier = supplier(bootstrapClient);
KafkaAssemblyOperator kco = new KafkaAssemblyOperator(vertx, new PlatformFeaturesAvailability(true, KubernetesVersion.V1_16), new MockCertManager(), new PasswordGenerator(10, "a", "a"), supplier, ResourceUtils.dummyClusterOperatorConfig(VERSIONS, 2_000));
LOGGER.info("bootstrap reconciliation");
CountDownLatch createAsync = new CountDownLatch(1);
kco.reconcile(new Reconciliation("test-trigger", Kafka.RESOURCE_KIND, NAMESPACE, CLUSTER_NAME)).onComplete(ar -> {
context.verify(() -> assertThat(ar.succeeded(), is(true)));
createAsync.countDown();
});
if (!createAsync.await(60, TimeUnit.SECONDS)) {
context.failNow(new Throwable("Test timeout"));
}
context.completeNow();
LOGGER.info("bootstrap reconciliation complete");
this.kafkaSts = bootstrapClient.apps().statefulSets().inNamespace(NAMESPACE).withName(KafkaCluster.kafkaClusterName(CLUSTER_NAME)).get();
this.zkSts = bootstrapClient.apps().statefulSets().inNamespace(NAMESPACE).withName(ZookeeperCluster.zookeeperClusterName(CLUSTER_NAME)).get();
this.zkPod0 = bootstrapClient.pods().inNamespace(NAMESPACE).withName(ZookeeperCluster.zookeeperPodName(CLUSTER_NAME, 0)).get();
this.zkPod1 = bootstrapClient.pods().inNamespace(NAMESPACE).withName(ZookeeperCluster.zookeeperPodName(CLUSTER_NAME, 1)).get();
this.zkPod2 = bootstrapClient.pods().inNamespace(NAMESPACE).withName(ZookeeperCluster.zookeeperPodName(CLUSTER_NAME, 2)).get();
this.kafkaPod0 = bootstrapClient.pods().inNamespace(NAMESPACE).withName(KafkaCluster.kafkaPodName(CLUSTER_NAME, 0)).get();
this.kafkaPod1 = bootstrapClient.pods().inNamespace(NAMESPACE).withName(KafkaCluster.kafkaPodName(CLUSTER_NAME, 1)).get();
this.kafkaPod2 = bootstrapClient.pods().inNamespace(NAMESPACE).withName(KafkaCluster.kafkaPodName(CLUSTER_NAME, 2)).get();
this.kafkaPod3 = bootstrapClient.pods().inNamespace(NAMESPACE).withName(KafkaCluster.kafkaPodName(CLUSTER_NAME, 3)).get();
this.kafkaPod4 = bootstrapClient.pods().inNamespace(NAMESPACE).withName(KafkaCluster.kafkaPodName(CLUSTER_NAME, 4)).get();
this.clusterCaCert = bootstrapClient.secrets().inNamespace(NAMESPACE).withName(KafkaResources.clusterCaCertificateSecretName(CLUSTER_NAME)).get();
this.clusterCaKey = bootstrapClient.secrets().inNamespace(NAMESPACE).withName(KafkaResources.clusterCaKeySecretName(CLUSTER_NAME)).get();
this.clientsCaCert = bootstrapClient.secrets().inNamespace(NAMESPACE).withName(KafkaResources.clientsCaCertificateSecretName(CLUSTER_NAME)).get();
this.clientsCaKey = bootstrapClient.secrets().inNamespace(NAMESPACE).withName(KafkaResources.clientsCaKeySecretName(CLUSTER_NAME)).get();
context.completeNow();
}
use of io.strimzi.operator.common.operator.MockCertManager in project strimzi by strimzi.
the class PartialRollingUpdateTest method startKube.
private void startKube() {
CustomResourceDefinition kafkaAssemblyCrd = Crds.kafka();
this.mockClient = new MockKube().withCustomResourceDefinition(kafkaAssemblyCrd, Kafka.class, KafkaList.class).withInitialInstances(Collections.singleton(cluster)).end().withCustomResourceDefinition(Crds.strimziPodSet(), StrimziPodSet.class, StrimziPodSetList.class).end().withInitialStatefulSets(set(zkSts, kafkaSts)).withInitialPods(set(zkPod0, zkPod1, zkPod2, kafkaPod0, kafkaPod1, kafkaPod2, kafkaPod3, kafkaPod4)).withInitialSecrets(set(clusterCaCert, clusterCaKey, clientsCaCert, clientsCaKey)).build();
ResourceOperatorSupplier supplier = supplier(mockClient);
this.kco = new KafkaAssemblyOperator(vertx, new PlatformFeaturesAvailability(true, KubernetesVersion.V1_16), new MockCertManager(), new PasswordGenerator(10, "a", "a"), supplier, ResourceUtils.dummyClusterOperatorConfig(VERSIONS, 2_000));
LOGGER.info("Started test KafkaAssemblyOperator");
}
Aggregations