Skip to content
Snippets Groups Projects
Commit 63094c85 authored by Lorenz Boguhn's avatar Lorenz Boguhn
Browse files

merge theodolite-kotlin

parents 670cf574 a0f1d04b
No related branches found
No related tags found
4 merge requests!159Re-implementation of Theodolite with Kotlin/Quarkus,!157Update Graal Image in CI pipeline,!106Introduce a Theodolite operator,!83WIP: Re-implementation of Theodolite with Kotlin/Quarkus
Showing
with 54 additions and 24 deletions
......@@ -2,4 +2,5 @@
!build/*-runner
!build/*-runner.jar
!build/lib/*
!build/quarkus-app/*
\ No newline at end of file
!build/quarkus-app/*
!config/*
\ No newline at end of file
......@@ -25,6 +25,7 @@ dependencies {
implementation 'org.slf4j:slf4j-simple:1.7.29'
implementation 'io.github.microutils:kotlin-logging:1.12.0'
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 '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 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 .
......
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} \
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/*-runner.jar /deployments/app.jar
COPY config/ /deployments/config/
EXPOSE 8080
USER 1001
......
......@@ -20,6 +20,7 @@ RUN chown 1001 /work \
&& chmod "g+rwX" /work \
&& chown 1001:root /work
COPY --chown=1001:root build/*-runner /work/application
COPY config/ /work/config/
EXPOSE 8080
USER 1001
......
package theodolite.benchmark
import io.quarkus.runtime.annotations.RegisterForReflection
import theodolite.util.ConfigurationOverride
import theodolite.util.LoadDimension
import theodolite.util.Resource
@RegisterForReflection
interface Benchmark {
fun buildDeployment(
load: LoadDimension,
......
......@@ -4,13 +4,12 @@ import com.fasterxml.jackson.databind.annotation.JsonDeserialize
import io.fabric8.kubernetes.api.model.KubernetesResource
import io.fabric8.kubernetes.api.model.Namespaced
import io.fabric8.kubernetes.client.CustomResource
import io.quarkus.runtime.annotations.RegisterForReflection
import theodolite.util.ConfigurationOverride
import java.lang.System.exit
import kotlin.concurrent.thread
import kotlin.properties.Delegates
import kotlin.system.exitProcess
@JsonDeserialize
@RegisterForReflection
class BenchmarkExecution : CustomResource(), Namespaced {
lateinit var name: String
lateinit var benchmark: String
......@@ -21,6 +20,7 @@ class BenchmarkExecution : CustomResource(), Namespaced {
lateinit var configOverrides: List<ConfigurationOverride?>
@JsonDeserialize
@RegisterForReflection
class Execution : KubernetesResource {
lateinit var strategy: String
var duration by Delegates.notNull<Long>()
......@@ -29,7 +29,8 @@ class BenchmarkExecution : CustomResource(), Namespaced {
}
@JsonDeserialize
class Slo : KubernetesResource{
@RegisterForReflection
class Slo : KubernetesResource {
lateinit var sloType: String
var threshold by Delegates.notNull<Int>()
lateinit var prometheusUrl: String
......@@ -38,14 +39,17 @@ class BenchmarkExecution : CustomResource(), Namespaced {
var warmup by Delegates.notNull<Int>()
}
@JsonDeserialize
class LoadDefinition : KubernetesResource{
@RegisterForReflection
class LoadDefinition : KubernetesResource {
lateinit var loadType: String
lateinit var loadValues: List<Int>
}
@JsonDeserialize
class ResourceDefinition : KubernetesResource{
@RegisterForReflection
class ResourceDefinition : KubernetesResource {
lateinit var resourceType: String
lateinit var resourceValues: List<Int>
}
......
......@@ -4,17 +4,17 @@ import io.fabric8.kubernetes.api.model.KubernetesResource
import io.fabric8.kubernetes.api.model.Namespaced
import io.fabric8.kubernetes.client.CustomResource
import io.fabric8.kubernetes.client.DefaultKubernetesClient
import io.quarkus.runtime.annotations.RegisterForReflection
import mu.KotlinLogging
import theodolite.k8s.K8sResourceLoader
import theodolite.patcher.PatcherFactory
import theodolite.util.*
private val logger = KotlinLogging.logger {}
private var DEFAULT_NAMESPACE = "default"
class KubernetesBenchmark : Benchmark , CustomResource(), Namespaced {
@RegisterForReflection
class KubernetesBenchmark : Benchmark, CustomResource(), Namespaced {
lateinit var name: String
lateinit var appResource: List<String>
lateinit var loadGenResource: List<String>
......@@ -22,9 +22,9 @@ class KubernetesBenchmark : Benchmark , CustomResource(), Namespaced {
lateinit var loadTypes: List<TypeName>
lateinit var kafkaConfig: KafkaConfig
lateinit var namespace: String
lateinit var path: String
private fun loadKubernetesResources(resources: List<String>): List<Pair<String, KubernetesResource>> {
val basePath = "./../../../resources/main/yaml/"
val parser = YamlParser()
namespace = System.getenv("NAMESPACE") ?: DEFAULT_NAMESPACE
......@@ -33,7 +33,7 @@ class KubernetesBenchmark : Benchmark , CustomResource(), Namespaced {
val loader = K8sResourceLoader(DefaultKubernetesClient().inNamespace(namespace))
return resources
.map { resource ->
val resourcePath = "$basePath/$resource"
val resourcePath = "$path/$resource"
val kind = parser.parse(resourcePath, HashMap<String, String>()::class.java)?.get("kind")!!
val k8sResource = loader.loadK8sResource(kind, resourcePath)
Pair(resource, k8sResource)
......@@ -49,13 +49,20 @@ class KubernetesBenchmark : Benchmark , CustomResource(), Namespaced {
val patcherFactory = PatcherFactory()
// patch the load dimension the resources
load.getType().forEach { patcherDefinition -> patcherFactory.createPatcher(patcherDefinition, resources).patch(load.get().toString()) }
res.getType().forEach{ patcherDefinition -> patcherFactory.createPatcher(patcherDefinition, resources).patch(res.get().toString()) }
load.getType().forEach { patcherDefinition ->
patcherFactory.createPatcher(patcherDefinition, resources).patch(load.get().toString())
}
res.getType().forEach { patcherDefinition ->
patcherFactory.createPatcher(patcherDefinition, resources).patch(res.get().toString())
}
// Patch the given overrides
configurationOverrides.forEach { override -> override?.let { patcherFactory.createPatcher(it.patcher, resources).patch(override.value) } }
configurationOverrides.forEach { override ->
override?.let {
patcherFactory.createPatcher(it.patcher, resources).patch(override.value)
}
}
return KubernetesBenchmarkDeployment(
namespace = namespace,
resources = resources.map { r -> r.second },
......
......@@ -2,10 +2,12 @@ package theodolite.benchmark
import io.fabric8.kubernetes.api.model.KubernetesResource
import io.fabric8.kubernetes.client.DefaultKubernetesClient
import io.quarkus.runtime.annotations.RegisterForReflection
import org.apache.kafka.clients.admin.NewTopic
import theodolite.k8s.K8sManager
import theodolite.k8s.TopicManager
@RegisterForReflection
class KubernetesBenchmarkDeployment(
val namespace: String,
val resources: List<KubernetesResource>,
......
package theodolite.execution
import mu.KotlinLogging
import io.quarkus.runtime.annotations.RegisterForReflection
import theodolite.benchmark.Benchmark
import theodolite.benchmark.BenchmarkExecution
import theodolite.evaluation.AnalysisExecutor
......@@ -10,8 +10,7 @@ import theodolite.util.Resource
import theodolite.util.Results
import java.time.Duration
private val logger = KotlinLogging.logger {}
@RegisterForReflection
class BenchmarkExecutorImpl(
benchmark: Benchmark,
results: Results,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment