Search in sources :

Example 51 with PluginBuilder

use of io.strimzi.api.kafka.model.connect.build.PluginBuilder in project strimzi by strimzi.

the class KafkaConnectDockerfileTest method testMultipleJarArtifact.

@ParallelTest
public void testMultipleJarArtifact() {
    Build connectBuild = new BuildBuilder().withPlugins(new PluginBuilder().withName("my-connector-plugin").withArtifacts(jarArtifactNoChecksum, jarArtifactWithChecksum).build()).build();
    KafkaConnectDockerfile df = new KafkaConnectDockerfile("myImage:latest", connectBuild);
    assertThat(df.getDockerfile(), isEquivalent("FROM myImage:latest", "USER root:root", "RUN 'mkdir' '-p' '/opt/kafka/plugins/my-connector-plugin/51e5038c' \\", "      && 'curl' '-L' '--output' '/opt/kafka/plugins/my-connector-plugin/51e5038c/51e5038c.jar' 'https://mydomain.tld/my.jar'", "RUN 'mkdir' '-p' '/opt/kafka/plugins/my-connector-plugin/0df6d15c' \\", "      && 'curl' '-L' '--output' '/opt/kafka/plugins/my-connector-plugin/0df6d15c/0df6d15c.jar' 'https://mydomain.tld/my2.jar' \\", "      && 'echo' 'sha-512-checksum /opt/kafka/plugins/my-connector-plugin/0df6d15c/0df6d15c.jar' > '/opt/kafka/plugins/my-connector-plugin/0df6d15c/0df6d15c.jar.sha512' \\", "      && 'sha512sum' '--check' '/opt/kafka/plugins/my-connector-plugin/0df6d15c/0df6d15c.jar.sha512' \\", "      && 'rm' '-f' '/opt/kafka/plugins/my-connector-plugin/0df6d15c/0df6d15c.jar.sha512'", "USER 1001"));
}
Also used : Build(io.strimzi.api.kafka.model.connect.build.Build) PluginBuilder(io.strimzi.api.kafka.model.connect.build.PluginBuilder) BuildBuilder(io.strimzi.api.kafka.model.connect.build.BuildBuilder) ParallelTest(io.strimzi.test.annotations.ParallelTest)

Example 52 with PluginBuilder

use of io.strimzi.api.kafka.model.connect.build.PluginBuilder in project strimzi by strimzi.

the class KafkaConnectDockerfileTest method testChecksumZipArtifact.

@ParallelTest
public void testChecksumZipArtifact() {
    Build connectBuild = new BuildBuilder().withPlugins(new PluginBuilder().withName("my-connector-plugin").withArtifacts(zipArtifactWithChecksum).build()).build();
    KafkaConnectDockerfile df = new KafkaConnectDockerfile("myImage:latest", connectBuild);
    assertThat(df.getDockerfile(), isEquivalent("FROM myImage:latest", "USER root:root", "RUN 'mkdir' '-p' '/opt/kafka/plugins/my-connector-plugin/90e04094' \\", "      && 'curl' '-L' '--output' '/opt/kafka/plugins/my-connector-plugin/90e04094.zip' 'https://mydomain.tld/my2.zip' \\", "      && 'echo' 'sha-512-checksum /opt/kafka/plugins/my-connector-plugin/90e04094.zip' > '/opt/kafka/plugins/my-connector-plugin/90e04094.zip.sha512' \\", "      && 'sha512sum' '--check' '/opt/kafka/plugins/my-connector-plugin/90e04094.zip.sha512' \\", "      && 'rm' '-f' '/opt/kafka/plugins/my-connector-plugin/90e04094.zip.sha512' \\", "      && 'unzip' '/opt/kafka/plugins/my-connector-plugin/90e04094.zip' '-d' '/opt/kafka/plugins/my-connector-plugin/90e04094' \\", "      && 'find' '/opt/kafka/plugins/my-connector-plugin/90e04094' '-type' 'l' | 'xargs' 'rm' '-f' \\", "      && 'rm' '-vf' '/opt/kafka/plugins/my-connector-plugin/90e04094.zip'", "USER 1001"));
}
Also used : Build(io.strimzi.api.kafka.model.connect.build.Build) PluginBuilder(io.strimzi.api.kafka.model.connect.build.PluginBuilder) BuildBuilder(io.strimzi.api.kafka.model.connect.build.BuildBuilder) ParallelTest(io.strimzi.test.annotations.ParallelTest)

Example 53 with PluginBuilder

use of io.strimzi.api.kafka.model.connect.build.PluginBuilder in project strimzi by strimzi.

the class KafkaConnectDockerfileTest method testInsecureArtifacts.

@ParallelTest
public void testInsecureArtifacts() {
    OtherArtifact art1 = new OtherArtifactBuilder((OtherArtifact) otherArtifactNoChecksum).withInsecure(true).build();
    ZipArtifact art2 = new ZipArtifactBuilder((ZipArtifact) zipArtifactWithChecksum).withInsecure(true).build();
    Build connectBuild = new BuildBuilder().withPlugins(new PluginBuilder().withName("my-connector-plugin").withArtifacts(art1, art2).build()).build();
    KafkaConnectDockerfile df = new KafkaConnectDockerfile("myImage:latest", connectBuild);
    assertThat(df.getDockerfile(), isEquivalent("FROM myImage:latest", "USER root:root", "RUN 'mkdir' '-p' '/opt/kafka/plugins/my-connector-plugin/90e04094' \\", "      && 'curl' '-k' '-L' '--output' '/opt/kafka/plugins/my-connector-plugin/90e04094.zip' 'https://mydomain.tld/my2.zip' \\", "      && 'echo' 'sha-512-checksum /opt/kafka/plugins/my-connector-plugin/90e04094.zip' > '/opt/kafka/plugins/my-connector-plugin/90e04094.zip.sha512' \\", "      && 'sha512sum' '--check' '/opt/kafka/plugins/my-connector-plugin/90e04094.zip.sha512' \\", "      && 'rm' '-f' '/opt/kafka/plugins/my-connector-plugin/90e04094.zip.sha512' \\", "      && 'unzip' '/opt/kafka/plugins/my-connector-plugin/90e04094.zip' '-d' '/opt/kafka/plugins/my-connector-plugin/90e04094' \\", "      && 'find' '/opt/kafka/plugins/my-connector-plugin/90e04094' '-type' 'l' | 'xargs' 'rm' '-f' \\", "      && 'rm' '-vf' '/opt/kafka/plugins/my-connector-plugin/90e04094.zip'", "RUN 'mkdir' '-p' '/opt/kafka/plugins/my-connector-plugin/2c3b64c7' \\", "      && 'curl' '-k' '-L' '--output' '/opt/kafka/plugins/my-connector-plugin/2c3b64c7/my.so' 'https://mydomain.tld/download?artifact=my.so'", "USER 1001"));
}
Also used : ZipArtifact(io.strimzi.api.kafka.model.connect.build.ZipArtifact) ZipArtifactBuilder(io.strimzi.api.kafka.model.connect.build.ZipArtifactBuilder) OtherArtifact(io.strimzi.api.kafka.model.connect.build.OtherArtifact) Build(io.strimzi.api.kafka.model.connect.build.Build) PluginBuilder(io.strimzi.api.kafka.model.connect.build.PluginBuilder) OtherArtifactBuilder(io.strimzi.api.kafka.model.connect.build.OtherArtifactBuilder) BuildBuilder(io.strimzi.api.kafka.model.connect.build.BuildBuilder) ParallelTest(io.strimzi.test.annotations.ParallelTest)

Example 54 with PluginBuilder

use of io.strimzi.api.kafka.model.connect.build.PluginBuilder in project strimzi by strimzi.

the class KafkaConnectDockerfileTest method testChecksumTgzArtifact.

@ParallelTest
public void testChecksumTgzArtifact() {
    Build connectBuild = new BuildBuilder().withPlugins(new PluginBuilder().withName("my-connector-plugin").withArtifacts(tgzArtifactWithChecksum).build()).build();
    KafkaConnectDockerfile df = new KafkaConnectDockerfile("myImage:latest", connectBuild);
    assertThat(df.getDockerfile(), isEquivalent("FROM myImage:latest", "USER root:root", "RUN 'mkdir' '-p' '/opt/kafka/plugins/my-connector-plugin/638bd501' \\", "      && 'curl' '-L' '--output' '/opt/kafka/plugins/my-connector-plugin/638bd501.tgz' 'https://mydomain.tld/my2.tgz' \\", "      && 'echo' 'sha-512-checksum /opt/kafka/plugins/my-connector-plugin/638bd501.tgz' > '/opt/kafka/plugins/my-connector-plugin/638bd501.tgz.sha512' \\", "      && 'sha512sum' '--check' '/opt/kafka/plugins/my-connector-plugin/638bd501.tgz.sha512' \\", "      && 'rm' '-f' '/opt/kafka/plugins/my-connector-plugin/638bd501.tgz.sha512' \\", "      && 'tar' 'xvfz' '/opt/kafka/plugins/my-connector-plugin/638bd501.tgz' '-C' '/opt/kafka/plugins/my-connector-plugin/638bd501' \\", "      && 'rm' '-vf' '/opt/kafka/plugins/my-connector-plugin/638bd501.tgz'", "USER 1001"));
}
Also used : Build(io.strimzi.api.kafka.model.connect.build.Build) PluginBuilder(io.strimzi.api.kafka.model.connect.build.PluginBuilder) BuildBuilder(io.strimzi.api.kafka.model.connect.build.BuildBuilder) ParallelTest(io.strimzi.test.annotations.ParallelTest)

Example 55 with PluginBuilder

use of io.strimzi.api.kafka.model.connect.build.PluginBuilder in project strimzi by strimzi.

the class KafkaConnectBuildTest method testValidationArtifactsExist.

@ParallelTest
public void testValidationArtifactsExist() {
    KafkaConnect kc = new KafkaConnectBuilder().withNewMetadata().withName(cluster).withNamespace(namespace).endMetadata().withNewSpec().withBootstrapServers("my-kafka:9092").withNewBuild().withNewDockerOutput().withImage("my-image:latest").withPushSecret("my-docker-credentials").endDockerOutput().withPlugins(new PluginBuilder().withName("my-connector").build()).endBuild().endSpec().build();
    assertThrows(InvalidResourceException.class, () -> {
        KafkaConnectBuild.fromCrd(new Reconciliation("test", kc.getKind(), kc.getMetadata().getNamespace(), kc.getMetadata().getName()), kc, VERSIONS);
    });
}
Also used : KafkaConnectBuilder(io.strimzi.api.kafka.model.KafkaConnectBuilder) Reconciliation(io.strimzi.operator.common.Reconciliation) KafkaConnect(io.strimzi.api.kafka.model.KafkaConnect) PluginBuilder(io.strimzi.api.kafka.model.connect.build.PluginBuilder) ParallelTest(io.strimzi.test.annotations.ParallelTest)

Aggregations

PluginBuilder (io.strimzi.api.kafka.model.connect.build.PluginBuilder)98 KafkaConnect (io.strimzi.api.kafka.model.KafkaConnect)62 KafkaConnectBuilder (io.strimzi.api.kafka.model.KafkaConnectBuilder)58 Reconciliation (io.strimzi.operator.common.Reconciliation)58 ParallelTest (io.strimzi.test.annotations.ParallelTest)56 JarArtifactBuilder (io.strimzi.api.kafka.model.connect.build.JarArtifactBuilder)44 Plugin (io.strimzi.api.kafka.model.connect.build.Plugin)42 Service (io.fabric8.kubernetes.api.model.Service)40 KafkaConnectResources (io.strimzi.api.kafka.model.KafkaConnectResources)40 KafkaConnector (io.strimzi.api.kafka.model.KafkaConnector)40 Annotations (io.strimzi.operator.common.Annotations)40 Util (io.strimzi.operator.common.Util)40 MatcherAssert.assertThat (org.hamcrest.MatcherAssert.assertThat)40 BeforeAll (org.junit.jupiter.api.BeforeAll)40 ConfigMap (io.fabric8.kubernetes.api.model.ConfigMap)38 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 KafkaConnectStatus (io.strimzi.api.kafka.model.status.KafkaConnectStatus)36