Skip to content
Snippets Groups Projects
Commit a0f1d04b authored by Sören Henning's avatar Sören Henning
Browse files

Merge branch 'feature/185-make-path-configurable' into 'theodolite-kotlin'

Feature/185 Make Paths Configurable

See merge request !108
parents 0d53d57d c19843d4
Branches
Tags
4 merge requests!159Re-implementation of Theodolite with Kotlin/Quarkus,!157Update Graal Image in CI pipeline,!108Feature/185 Make Paths Configurable,!83WIP: Re-implementation of Theodolite with Kotlin/Quarkus
Pipeline #2493 passed
Showing
with 40 additions and 7 deletions
...@@ -3,3 +3,4 @@ ...@@ -3,3 +3,4 @@
!build/*-runner.jar !build/*-runner.jar
!build/lib/* !build/lib/*
!build/quarkus-app/* !build/quarkus-app/*
!config/*
\ No newline at end of file
...@@ -25,6 +25,7 @@ dependencies { ...@@ -25,6 +25,7 @@ dependencies {
implementation 'org.slf4j:slf4j-simple:1.7.29' implementation 'org.slf4j:slf4j-simple:1.7.29'
implementation 'io.github.microutils:kotlin-logging:1.12.0' implementation 'io.github.microutils:kotlin-logging:1.12.0'
implementation 'io.fabric8:kubernetes-client:5.0.0-alpha-2' implementation 'io.fabric8:kubernetes-client:5.0.0-alpha-2'
implementation 'io.quarkus:quarkus-kubernetes-client'
implementation 'org.apache.kafka:kafka-clients:2.7.0' implementation 'org.apache.kafka:kafka-clients:2.7.0'
implementation 'khttp:khttp:1.0.0' implementation 'khttp:khttp:1.0.0'
} }
......
./gradlew build ./gradlew build -x test
docker build -f src/main/docker/Dockerfile.jvm -t quarkus/theodolite-quarkus-jvm . docker build -f src/main/docker/Dockerfile.jvm -t quarkus/theodolite-quarkus-jvm .
docker run -i --rm -p 8080:8080 quarkus/theodolite-quarkus-jvm docker run -i --rm -p 8080:8080 quarkus/theodolite-quarkus-jvm
./gradlew build -Dquarkus.package.type=native ./gradlew build -Dquarkus.package.type=native -x test
docker build -f src/main/docker/Dockerfile.native -t quarkus/theodolite-quarkus . docker build -f src/main/docker/Dockerfile.native -t quarkus/theodolite-quarkus .
......
apiVersion: monitoring.coreos.com/v1
kind: ServiceMonitor
metadata:
labels:
app: titan-ccp-aggregation
appScope: titan-ccp
name: titan-ccp-aggregation
spec:
selector:
matchLabels:
app: titan-ccp-aggregation
endpoints:
- port: metrics
interval: 10s
...@@ -44,6 +44,7 @@ RUN microdnf install curl ca-certificates ${JAVA_PACKAGE} \ ...@@ -44,6 +44,7 @@ RUN microdnf install curl ca-certificates ${JAVA_PACKAGE} \
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"
COPY build/lib/* /deployments/lib/ COPY build/lib/* /deployments/lib/
COPY build/*-runner.jar /deployments/app.jar COPY build/*-runner.jar /deployments/app.jar
COPY config/ /deployments/config/
EXPOSE 8080 EXPOSE 8080
USER 1001 USER 1001
......
...@@ -20,6 +20,7 @@ RUN chown 1001 /work \ ...@@ -20,6 +20,7 @@ RUN chown 1001 /work \
&& chmod "g+rwX" /work \ && chmod "g+rwX" /work \
&& chown 1001:root /work && chown 1001:root /work
COPY --chown=1001:root build/*-runner /work/application COPY --chown=1001:root build/*-runner /work/application
COPY config/ /work/config/
EXPOSE 8080 EXPOSE 8080
USER 1001 USER 1001
......
package theodolite.benchmark package theodolite.benchmark
import io.quarkus.runtime.annotations.RegisterForReflection
import theodolite.util.ConfigurationOverride import theodolite.util.ConfigurationOverride
import theodolite.util.LoadDimension import theodolite.util.LoadDimension
import theodolite.util.Resource import theodolite.util.Resource
@RegisterForReflection
interface Benchmark { interface Benchmark {
fun buildDeployment( fun buildDeployment(
load: LoadDimension, load: LoadDimension,
......
package theodolite.benchmark package theodolite.benchmark
import io.quarkus.runtime.annotations.RegisterForReflection
import theodolite.util.ConfigurationOverride import theodolite.util.ConfigurationOverride
import kotlin.properties.Delegates import kotlin.properties.Delegates
@RegisterForReflection
class BenchmarkExecution { class BenchmarkExecution {
lateinit var name: String lateinit var name: String
lateinit var benchmark: String lateinit var benchmark: String
...@@ -12,6 +14,7 @@ class BenchmarkExecution { ...@@ -12,6 +14,7 @@ class BenchmarkExecution {
lateinit var execution: Execution lateinit var execution: Execution
lateinit var configOverrides: List<ConfigurationOverride?> lateinit var configOverrides: List<ConfigurationOverride?>
@RegisterForReflection
class Execution { class Execution {
lateinit var strategy: String lateinit var strategy: String
var duration by Delegates.notNull<Long>() var duration by Delegates.notNull<Long>()
...@@ -19,6 +22,7 @@ class BenchmarkExecution { ...@@ -19,6 +22,7 @@ class BenchmarkExecution {
lateinit var restrictions: List<String> lateinit var restrictions: List<String>
} }
@RegisterForReflection
class Slo { class Slo {
lateinit var sloType: String lateinit var sloType: String
var threshold by Delegates.notNull<Int>() var threshold by Delegates.notNull<Int>()
...@@ -28,11 +32,13 @@ class BenchmarkExecution { ...@@ -28,11 +32,13 @@ class BenchmarkExecution {
var warmup by Delegates.notNull<Int>() var warmup by Delegates.notNull<Int>()
} }
@RegisterForReflection
class LoadDefinition { class LoadDefinition {
lateinit var loadType: String lateinit var loadType: String
lateinit var loadValues: List<Int> lateinit var loadValues: List<Int>
} }
@RegisterForReflection
class ResourceDefinition { class ResourceDefinition {
lateinit var resourceType: String lateinit var resourceType: String
lateinit var resourceValues: List<Int> lateinit var resourceValues: List<Int>
......
...@@ -2,6 +2,7 @@ package theodolite.benchmark ...@@ -2,6 +2,7 @@ package theodolite.benchmark
import io.fabric8.kubernetes.api.model.KubernetesResource import io.fabric8.kubernetes.api.model.KubernetesResource
import io.fabric8.kubernetes.client.DefaultKubernetesClient import io.fabric8.kubernetes.client.DefaultKubernetesClient
import io.quarkus.runtime.annotations.RegisterForReflection
import mu.KotlinLogging import mu.KotlinLogging
import theodolite.k8s.K8sResourceLoader import theodolite.k8s.K8sResourceLoader
import theodolite.patcher.PatcherFactory import theodolite.patcher.PatcherFactory
...@@ -11,6 +12,7 @@ private val logger = KotlinLogging.logger {} ...@@ -11,6 +12,7 @@ private val logger = KotlinLogging.logger {}
private var DEFAULT_NAMESPACE = "default" private var DEFAULT_NAMESPACE = "default"
@RegisterForReflection
class KubernetesBenchmark : Benchmark { class KubernetesBenchmark : Benchmark {
lateinit var name: String lateinit var name: String
lateinit var appResource: List<String> lateinit var appResource: List<String>
...@@ -19,9 +21,10 @@ class KubernetesBenchmark : Benchmark { ...@@ -19,9 +21,10 @@ class KubernetesBenchmark : Benchmark {
lateinit var loadTypes: List<TypeName> lateinit var loadTypes: List<TypeName>
lateinit var kafkaConfig: KafkaConfig lateinit var kafkaConfig: KafkaConfig
lateinit var namespace: String lateinit var namespace: String
lateinit var path: String
private fun loadKubernetesResources(resources: List<String>): List<Pair<String, KubernetesResource>> { private fun loadKubernetesResources(resources: List<String>): List<Pair<String, KubernetesResource>> {
val basePath = "./../../../resources/main/yaml/" //val path = "./../../../resources/main/yaml/"
val parser = YamlParser() val parser = YamlParser()
namespace = System.getenv("NAMESPACE") ?: DEFAULT_NAMESPACE namespace = System.getenv("NAMESPACE") ?: DEFAULT_NAMESPACE
...@@ -30,7 +33,7 @@ class KubernetesBenchmark : Benchmark { ...@@ -30,7 +33,7 @@ class KubernetesBenchmark : Benchmark {
val loader = K8sResourceLoader(DefaultKubernetesClient().inNamespace(namespace)) val loader = K8sResourceLoader(DefaultKubernetesClient().inNamespace(namespace))
return resources return resources
.map { resource -> .map { resource ->
val resourcePath = "$basePath/$resource" val resourcePath = "$path/$resource"
val kind = parser.parse(resourcePath, HashMap<String, String>()::class.java)?.get("kind")!! val kind = parser.parse(resourcePath, HashMap<String, String>()::class.java)?.get("kind")!!
val k8sResource = loader.loadK8sResource(kind, resourcePath) val k8sResource = loader.loadK8sResource(kind, resourcePath)
Pair(resource, k8sResource) Pair(resource, k8sResource)
......
...@@ -2,10 +2,12 @@ package theodolite.benchmark ...@@ -2,10 +2,12 @@ package theodolite.benchmark
import io.fabric8.kubernetes.api.model.KubernetesResource import io.fabric8.kubernetes.api.model.KubernetesResource
import io.fabric8.kubernetes.client.DefaultKubernetesClient import io.fabric8.kubernetes.client.DefaultKubernetesClient
import io.quarkus.runtime.annotations.RegisterForReflection
import org.apache.kafka.clients.admin.NewTopic import org.apache.kafka.clients.admin.NewTopic
import theodolite.k8s.K8sManager import theodolite.k8s.K8sManager
import theodolite.k8s.TopicManager import theodolite.k8s.TopicManager
@RegisterForReflection
class KubernetesBenchmarkDeployment( class KubernetesBenchmarkDeployment(
val namespace: String, val namespace: String,
val resources: List<KubernetesResource>, val resources: List<KubernetesResource>,
......
package theodolite.execution package theodolite.execution
import io.quarkus.runtime.annotations.RegisterForReflection
import mu.KotlinLogging import mu.KotlinLogging
import theodolite.benchmark.Benchmark import theodolite.benchmark.Benchmark
import theodolite.benchmark.BenchmarkExecution import theodolite.benchmark.BenchmarkExecution
...@@ -12,6 +13,7 @@ import java.time.Duration ...@@ -12,6 +13,7 @@ import java.time.Duration
private val logger = KotlinLogging.logger {} private val logger = KotlinLogging.logger {}
@RegisterForReflection
class BenchmarkExecutorImpl( class BenchmarkExecutorImpl(
benchmark: Benchmark, benchmark: Benchmark,
results: Results, results: Results,
...@@ -28,6 +30,8 @@ class BenchmarkExecutorImpl( ...@@ -28,6 +30,8 @@ class BenchmarkExecutorImpl(
benchmarkDeployment.teardown() benchmarkDeployment.teardown()
benchmarkDeployment.teardown()
this.results.setResult(Pair(load, res), result) this.results.setResult(Pair(load, res), result)
return result return result
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment