Search in sources :

Example 1 with KafkaConnectAssemblyOperator

use of io.strimzi.operator.cluster.operator.assembly.KafkaConnectAssemblyOperator 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 KafkaConnectAssemblyOperator

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

the class Main method run.

static CompositeFuture run(Vertx vertx, KubernetesClient client, PlatformFeaturesAvailability pfa, ClusterOperatorConfig config) {
    Util.printEnvInfo();
    ResourceOperatorSupplier resourceOperatorSupplier = new ResourceOperatorSupplier(vertx, client, pfa, config.featureGates(), config.getOperationTimeoutMs());
    OpenSslCertManager certManager = new OpenSslCertManager();
    PasswordGenerator passwordGenerator = new PasswordGenerator(12, "abcdefghijklmnopqrstuvwxyz" + "ABCDEFGHIJKLMNOPQRSTUVWXYZ", "abcdefghijklmnopqrstuvwxyz" + "ABCDEFGHIJKLMNOPQRSTUVWXYZ" + "0123456789");
    KafkaAssemblyOperator kafkaClusterOperations = new KafkaAssemblyOperator(vertx, pfa, certManager, passwordGenerator, resourceOperatorSupplier, config);
    KafkaConnectAssemblyOperator kafkaConnectClusterOperations = new KafkaConnectAssemblyOperator(vertx, pfa, resourceOperatorSupplier, config);
    KafkaMirrorMaker2AssemblyOperator kafkaMirrorMaker2AssemblyOperator = new KafkaMirrorMaker2AssemblyOperator(vertx, pfa, resourceOperatorSupplier, config);
    KafkaMirrorMakerAssemblyOperator kafkaMirrorMakerAssemblyOperator = new KafkaMirrorMakerAssemblyOperator(vertx, pfa, certManager, passwordGenerator, resourceOperatorSupplier, config);
    KafkaBridgeAssemblyOperator kafkaBridgeAssemblyOperator = new KafkaBridgeAssemblyOperator(vertx, pfa, certManager, passwordGenerator, resourceOperatorSupplier, config);
    KafkaRebalanceAssemblyOperator kafkaRebalanceAssemblyOperator = new KafkaRebalanceAssemblyOperator(vertx, pfa, resourceOperatorSupplier, config);
    List<Future> futures = new ArrayList<>(config.getNamespaces().size());
    for (String namespace : config.getNamespaces()) {
        Promise<String> prom = Promise.promise();
        futures.add(prom.future());
        ClusterOperator operator = new ClusterOperator(namespace, config, client, kafkaClusterOperations, kafkaConnectClusterOperations, kafkaMirrorMakerAssemblyOperator, kafkaMirrorMaker2AssemblyOperator, kafkaBridgeAssemblyOperator, kafkaRebalanceAssemblyOperator, resourceOperatorSupplier);
        vertx.deployVerticle(operator, res -> {
            if (res.succeeded()) {
                if (config.getCustomResourceSelector() != null) {
                    LOGGER.info("Cluster Operator verticle started in namespace {} with label selector {}", namespace, config.getCustomResourceSelector());
                } else {
                    LOGGER.info("Cluster Operator verticle started in namespace {} without label selector", namespace);
                }
            } else {
                LOGGER.error("Cluster Operator verticle in namespace {} failed to start", namespace, res.cause());
                System.exit(1);
            }
            prom.handle(res);
        });
    }
    return CompositeFuture.join(futures);
}
Also used : KafkaAssemblyOperator(io.strimzi.operator.cluster.operator.assembly.KafkaAssemblyOperator) KafkaBridgeAssemblyOperator(io.strimzi.operator.cluster.operator.assembly.KafkaBridgeAssemblyOperator) KafkaMirrorMaker2AssemblyOperator(io.strimzi.operator.cluster.operator.assembly.KafkaMirrorMaker2AssemblyOperator) ArrayList(java.util.ArrayList) OpenSslCertManager(io.strimzi.certs.OpenSslCertManager) KafkaConnectAssemblyOperator(io.strimzi.operator.cluster.operator.assembly.KafkaConnectAssemblyOperator) ResourceOperatorSupplier(io.strimzi.operator.cluster.operator.resource.ResourceOperatorSupplier) PasswordGenerator(io.strimzi.operator.common.PasswordGenerator) CompositeFuture(io.vertx.core.CompositeFuture) Future(io.vertx.core.Future) KafkaMirrorMakerAssemblyOperator(io.strimzi.operator.cluster.operator.assembly.KafkaMirrorMakerAssemblyOperator) KafkaRebalanceAssemblyOperator(io.strimzi.operator.cluster.operator.assembly.KafkaRebalanceAssemblyOperator)

Example 3 with KafkaConnectAssemblyOperator

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

the class Main method run.

static CompositeFuture run(Vertx vertx, KubernetesClient client, PlatformFeaturesAvailability pfa, ClusterOperatorConfig config) {
    Util.printEnvInfo();
    ResourceOperatorSupplier resourceOperatorSupplier = new ResourceOperatorSupplier(vertx, client, pfa, config.featureGates(), config.getOperationTimeoutMs());
    OpenSslCertManager certManager = new OpenSslCertManager();
    PasswordGenerator passwordGenerator = new PasswordGenerator(12, "abcdefghijklmnopqrstuvwxyz" + "ABCDEFGHIJKLMNOPQRSTUVWXYZ", "abcdefghijklmnopqrstuvwxyz" + "ABCDEFGHIJKLMNOPQRSTUVWXYZ" + "0123456789");
    KafkaAssemblyOperator kafkaClusterOperations = new KafkaAssemblyOperator(vertx, pfa, certManager, passwordGenerator, resourceOperatorSupplier, config);
    KafkaConnectAssemblyOperator kafkaConnectClusterOperations = new KafkaConnectAssemblyOperator(vertx, pfa, resourceOperatorSupplier, config);
    KafkaMirrorMaker2AssemblyOperator kafkaMirrorMaker2AssemblyOperator = new KafkaMirrorMaker2AssemblyOperator(vertx, pfa, resourceOperatorSupplier, config);
    KafkaMirrorMakerAssemblyOperator kafkaMirrorMakerAssemblyOperator = new KafkaMirrorMakerAssemblyOperator(vertx, pfa, certManager, passwordGenerator, resourceOperatorSupplier, config);
    KafkaBridgeAssemblyOperator kafkaBridgeAssemblyOperator = new KafkaBridgeAssemblyOperator(vertx, pfa, certManager, passwordGenerator, resourceOperatorSupplier, config);
    KafkaRebalanceAssemblyOperator kafkaRebalanceAssemblyOperator = new KafkaRebalanceAssemblyOperator(vertx, pfa, resourceOperatorSupplier, config);
    List<Future> futures = new ArrayList<>(config.getNamespaces().size());
    for (String namespace : config.getNamespaces()) {
        Promise<String> prom = Promise.promise();
        futures.add(prom.future());
        ClusterOperator operator = new ClusterOperator(namespace, config, client, kafkaClusterOperations, kafkaConnectClusterOperations, kafkaMirrorMakerAssemblyOperator, kafkaMirrorMaker2AssemblyOperator, kafkaBridgeAssemblyOperator, kafkaRebalanceAssemblyOperator, resourceOperatorSupplier);
        vertx.deployVerticle(operator, res -> {
            if (res.succeeded()) {
                if (config.getCustomResourceSelector() != null) {
                    LOGGER.info("Cluster Operator verticle started in namespace {} with label selector {}", namespace, config.getCustomResourceSelector());
                } else {
                    LOGGER.info("Cluster Operator verticle started in namespace {} without label selector", namespace);
                }
            } else {
                LOGGER.error("Cluster Operator verticle in namespace {} failed to start", namespace, res.cause());
                System.exit(1);
            }
            prom.handle(res);
        });
    }
    return CompositeFuture.join(futures);
}
Also used : KafkaAssemblyOperator(io.strimzi.operator.cluster.operator.assembly.KafkaAssemblyOperator) KafkaBridgeAssemblyOperator(io.strimzi.operator.cluster.operator.assembly.KafkaBridgeAssemblyOperator) KafkaMirrorMaker2AssemblyOperator(io.strimzi.operator.cluster.operator.assembly.KafkaMirrorMaker2AssemblyOperator) ArrayList(java.util.ArrayList) OpenSslCertManager(io.strimzi.certs.OpenSslCertManager) KafkaConnectAssemblyOperator(io.strimzi.operator.cluster.operator.assembly.KafkaConnectAssemblyOperator) ResourceOperatorSupplier(io.strimzi.operator.cluster.operator.resource.ResourceOperatorSupplier) PasswordGenerator(io.strimzi.operator.common.PasswordGenerator) CompositeFuture(io.vertx.core.CompositeFuture) Future(io.vertx.core.Future) KafkaMirrorMakerAssemblyOperator(io.strimzi.operator.cluster.operator.assembly.KafkaMirrorMakerAssemblyOperator) KafkaRebalanceAssemblyOperator(io.strimzi.operator.cluster.operator.assembly.KafkaRebalanceAssemblyOperator)

Example 4 with KafkaConnectAssemblyOperator

use of io.strimzi.operator.cluster.operator.assembly.KafkaConnectAssemblyOperator 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

KafkaAssemblyOperator (io.strimzi.operator.cluster.operator.assembly.KafkaAssemblyOperator)4 KafkaBridgeAssemblyOperator (io.strimzi.operator.cluster.operator.assembly.KafkaBridgeAssemblyOperator)4 KafkaConnectAssemblyOperator (io.strimzi.operator.cluster.operator.assembly.KafkaConnectAssemblyOperator)4 KafkaMirrorMaker2AssemblyOperator (io.strimzi.operator.cluster.operator.assembly.KafkaMirrorMaker2AssemblyOperator)4 KafkaMirrorMakerAssemblyOperator (io.strimzi.operator.cluster.operator.assembly.KafkaMirrorMakerAssemblyOperator)4 KafkaRebalanceAssemblyOperator (io.strimzi.operator.cluster.operator.assembly.KafkaRebalanceAssemblyOperator)4 ResourceOperatorSupplier (io.strimzi.operator.cluster.operator.resource.ResourceOperatorSupplier)4 CompositeFuture (io.vertx.core.CompositeFuture)4 Future (io.vertx.core.Future)4 ArrayList (java.util.ArrayList)4 KubernetesClient (io.fabric8.kubernetes.client.KubernetesClient)2 Watch (io.fabric8.kubernetes.client.Watch)2 PrometheusMeterRegistry (io.micrometer.prometheus.PrometheusMeterRegistry)2 OpenSslCertManager (io.strimzi.certs.OpenSslCertManager)2 AbstractConnectOperator (io.strimzi.operator.cluster.operator.assembly.AbstractConnectOperator)2 StrimziPodSetController (io.strimzi.operator.cluster.operator.assembly.StrimziPodSetController)2 AbstractOperator (io.strimzi.operator.common.AbstractOperator)2 PasswordGenerator (io.strimzi.operator.common.PasswordGenerator)2 AbstractVerticle (io.vertx.core.AbstractVerticle)2 AsyncResult (io.vertx.core.AsyncResult)2