Search in sources :

Example 1 with StrimziPodSetController

use of io.strimzi.operator.cluster.operator.assembly.StrimziPodSetController in project strimzi by strimzi.

the class ClusterOperator method start.

@Override
public void start(Promise<Void> start) {
    LOGGER.info("Starting ClusterOperator for namespace {}", namespace);
    // Configure the executor here, but it is used only in other places
    getVertx().createSharedWorkerExecutor("kubernetes-ops-pool", config.getOperationsThreadPoolSize(), TimeUnit.SECONDS.toNanos(120));
    if (config.featureGates().useStrimziPodSetsEnabled()) {
        strimziPodSetController = new StrimziPodSetController(namespace, config.getCustomResourceSelector(), resourceOperatorSupplier.kafkaOperator, resourceOperatorSupplier.strimziPodSetOperator, resourceOperatorSupplier.podOperations);
        strimziPodSetController.start();
    }
    List<Future> watchFutures = new ArrayList<>(8);
    List<AbstractOperator<?, ?, ?, ?>> operators = new ArrayList<>(asList(kafkaAssemblyOperator, kafkaMirrorMakerAssemblyOperator, kafkaConnectAssemblyOperator, kafkaBridgeAssemblyOperator, kafkaMirrorMaker2AssemblyOperator));
    for (AbstractOperator<?, ?, ?, ?> operator : operators) {
        watchFutures.add(operator.createWatch(namespace, operator.recreateWatch(namespace)).compose(w -> {
            LOGGER.info("Opened watch for {} operator", operator.kind());
            watchByKind.put(operator.kind(), w);
            return Future.succeededFuture();
        }));
    }
    watchFutures.add(AbstractConnectOperator.createConnectorWatch(kafkaConnectAssemblyOperator, namespace, config.getCustomResourceSelector()));
    watchFutures.add(kafkaRebalanceAssemblyOperator.createRebalanceWatch(namespace));
    CompositeFuture.join(watchFutures).compose(f -> {
        LOGGER.info("Setting up periodic reconciliation for namespace {}", namespace);
        this.reconcileTimer = vertx.setPeriodic(this.config.getReconciliationIntervalMs(), res2 -> {
            LOGGER.info("Triggering periodic reconciliation for namespace {}", namespace);
            reconcileAll("timer");
        });
        return startHealthServer().map((Void) null);
    }).onComplete(start);
}
Also used : KafkaAssemblyOperator(io.strimzi.operator.cluster.operator.assembly.KafkaAssemblyOperator) KafkaMirrorMaker2AssemblyOperator(io.strimzi.operator.cluster.operator.assembly.KafkaMirrorMaker2AssemblyOperator) KafkaBridgeAssemblyOperator(io.strimzi.operator.cluster.operator.assembly.KafkaBridgeAssemblyOperator) HttpServer(io.vertx.core.http.HttpServer) AbstractConnectOperator(io.strimzi.operator.cluster.operator.assembly.AbstractConnectOperator) Watch(io.fabric8.kubernetes.client.Watch) ArrayList(java.util.ArrayList) CompositeFuture(io.vertx.core.CompositeFuture) Arrays.asList(java.util.Arrays.asList) Map(java.util.Map) ResourceOperatorSupplier(io.strimzi.operator.cluster.operator.resource.ResourceOperatorSupplier) AsyncResult(io.vertx.core.AsyncResult) KafkaRebalanceAssemblyOperator(io.strimzi.operator.cluster.operator.assembly.KafkaRebalanceAssemblyOperator) KafkaMirrorMakerAssemblyOperator(io.strimzi.operator.cluster.operator.assembly.KafkaMirrorMakerAssemblyOperator) AbstractOperator(io.strimzi.operator.common.AbstractOperator) Promise(io.vertx.core.Promise) ConcurrentHashMap(java.util.concurrent.ConcurrentHashMap) Future(io.vertx.core.Future) TimeUnit(java.util.concurrent.TimeUnit) List(java.util.List) Logger(org.apache.logging.log4j.Logger) AbstractVerticle(io.vertx.core.AbstractVerticle) PrometheusMeterRegistry(io.micrometer.prometheus.PrometheusMeterRegistry) KubernetesClient(io.fabric8.kubernetes.client.KubernetesClient) KafkaConnectAssemblyOperator(io.strimzi.operator.cluster.operator.assembly.KafkaConnectAssemblyOperator) Handler(io.vertx.core.Handler) LogManager(org.apache.logging.log4j.LogManager) StrimziPodSetController(io.strimzi.operator.cluster.operator.assembly.StrimziPodSetController) ArrayList(java.util.ArrayList) CompositeFuture(io.vertx.core.CompositeFuture) Future(io.vertx.core.Future) StrimziPodSetController(io.strimzi.operator.cluster.operator.assembly.StrimziPodSetController) AbstractOperator(io.strimzi.operator.common.AbstractOperator)

Example 2 with StrimziPodSetController

use of io.strimzi.operator.cluster.operator.assembly.StrimziPodSetController in project strimzi-kafka-operator by strimzi.

the class ClusterOperator method start.

@Override
public void start(Promise<Void> start) {
    LOGGER.info("Starting ClusterOperator for namespace {}", namespace);
    // Configure the executor here, but it is used only in other places
    getVertx().createSharedWorkerExecutor("kubernetes-ops-pool", config.getOperationsThreadPoolSize(), TimeUnit.SECONDS.toNanos(120));
    if (config.featureGates().useStrimziPodSetsEnabled()) {
        strimziPodSetController = new StrimziPodSetController(namespace, config.getCustomResourceSelector(), resourceOperatorSupplier.kafkaOperator, resourceOperatorSupplier.strimziPodSetOperator, resourceOperatorSupplier.podOperations);
        strimziPodSetController.start();
    }
    List<Future> watchFutures = new ArrayList<>(8);
    List<AbstractOperator<?, ?, ?, ?>> operators = new ArrayList<>(asList(kafkaAssemblyOperator, kafkaMirrorMakerAssemblyOperator, kafkaConnectAssemblyOperator, kafkaBridgeAssemblyOperator, kafkaMirrorMaker2AssemblyOperator));
    for (AbstractOperator<?, ?, ?, ?> operator : operators) {
        watchFutures.add(operator.createWatch(namespace, operator.recreateWatch(namespace)).compose(w -> {
            LOGGER.info("Opened watch for {} operator", operator.kind());
            watchByKind.put(operator.kind(), w);
            return Future.succeededFuture();
        }));
    }
    watchFutures.add(AbstractConnectOperator.createConnectorWatch(kafkaConnectAssemblyOperator, namespace, config.getCustomResourceSelector()));
    watchFutures.add(kafkaRebalanceAssemblyOperator.createRebalanceWatch(namespace));
    CompositeFuture.join(watchFutures).compose(f -> {
        LOGGER.info("Setting up periodic reconciliation for namespace {}", namespace);
        this.reconcileTimer = vertx.setPeriodic(this.config.getReconciliationIntervalMs(), res2 -> {
            LOGGER.info("Triggering periodic reconciliation for namespace {}", namespace);
            reconcileAll("timer");
        });
        return startHealthServer().map((Void) null);
    }).onComplete(start);
}
Also used : KafkaAssemblyOperator(io.strimzi.operator.cluster.operator.assembly.KafkaAssemblyOperator) KafkaMirrorMaker2AssemblyOperator(io.strimzi.operator.cluster.operator.assembly.KafkaMirrorMaker2AssemblyOperator) KafkaBridgeAssemblyOperator(io.strimzi.operator.cluster.operator.assembly.KafkaBridgeAssemblyOperator) HttpServer(io.vertx.core.http.HttpServer) AbstractConnectOperator(io.strimzi.operator.cluster.operator.assembly.AbstractConnectOperator) Watch(io.fabric8.kubernetes.client.Watch) ArrayList(java.util.ArrayList) CompositeFuture(io.vertx.core.CompositeFuture) Arrays.asList(java.util.Arrays.asList) Map(java.util.Map) ResourceOperatorSupplier(io.strimzi.operator.cluster.operator.resource.ResourceOperatorSupplier) AsyncResult(io.vertx.core.AsyncResult) KafkaRebalanceAssemblyOperator(io.strimzi.operator.cluster.operator.assembly.KafkaRebalanceAssemblyOperator) KafkaMirrorMakerAssemblyOperator(io.strimzi.operator.cluster.operator.assembly.KafkaMirrorMakerAssemblyOperator) AbstractOperator(io.strimzi.operator.common.AbstractOperator) Promise(io.vertx.core.Promise) ConcurrentHashMap(java.util.concurrent.ConcurrentHashMap) Future(io.vertx.core.Future) TimeUnit(java.util.concurrent.TimeUnit) List(java.util.List) Logger(org.apache.logging.log4j.Logger) AbstractVerticle(io.vertx.core.AbstractVerticle) PrometheusMeterRegistry(io.micrometer.prometheus.PrometheusMeterRegistry) KubernetesClient(io.fabric8.kubernetes.client.KubernetesClient) KafkaConnectAssemblyOperator(io.strimzi.operator.cluster.operator.assembly.KafkaConnectAssemblyOperator) Handler(io.vertx.core.Handler) LogManager(org.apache.logging.log4j.LogManager) StrimziPodSetController(io.strimzi.operator.cluster.operator.assembly.StrimziPodSetController) ArrayList(java.util.ArrayList) CompositeFuture(io.vertx.core.CompositeFuture) Future(io.vertx.core.Future) StrimziPodSetController(io.strimzi.operator.cluster.operator.assembly.StrimziPodSetController) AbstractOperator(io.strimzi.operator.common.AbstractOperator)

Aggregations

KubernetesClient (io.fabric8.kubernetes.client.KubernetesClient)2 Watch (io.fabric8.kubernetes.client.Watch)2 PrometheusMeterRegistry (io.micrometer.prometheus.PrometheusMeterRegistry)2 AbstractConnectOperator (io.strimzi.operator.cluster.operator.assembly.AbstractConnectOperator)2 KafkaAssemblyOperator (io.strimzi.operator.cluster.operator.assembly.KafkaAssemblyOperator)2 KafkaBridgeAssemblyOperator (io.strimzi.operator.cluster.operator.assembly.KafkaBridgeAssemblyOperator)2 KafkaConnectAssemblyOperator (io.strimzi.operator.cluster.operator.assembly.KafkaConnectAssemblyOperator)2 KafkaMirrorMaker2AssemblyOperator (io.strimzi.operator.cluster.operator.assembly.KafkaMirrorMaker2AssemblyOperator)2 KafkaMirrorMakerAssemblyOperator (io.strimzi.operator.cluster.operator.assembly.KafkaMirrorMakerAssemblyOperator)2 KafkaRebalanceAssemblyOperator (io.strimzi.operator.cluster.operator.assembly.KafkaRebalanceAssemblyOperator)2 StrimziPodSetController (io.strimzi.operator.cluster.operator.assembly.StrimziPodSetController)2 ResourceOperatorSupplier (io.strimzi.operator.cluster.operator.resource.ResourceOperatorSupplier)2 AbstractOperator (io.strimzi.operator.common.AbstractOperator)2 AbstractVerticle (io.vertx.core.AbstractVerticle)2 AsyncResult (io.vertx.core.AsyncResult)2 CompositeFuture (io.vertx.core.CompositeFuture)2 Future (io.vertx.core.Future)2 Handler (io.vertx.core.Handler)2 Promise (io.vertx.core.Promise)2 HttpServer (io.vertx.core.http.HttpServer)2