use of io.strimzi.operator.cluster.operator.resource.DefaultZookeeperScalerProvider in project strimzi-kafka-operator by strimzi.
the class ConnectorMockTest method setup.
@SuppressWarnings({ "checkstyle:MethodLength" })
@BeforeEach
public void setup(VertxTestContext testContext) {
vertx = Vertx.vertx();
// Configure the Kubernetes Mock
mockKube = new MockKube2.MockKube2Builder(client).withKafkaConnectCrd().withKafkaConnectorCrd().withDeploymentController().build();
mockKube.start();
PlatformFeaturesAvailability pfa = new PlatformFeaturesAvailability(false, KubernetesVersion.V1_18);
setupMockConnectAPI();
metricsProvider = ResourceUtils.metricsProvider();
ResourceOperatorSupplier ros = new ResourceOperatorSupplier(vertx, client, new ZookeeperLeaderFinder(vertx, // Retry up to 3 times (4 attempts), with overall max delay of 35000ms
() -> new BackOff(5_000, 2, 4)), new DefaultAdminClientProvider(), new DefaultZookeeperScalerProvider(), metricsProvider, pfa, 10_000);
ClusterOperatorConfig config = ClusterOperatorConfig.fromMap(map(ClusterOperatorConfig.STRIMZI_KAFKA_IMAGES, KafkaVersionTestUtils.getKafkaImagesEnvVarString(), ClusterOperatorConfig.STRIMZI_KAFKA_CONNECT_IMAGES, KafkaVersionTestUtils.getKafkaConnectImagesEnvVarString(), ClusterOperatorConfig.STRIMZI_KAFKA_MIRROR_MAKER_2_IMAGES, KafkaVersionTestUtils.getKafkaMirrorMaker2ImagesEnvVarString(), ClusterOperatorConfig.STRIMZI_FULL_RECONCILIATION_INTERVAL_MS, Long.toString(Long.MAX_VALUE)), KafkaVersionTestUtils.getKafkaVersionLookup());
kafkaConnectOperator = spy(new KafkaConnectAssemblyOperator(vertx, pfa, ros, config, x -> api));
Checkpoint async = testContext.checkpoint();
// Fail test if watcher closes for any reason
kafkaConnectOperator.createWatch(NAMESPACE, e -> testContext.failNow(e)).onComplete(testContext.succeeding()).compose(watch -> {
connectWatch = watch;
return AbstractConnectOperator.createConnectorWatch(kafkaConnectOperator, NAMESPACE, null);
}).compose(watch -> {
connectorWatch = watch;
// async.flag();
return Future.succeededFuture();
}).onComplete(testContext.succeeding(v -> async.flag()));
}
use of io.strimzi.operator.cluster.operator.resource.DefaultZookeeperScalerProvider in project strimzi by strimzi.
the class KafkaMirrorMaker2AssemblyOperatorMockTest method createMirrorMaker2Cluster.
private Future<Void> createMirrorMaker2Cluster(VertxTestContext context, KafkaConnectApi kafkaConnectApi, boolean reconciliationPaused) {
PlatformFeaturesAvailability pfa = new PlatformFeaturesAvailability(false, KubernetesVersion.V1_16);
ResourceOperatorSupplier supplier = new ResourceOperatorSupplier(vertx, client, new ZookeeperLeaderFinder(vertx, // Retry up to 3 times (4 attempts), with overall max delay of 35000ms
() -> new BackOff(5_000, 2, 4)), new DefaultAdminClientProvider(), new DefaultZookeeperScalerProvider(), ResourceUtils.metricsProvider(), pfa, 60_000L);
ClusterOperatorConfig config = ResourceUtils.dummyClusterOperatorConfig(VERSIONS);
kco = new KafkaMirrorMaker2AssemblyOperator(vertx, pfa, supplier, config, foo -> kafkaConnectApi);
LOGGER.info("Reconciling initially -> create");
Promise<Void> created = Promise.promise();
kco.reconcile(new Reconciliation("test-trigger", KafkaMirrorMaker2.RESOURCE_KIND, NAMESPACE, CLUSTER_NAME)).onComplete(context.succeeding(ar -> context.verify(() -> {
if (!reconciliationPaused) {
assertThat(client.apps().deployments().inNamespace(NAMESPACE).withName(KafkaMirrorMaker2Resources.deploymentName(CLUSTER_NAME)).get(), is(notNullValue()));
assertThat(client.configMaps().inNamespace(NAMESPACE).withName(KafkaMirrorMaker2Resources.metricsAndLogConfigMapName(CLUSTER_NAME)).get(), is(notNullValue()));
assertThat(client.services().inNamespace(NAMESPACE).withName(KafkaMirrorMaker2Resources.serviceName(CLUSTER_NAME)).get(), is(notNullValue()));
assertThat(client.policy().v1beta1().podDisruptionBudget().inNamespace(NAMESPACE).withName(KafkaMirrorMaker2Resources.deploymentName(CLUSTER_NAME)).get(), is(notNullValue()));
} else {
assertThat(client.apps().deployments().inNamespace(NAMESPACE).withName(KafkaMirrorMaker2Resources.deploymentName(CLUSTER_NAME)).get(), is(nullValue()));
}
created.complete();
})));
return created.future();
}
use of io.strimzi.operator.cluster.operator.resource.DefaultZookeeperScalerProvider in project strimzi by strimzi.
the class ConnectorMockTest method setup.
@SuppressWarnings({ "checkstyle:MethodLength" })
@BeforeEach
public void setup(VertxTestContext testContext) {
vertx = Vertx.vertx();
// Configure the Kubernetes Mock
mockKube = new MockKube2.MockKube2Builder(client).withKafkaConnectCrd().withKafkaConnectorCrd().withDeploymentController().build();
mockKube.start();
PlatformFeaturesAvailability pfa = new PlatformFeaturesAvailability(false, KubernetesVersion.V1_18);
setupMockConnectAPI();
metricsProvider = ResourceUtils.metricsProvider();
ResourceOperatorSupplier ros = new ResourceOperatorSupplier(vertx, client, new ZookeeperLeaderFinder(vertx, // Retry up to 3 times (4 attempts), with overall max delay of 35000ms
() -> new BackOff(5_000, 2, 4)), new DefaultAdminClientProvider(), new DefaultZookeeperScalerProvider(), metricsProvider, pfa, 10_000);
ClusterOperatorConfig config = ClusterOperatorConfig.fromMap(map(ClusterOperatorConfig.STRIMZI_KAFKA_IMAGES, KafkaVersionTestUtils.getKafkaImagesEnvVarString(), ClusterOperatorConfig.STRIMZI_KAFKA_CONNECT_IMAGES, KafkaVersionTestUtils.getKafkaConnectImagesEnvVarString(), ClusterOperatorConfig.STRIMZI_KAFKA_MIRROR_MAKER_2_IMAGES, KafkaVersionTestUtils.getKafkaMirrorMaker2ImagesEnvVarString(), ClusterOperatorConfig.STRIMZI_FULL_RECONCILIATION_INTERVAL_MS, Long.toString(Long.MAX_VALUE)), KafkaVersionTestUtils.getKafkaVersionLookup());
kafkaConnectOperator = spy(new KafkaConnectAssemblyOperator(vertx, pfa, ros, config, x -> api));
Checkpoint async = testContext.checkpoint();
// Fail test if watcher closes for any reason
kafkaConnectOperator.createWatch(NAMESPACE, e -> testContext.failNow(e)).onComplete(testContext.succeeding()).compose(watch -> {
connectWatch = watch;
return AbstractConnectOperator.createConnectorWatch(kafkaConnectOperator, NAMESPACE, null);
}).compose(watch -> {
connectorWatch = watch;
// async.flag();
return Future.succeededFuture();
}).onComplete(testContext.succeeding(v -> async.flag()));
}
Aggregations