Search in sources :

Example 1 with ClientTls

use of io.strimzi.api.kafka.model.ClientTls in project strimzi by strimzi.

the class KafkaMirrorMaker2Cluster method getVolumes.

@Override
protected List<Volume> getVolumes(boolean isOpenShift) {
    List<Volume> volumeList = super.getVolumes(isOpenShift);
    for (KafkaMirrorMaker2ClusterSpec mirrorMaker2Cluster : clusters) {
        String alias = mirrorMaker2Cluster.getAlias();
        ClientTls tls = mirrorMaker2Cluster.getTls();
        if (tls != null) {
            VolumeUtils.createSecretVolume(volumeList, tls.getTrustedCertificates(), isOpenShift, alias);
        }
        AuthenticationUtils.configureClientAuthenticationVolumes(mirrorMaker2Cluster.getAuthentication(), volumeList, mirrorMaker2Cluster.getAlias() + "-oauth-certs", isOpenShift, mirrorMaker2Cluster.getAlias() + '-', true);
    }
    return volumeList;
}
Also used : ClientTls(io.strimzi.api.kafka.model.ClientTls) Volume(io.fabric8.kubernetes.api.model.Volume) KafkaMirrorMaker2ClusterSpec(io.strimzi.api.kafka.model.KafkaMirrorMaker2ClusterSpec)

Example 2 with ClientTls

use of io.strimzi.api.kafka.model.ClientTls in project strimzi by strimzi.

the class KafkaMirrorMaker2Cluster method getClusterTrustedCerts.

private void getClusterTrustedCerts(final StringBuilder clustersTrustedCerts, KafkaMirrorMaker2ClusterSpec mirrorMaker2Cluster, String clusterAlias) {
    ClientTls tls = mirrorMaker2Cluster.getTls();
    if (tls != null) {
        List<CertSecretSource> trustedCertificates = tls.getTrustedCertificates();
        if (trustedCertificates != null && trustedCertificates.size() > 0) {
            if (clustersTrustedCerts.length() > 0) {
                clustersTrustedCerts.append("\n");
            }
            clustersTrustedCerts.append(clusterAlias);
            clustersTrustedCerts.append("=");
            boolean separator = false;
            for (CertSecretSource certSecretSource : trustedCertificates) {
                if (separator) {
                    clustersTrustedCerts.append(";");
                }
                clustersTrustedCerts.append(certSecretSource.getSecretName());
                clustersTrustedCerts.append("/");
                clustersTrustedCerts.append(certSecretSource.getCertificate());
                separator = true;
            }
        }
    }
}
Also used : ClientTls(io.strimzi.api.kafka.model.ClientTls) CertSecretSource(io.strimzi.api.kafka.model.CertSecretSource)

Example 3 with ClientTls

use of io.strimzi.api.kafka.model.ClientTls in project strimzi-kafka-operator by strimzi.

the class KafkaMirrorMaker2Cluster method buildKafkaConnectSpec.

private static KafkaConnectSpec buildKafkaConnectSpec(KafkaMirrorMaker2Spec spec, KafkaMirrorMaker2ClusterSpec connectCluster) {
    ClientTls connectTls = null;
    ClientTls mirrorMaker2ConnectClusterTls = connectCluster.getTls();
    if (mirrorMaker2ConnectClusterTls != null) {
        connectTls = new ClientTls();
        connectTls.setTrustedCertificates(mirrorMaker2ConnectClusterTls.getTrustedCertificates());
        for (Entry<String, Object> entry : mirrorMaker2ConnectClusterTls.getAdditionalProperties().entrySet()) {
            connectTls.setAdditionalProperty(entry.getKey(), entry.getValue());
        }
    }
    return new KafkaConnectSpecBuilder().withBootstrapServers(connectCluster.getBootstrapServers()).withTls(connectTls).withAuthentication(connectCluster.getAuthentication()).withConfig(connectCluster.getConfig()).withLogging(spec.getLogging()).withReplicas(spec.getReplicas()).withVersion(spec.getVersion()).withImage(spec.getImage()).withResources(spec.getResources()).withLivenessProbe(spec.getLivenessProbe()).withReadinessProbe(spec.getReadinessProbe()).withJvmOptions(spec.getJvmOptions()).withJmxOptions(spec.getJmxOptions()).withMetricsConfig(spec.getMetricsConfig()).withTracing(spec.getTracing()).withTemplate(spec.getTemplate()).withExternalConfiguration(spec.getExternalConfiguration()).build();
}
Also used : ClientTls(io.strimzi.api.kafka.model.ClientTls) KafkaConnectSpecBuilder(io.strimzi.api.kafka.model.KafkaConnectSpecBuilder)

Example 4 with ClientTls

use of io.strimzi.api.kafka.model.ClientTls in project strimzi by strimzi.

the class KafkaMirrorMaker2Cluster method getVolumeMounts.

@Override
protected List<VolumeMount> getVolumeMounts() {
    List<VolumeMount> volumeMountList = super.getVolumeMounts();
    for (KafkaMirrorMaker2ClusterSpec mirrorMaker2Cluster : clusters) {
        String alias = mirrorMaker2Cluster.getAlias();
        String tlsVolumeMountPath = buildClusterVolumeMountPath(MIRRORMAKER_2_TLS_CERTS_BASE_VOLUME_MOUNT, alias);
        ClientTls kafkaMirrorMaker2Tls = mirrorMaker2Cluster.getTls();
        if (kafkaMirrorMaker2Tls != null) {
            VolumeUtils.createSecretVolumeMount(volumeMountList, kafkaMirrorMaker2Tls.getTrustedCertificates(), tlsVolumeMountPath, alias);
        }
        String passwordVolumeMountPath = buildClusterVolumeMountPath(MIRRORMAKER_2_PASSWORD_VOLUME_MOUNT, alias);
        String oauthTlsVolumeMountPath = buildClusterVolumeMountPath(MIRRORMAKER_2_OAUTH_TLS_CERTS_BASE_VOLUME_MOUNT, alias);
        String oauthVolumeMountPath = buildClusterVolumeMountPath(MIRRORMAKER_2_OAUTH_SECRETS_BASE_VOLUME_MOUNT, alias);
        AuthenticationUtils.configureClientAuthenticationVolumeMounts(mirrorMaker2Cluster.getAuthentication(), volumeMountList, tlsVolumeMountPath, passwordVolumeMountPath, oauthTlsVolumeMountPath, mirrorMaker2Cluster.getAlias() + "-oauth-certs", mirrorMaker2Cluster.getAlias() + '-', true, oauthVolumeMountPath);
    }
    return volumeMountList;
}
Also used : ClientTls(io.strimzi.api.kafka.model.ClientTls) KafkaMirrorMaker2ClusterSpec(io.strimzi.api.kafka.model.KafkaMirrorMaker2ClusterSpec) VolumeMount(io.fabric8.kubernetes.api.model.VolumeMount)

Example 5 with ClientTls

use of io.strimzi.api.kafka.model.ClientTls in project strimzi by strimzi.

the class KafkaMirrorMaker2Cluster method buildKafkaConnectSpec.

private static KafkaConnectSpec buildKafkaConnectSpec(KafkaMirrorMaker2Spec spec, KafkaMirrorMaker2ClusterSpec connectCluster) {
    ClientTls connectTls = null;
    ClientTls mirrorMaker2ConnectClusterTls = connectCluster.getTls();
    if (mirrorMaker2ConnectClusterTls != null) {
        connectTls = new ClientTls();
        connectTls.setTrustedCertificates(mirrorMaker2ConnectClusterTls.getTrustedCertificates());
        for (Entry<String, Object> entry : mirrorMaker2ConnectClusterTls.getAdditionalProperties().entrySet()) {
            connectTls.setAdditionalProperty(entry.getKey(), entry.getValue());
        }
    }
    return new KafkaConnectSpecBuilder().withBootstrapServers(connectCluster.getBootstrapServers()).withTls(connectTls).withAuthentication(connectCluster.getAuthentication()).withConfig(connectCluster.getConfig()).withLogging(spec.getLogging()).withReplicas(spec.getReplicas()).withVersion(spec.getVersion()).withImage(spec.getImage()).withResources(spec.getResources()).withLivenessProbe(spec.getLivenessProbe()).withReadinessProbe(spec.getReadinessProbe()).withJvmOptions(spec.getJvmOptions()).withJmxOptions(spec.getJmxOptions()).withMetricsConfig(spec.getMetricsConfig()).withTracing(spec.getTracing()).withTemplate(spec.getTemplate()).withExternalConfiguration(spec.getExternalConfiguration()).build();
}
Also used : ClientTls(io.strimzi.api.kafka.model.ClientTls) KafkaConnectSpecBuilder(io.strimzi.api.kafka.model.KafkaConnectSpecBuilder)

Aggregations

ClientTls (io.strimzi.api.kafka.model.ClientTls)8 KafkaMirrorMaker2ClusterSpec (io.strimzi.api.kafka.model.KafkaMirrorMaker2ClusterSpec)4 Volume (io.fabric8.kubernetes.api.model.Volume)2 VolumeMount (io.fabric8.kubernetes.api.model.VolumeMount)2 CertSecretSource (io.strimzi.api.kafka.model.CertSecretSource)2 KafkaConnectSpecBuilder (io.strimzi.api.kafka.model.KafkaConnectSpecBuilder)2