Search in sources :

Example 46 with JarArtifactBuilder

use of io.strimzi.api.kafka.model.connect.build.JarArtifactBuilder in project strimzi-kafka-operator by strimzi.

the class KafkaConnectTemplates method kafkaConnectWithFilePlugin.

/**
 * Method for creating the KafkaConnect builder with File plugin - using the KafkaConnect build feature.
 * @param name Name for the KafkaConnect resource
 * @param namespaceName namespace, where the KafkaConnect resource will be deployed
 * @param clusterName name of the Kafka cluster
 * @param replicas number of KafkaConnect replicas
 * @return KafkaConnect builder with File plugin
 */
public static KafkaConnectBuilder kafkaConnectWithFilePlugin(String name, String namespaceName, String clusterName, int replicas) {
    final Plugin fileSinkPlugin = new PluginBuilder().withName("file-plugin").withArtifacts(new JarArtifactBuilder().withUrl(Environment.ST_FILE_PLUGIN_URL).build()).build();
    final String imageName = Environment.getImageOutputRegistry() + "/" + namespaceName + "/connect-" + hashStub(String.valueOf(new Random().nextInt(Integer.MAX_VALUE))) + ":latest";
    return kafkaConnect(name, namespaceName, clusterName, replicas).editOrNewSpec().editOrNewBuild().withPlugins(fileSinkPlugin).withNewDockerOutput().withImage(imageName).endDockerOutput().endBuild().endSpec();
}
Also used : Random(java.util.Random) PluginBuilder(io.strimzi.api.kafka.model.connect.build.PluginBuilder) Plugin(io.strimzi.api.kafka.model.connect.build.Plugin) JarArtifactBuilder(io.strimzi.api.kafka.model.connect.build.JarArtifactBuilder)

Aggregations

JarArtifactBuilder (io.strimzi.api.kafka.model.connect.build.JarArtifactBuilder)46 PluginBuilder (io.strimzi.api.kafka.model.connect.build.PluginBuilder)46 Plugin (io.strimzi.api.kafka.model.connect.build.Plugin)40 KafkaConnect (io.strimzi.api.kafka.model.KafkaConnect)38 KafkaConnectResources (io.strimzi.api.kafka.model.KafkaConnectResources)38 KafkaConnector (io.strimzi.api.kafka.model.KafkaConnector)38 Annotations (io.strimzi.operator.common.Annotations)38 Util (io.strimzi.operator.common.Util)38 MatcherAssert.assertThat (org.hamcrest.MatcherAssert.assertThat)38 BeforeAll (org.junit.jupiter.api.BeforeAll)38 ConfigMap (io.fabric8.kubernetes.api.model.ConfigMap)36 Service (io.fabric8.kubernetes.api.model.Service)36 Deployment (io.fabric8.kubernetes.api.model.apps.Deployment)36 NetworkPolicy (io.fabric8.kubernetes.api.model.networking.v1.NetworkPolicy)36 KubernetesClient (io.fabric8.kubernetes.client.KubernetesClient)36 KafkaConnectorList (io.strimzi.api.kafka.KafkaConnectorList)36 KafkaConnectBuilder (io.strimzi.api.kafka.model.KafkaConnectBuilder)36 KafkaConnectStatus (io.strimzi.api.kafka.model.status.KafkaConnectStatus)36 KubernetesVersion (io.strimzi.operator.KubernetesVersion)36 PlatformFeaturesAvailability (io.strimzi.operator.PlatformFeaturesAvailability)36