diff --git a/theodolite-quarkus/src/main/docker/Dockerfile.jvm b/theodolite-quarkus/src/main/docker/Dockerfile.jvm index 6733d5d441e8292e02547cf59131c706575e9d86..232ab03978c949e3d3b144813dd2c465d0d44a96 100644 --- a/theodolite-quarkus/src/main/docker/Dockerfile.jvm +++ b/theodolite-quarkus/src/main/docker/Dockerfile.jvm @@ -41,7 +41,7 @@ RUN microdnf install curl ca-certificates ${JAVA_PACKAGE} \ && echo "securerandom.source=file:/dev/urandom" >> /etc/alternatives/jre/lib/security/java.security # Configure the JAVA_OPTIONS, you can add -XshowSettings:vm to also display the heap size. -ENV JAVA_OPTIONS="-Dquarkus.http.host=0.0.0.0 -Djava.util.logging.manager=org.jboss.logmanager.LogManager" +ENV JAVA_OPTIONS="-Dquarkus.http.host=0.0.0.0 -Djava.util.logging.manager=org.jboss.logmanager.LogManager -Dquarkus.package.main-class=TheodoliteOperator" COPY build/lib/* /deployments/lib/ COPY build/*-runner.jar /deployments/app.jar COPY config/ /deployments/config/ diff --git a/theodolite-quarkus/src/main/kotlin/theodolite/benchmark/KubernetesBenchmark.kt b/theodolite-quarkus/src/main/kotlin/theodolite/benchmark/KubernetesBenchmark.kt index d0640cd7b3e5d39823f9a2254a93aef66435c18b..4f630ff6b5da77d4933c77e8741926ac0c37cdf1 100644 --- a/theodolite-quarkus/src/main/kotlin/theodolite/benchmark/KubernetesBenchmark.kt +++ b/theodolite-quarkus/src/main/kotlin/theodolite/benchmark/KubernetesBenchmark.kt @@ -30,6 +30,10 @@ class KubernetesBenchmark : Benchmark, CustomResource(), Namespaced { namespace = System.getenv("NAMESPACE") ?: DEFAULT_NAMESPACE logger.info { "Using $namespace as namespace." } + path = System.getenv("THEODOLITE_APP_RESOURCES") ?: "./config" + logger.info { "Using $path as path for resources." } + + val loader = K8sResourceLoader(DefaultKubernetesClient().inNamespace(namespace)) return resources .map { resource -> @@ -62,7 +66,7 @@ class KubernetesBenchmark : Benchmark, CustomResource(), Namespaced { patcherFactory.createPatcher(it.patcher, resources).patch(override.value) } } - + return KubernetesBenchmarkDeployment( namespace = namespace, resources = resources.map { r -> r.second }, diff --git a/theodolite-quarkus/src/main/kotlin/theodolite/execution/TheodoliteOperator.kt b/theodolite-quarkus/src/main/kotlin/theodolite/execution/TheodoliteOperator.kt index 5b621c3c4013c9b1832cbd0c6a4d522e18143383..478fdce0cd9378488d46be0baa75893131a02cbb 100644 --- a/theodolite-quarkus/src/main/kotlin/theodolite/execution/TheodoliteOperator.kt +++ b/theodolite-quarkus/src/main/kotlin/theodolite/execution/TheodoliteOperator.kt @@ -2,10 +2,13 @@ package theodolite.execution import io.fabric8.kubernetes.client.DefaultKubernetesClient import io.fabric8.kubernetes.client.dsl.base.CustomResourceDefinitionContext +import io.fabric8.kubernetes.internal.KubernetesDeserializer import io.quarkus.runtime.annotations.QuarkusMain import mu.KotlinLogging -import theodolite.benchmark.* -import io.fabric8.kubernetes.internal.KubernetesDeserializer +import theodolite.benchmark.BenchmarkExecution +import theodolite.benchmark.BenchmarkExecutionList +import theodolite.benchmark.KubernetesBenchmark +import theodolite.benchmark.KubernetesBenchmarkList private var DEFAULT_NAMESPACE = "default" @@ -19,6 +22,7 @@ object TheodoliteOperator { val namespace = System.getenv("NAMESPACE") ?: DEFAULT_NAMESPACE logger.info { "Using $namespace as namespace." } + val client = DefaultKubernetesClient().inNamespace(namespace) KubernetesDeserializer.registerCustomKind( @@ -49,19 +53,21 @@ object TheodoliteOperator { val informerFactory = client.informers() - val informerBenchmarkExecution = informerFactory.sharedIndexInformerForCustomResource( + val informerBenchmarkExecution = informerFactory.sharedIndexInformerForCustomResource( executionContext, BenchmarkExecution::class.java, BenchmarkExecutionList::class.java, 10 * 60 * 1000.toLong() ) - val informerBenchmarkType = informerFactory.sharedIndexInformerForCustomResource( + val informerBenchmarkType = informerFactory.sharedIndexInformerForCustomResource( typeContext, KubernetesBenchmark::class.java, KubernetesBenchmarkList::class.java, 10 * 60 * 1000.toLong() ) - val controller = TheodoliteController(client = client, + val controller = TheodoliteController( + client = client, informerBenchmarkExecution = informerBenchmarkExecution, informerBenchmarkType = informerBenchmarkType, - executionContext = executionContext) + executionContext = executionContext + ) controller.create() informerFactory.startAllRegisteredInformers() diff --git a/theodolite-quarkus/src/main/resources/application.properties b/theodolite-quarkus/src/main/resources/application.properties index 318ce68ff1ae344f44288bfaacfbc43538211f50..e85374958791e1dc22c37b6496e4c9ea3f2f0654 100644 --- a/theodolite-quarkus/src/main/resources/application.properties +++ b/theodolite-quarkus/src/main/resources/application.properties @@ -1,4 +1,4 @@ -quarkus.package.main-class=TheodoliteYamlExecutor +quarkus.package.main-class=TheodoliteOperator quarkus.native.additional-build-args=\ --initialize-at-run-time=io.fabric8.kubernetes.client.internal.CertUtils,\ --report-unsupported-elements-at-runtime \ No newline at end of file diff --git a/theodolite-quarkus/src/main/resources/operator/example-benchmark.yaml b/theodolite-quarkus/src/main/resources/operator/example-benchmark.yaml index 9fc16f92e303f05a449f7e8b83600c3b299f215d..d5fc040b330b1d8198d0a11440f9621b73125d20 100644 --- a/theodolite-quarkus/src/main/resources/operator/example-benchmark.yaml +++ b/theodolite-quarkus/src/main/resources/operator/example-benchmark.yaml @@ -22,7 +22,7 @@ loadTypes: container: "workload-generator" variableName: "NUM_SENSORS" kafkaConfig: - bootstrapServer: "localhost:31290" + bootstrapServer: "my-confluent-cp-kafka:9092" topics: - name: "input" numPartitions: 40