Search in sources :

Example 1 with OpenSslCertManager

use of io.strimzi.certs.OpenSslCertManager in project strimzi by strimzi.

the class Main method run.

static Future<String> run(Vertx vertx, KubernetesClient client, AdminClientProvider adminClientProvider, UserOperatorConfig config) {
    Util.printEnvInfo();
    String dnsCacheTtl = System.getenv("STRIMZI_DNS_CACHE_TTL") == null ? "30" : System.getenv("STRIMZI_DNS_CACHE_TTL");
    Security.setProperty("networkaddress.cache.ttl", dnsCacheTtl);
    OpenSslCertManager certManager = new OpenSslCertManager();
    SecretOperator secretOperations = new SecretOperator(vertx, client);
    CrdOperator<KubernetesClient, KafkaUser, KafkaUserList> crdOperations = new CrdOperator<>(vertx, client, KafkaUser.class, KafkaUserList.class, KafkaUser.RESOURCE_KIND);
    return createAdminClient(adminClientProvider, config, secretOperations).compose(adminClient -> {
        SimpleAclOperator aclOperations = new SimpleAclOperator(vertx, adminClient);
        ScramCredentialsOperator scramCredentialsOperator = new ScramCredentialsOperator(vertx, adminClient);
        QuotasOperator quotasOperator = new QuotasOperator(vertx, adminClient);
        KafkaUserOperator kafkaUserOperations = new KafkaUserOperator(vertx, certManager, crdOperations, secretOperations, scramCredentialsOperator, quotasOperator, aclOperations, config);
        Promise<String> promise = Promise.promise();
        UserOperator operator = new UserOperator(config.getNamespace(), config, client, kafkaUserOperations);
        vertx.deployVerticle(operator, res -> {
            if (res.succeeded()) {
                LOGGER.info("User Operator verticle started in namespace {}", config.getNamespace());
            } else {
                LOGGER.error("User Operator verticle in namespace {} failed to start", config.getNamespace(), res.cause());
                System.exit(1);
            }
            promise.handle(res);
        });
        return promise.future();
    });
}
Also used : KafkaUserOperator(io.strimzi.operator.user.operator.KafkaUserOperator) DefaultKubernetesClient(io.fabric8.kubernetes.client.DefaultKubernetesClient) KubernetesClient(io.fabric8.kubernetes.client.KubernetesClient) KafkaUserOperator(io.strimzi.operator.user.operator.KafkaUserOperator) KafkaUserList(io.strimzi.api.kafka.KafkaUserList) SimpleAclOperator(io.strimzi.operator.user.operator.SimpleAclOperator) OpenSslCertManager(io.strimzi.certs.OpenSslCertManager) SecretOperator(io.strimzi.operator.common.operator.resource.SecretOperator) QuotasOperator(io.strimzi.operator.user.operator.QuotasOperator) ScramCredentialsOperator(io.strimzi.operator.user.operator.ScramCredentialsOperator) CrdOperator(io.strimzi.operator.common.operator.resource.CrdOperator) KafkaUser(io.strimzi.api.kafka.model.KafkaUser)

Example 2 with OpenSslCertManager

use of io.strimzi.certs.OpenSslCertManager 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 OpenSslCertManager

use of io.strimzi.certs.OpenSslCertManager in project strimzi by strimzi.

the class KafkaClusterTest method generateBrokerSecret.

private Secret generateBrokerSecret(Set<String> externalBootstrapAddress, Map<Integer, Set<String>> externalAddresses) {
    ClusterCa clusterCa = new ClusterCa(Reconciliation.DUMMY_RECONCILIATION, new OpenSslCertManager(), new PasswordGenerator(10, "a", "a"), cluster, null, null);
    clusterCa.createRenewOrReplace(namespace, cluster, emptyMap(), emptyMap(), emptyMap(), null, true);
    ClientsCa clientsCa = new ClientsCa(Reconciliation.DUMMY_RECONCILIATION, new OpenSslCertManager(), new PasswordGenerator(10, "a", "a"), null, null, null, null, 365, 30, true, CertificateExpirationPolicy.RENEW_CERTIFICATE);
    clientsCa.createRenewOrReplace(namespace, cluster, emptyMap(), emptyMap(), emptyMap(), null, true);
    kc.generateCertificates(kafkaAssembly, clusterCa, externalBootstrapAddress, externalAddresses, true);
    return kc.generateBrokersSecret(clusterCa, clientsCa);
}
Also used : OpenSslCertManager(io.strimzi.certs.OpenSslCertManager) PasswordGenerator(io.strimzi.operator.common.PasswordGenerator)

Example 4 with OpenSslCertManager

use of io.strimzi.certs.OpenSslCertManager 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 5 with OpenSslCertManager

use of io.strimzi.certs.OpenSslCertManager in project strimzi-kafka-operator by strimzi.

the class Main method run.

static Future<String> run(Vertx vertx, KubernetesClient client, AdminClientProvider adminClientProvider, UserOperatorConfig config) {
    Util.printEnvInfo();
    String dnsCacheTtl = System.getenv("STRIMZI_DNS_CACHE_TTL") == null ? "30" : System.getenv("STRIMZI_DNS_CACHE_TTL");
    Security.setProperty("networkaddress.cache.ttl", dnsCacheTtl);
    OpenSslCertManager certManager = new OpenSslCertManager();
    SecretOperator secretOperations = new SecretOperator(vertx, client);
    CrdOperator<KubernetesClient, KafkaUser, KafkaUserList> crdOperations = new CrdOperator<>(vertx, client, KafkaUser.class, KafkaUserList.class, KafkaUser.RESOURCE_KIND);
    return createAdminClient(adminClientProvider, config, secretOperations).compose(adminClient -> {
        SimpleAclOperator aclOperations = new SimpleAclOperator(vertx, adminClient);
        ScramCredentialsOperator scramCredentialsOperator = new ScramCredentialsOperator(vertx, adminClient);
        QuotasOperator quotasOperator = new QuotasOperator(vertx, adminClient);
        KafkaUserOperator kafkaUserOperations = new KafkaUserOperator(vertx, certManager, crdOperations, secretOperations, scramCredentialsOperator, quotasOperator, aclOperations, config);
        Promise<String> promise = Promise.promise();
        UserOperator operator = new UserOperator(config.getNamespace(), config, client, kafkaUserOperations);
        vertx.deployVerticle(operator, res -> {
            if (res.succeeded()) {
                LOGGER.info("User Operator verticle started in namespace {}", config.getNamespace());
            } else {
                LOGGER.error("User Operator verticle in namespace {} failed to start", config.getNamespace(), res.cause());
                System.exit(1);
            }
            promise.handle(res);
        });
        return promise.future();
    });
}
Also used : KafkaUserOperator(io.strimzi.operator.user.operator.KafkaUserOperator) DefaultKubernetesClient(io.fabric8.kubernetes.client.DefaultKubernetesClient) KubernetesClient(io.fabric8.kubernetes.client.KubernetesClient) KafkaUserOperator(io.strimzi.operator.user.operator.KafkaUserOperator) KafkaUserList(io.strimzi.api.kafka.KafkaUserList) SimpleAclOperator(io.strimzi.operator.user.operator.SimpleAclOperator) OpenSslCertManager(io.strimzi.certs.OpenSslCertManager) SecretOperator(io.strimzi.operator.common.operator.resource.SecretOperator) QuotasOperator(io.strimzi.operator.user.operator.QuotasOperator) ScramCredentialsOperator(io.strimzi.operator.user.operator.ScramCredentialsOperator) CrdOperator(io.strimzi.operator.common.operator.resource.CrdOperator) KafkaUser(io.strimzi.api.kafka.model.KafkaUser)

Aggregations

OpenSslCertManager (io.strimzi.certs.OpenSslCertManager)8 PasswordGenerator (io.strimzi.operator.common.PasswordGenerator)6 DefaultKubernetesClient (io.fabric8.kubernetes.client.DefaultKubernetesClient)2 KubernetesClient (io.fabric8.kubernetes.client.KubernetesClient)2 KafkaUserList (io.strimzi.api.kafka.KafkaUserList)2 KafkaUser (io.strimzi.api.kafka.model.KafkaUser)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 ResourceOperatorSupplier (io.strimzi.operator.cluster.operator.resource.ResourceOperatorSupplier)2 CrdOperator (io.strimzi.operator.common.operator.resource.CrdOperator)2 SecretOperator (io.strimzi.operator.common.operator.resource.SecretOperator)2 KafkaUserOperator (io.strimzi.operator.user.operator.KafkaUserOperator)2 QuotasOperator (io.strimzi.operator.user.operator.QuotasOperator)2 ScramCredentialsOperator (io.strimzi.operator.user.operator.ScramCredentialsOperator)2 SimpleAclOperator (io.strimzi.operator.user.operator.SimpleAclOperator)2 CompositeFuture (io.vertx.core.CompositeFuture)2