use of io.strimzi.api.kafka.model.KafkaConnectSpecBuilder 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();
}
use of io.strimzi.api.kafka.model.KafkaConnectSpecBuilder 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();
}
use of io.strimzi.api.kafka.model.KafkaConnectSpecBuilder in project cos-fleetshard by bf2fc6cc711aee1a0c2a.
the class DebeziumOperandController method doReify.
@Override
protected List<HasMetadata> doReify(ManagedConnector connector, DebeziumShardMetadata shardMetadata, ConnectorConfiguration<ObjectNode> connectorConfiguration, ServiceAccountSpec serviceAccountSpec) {
final Map<String, String> secretsData = createSecretsData(connectorConfiguration.getConnectorSpec());
final Secret secret = new SecretBuilder().withMetadata(new ObjectMetaBuilder().withName(connector.getMetadata().getName() + Resources.CONNECTOR_SECRET_SUFFIX).build()).addToData(EXTERNAL_CONFIG_FILE, asBytesBase64(secretsData)).addToData(KAFKA_CLIENT_SECRET_KEY, serviceAccountSpec.getClientSecret()).build();
final KafkaConnectSpecBuilder kcsb = new KafkaConnectSpecBuilder().withReplicas(1).withBootstrapServers(connector.getSpec().getDeployment().getKafka().getUrl()).withKafkaClientAuthenticationPlain(new KafkaClientAuthenticationPlainBuilder().withUsername(serviceAccountSpec.getClientId()).withPasswordSecret(new PasswordSecretSourceBuilder().withSecretName(secret.getMetadata().getName()).withPassword(KAFKA_CLIENT_SECRET_KEY).build()).build()).addToConfig(DebeziumConstants.DEFAULT_CONFIG_OPTIONS).addToConfig(new TreeMap<>(configuration.kafkaConnect().config())).addToConfig("group.id", connector.getMetadata().getName()).addToConfig("key.converter", configuration.keyConverter()).addToConfig("value.converter", configuration.valueConverter()).addToConfig("offset.storage.topic", connector.getMetadata().getName() + "-offset").addToConfig("config.storage.topic", connector.getMetadata().getName() + "-config").addToConfig("status.storage.topic", connector.getMetadata().getName() + "-status").addToConfig("connector.secret.name", secret.getMetadata().getName()).addToConfig("connector.secret.checksum", Secrets.computeChecksum(secret)).withTls(new ClientTlsBuilder().withTrustedCertificates(Collections.emptyList()).build()).withExternalConfiguration(new ExternalConfigurationBuilder().addToVolumes(new ExternalConfigurationVolumeSourceBuilder().withName(EXTERNAL_CONFIG_DIRECTORY).withSecret(new SecretVolumeSourceBuilder().withSecretName(secret.getMetadata().getName()).build()).build()).build());
kcsb.withImage(shardMetadata.getContainerImage());
final KafkaConnect kc = new KafkaConnectBuilder().withApiVersion(Constants.RESOURCE_GROUP_NAME + "/" + KafkaConnect.CONSUMED_VERSION).withMetadata(new ObjectMetaBuilder().withName(connector.getMetadata().getName()).addToAnnotations(STRIMZI_IO_USE_CONNECTOR_RESOURCES, "true").build()).withSpec(kcsb.build()).build();
final KafkaConnector kctr = new KafkaConnectorBuilder().withApiVersion(Constants.RESOURCE_GROUP_NAME + "/" + KafkaConnector.CONSUMED_VERSION).withMetadata(new ObjectMetaBuilder().withName(connector.getMetadata().getName()).addToLabels(STRIMZI_DOMAIN + "cluster", connector.getMetadata().getName()).build()).withSpec(new KafkaConnectorSpecBuilder().withClassName(shardMetadata.getConnectorClass()).withTasksMax(1).withPause(false).withConfig(createConfig(configuration, connectorConfiguration.getConnectorSpec())).build()).build();
return List.of(secret, kc, kctr);
}
Aggregations