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
No related branches found
No related tags found
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
......@@ -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,
......
package theodolite.benchmark
import io.quarkus.runtime.annotations.RegisterForReflection
import theodolite.util.ConfigurationOverride
import kotlin.properties.Delegates
@RegisterForReflection
class BenchmarkExecution {
lateinit var name: String
lateinit var benchmark: String
......@@ -12,6 +14,7 @@ class BenchmarkExecution {
lateinit var execution: Execution
lateinit var configOverrides: List<ConfigurationOverride?>
@RegisterForReflection
class Execution {
lateinit var strategy: String
var duration by Delegates.notNull<Long>()
......@@ -19,6 +22,7 @@ class BenchmarkExecution {
lateinit var restrictions: List<String>
}
@RegisterForReflection
class Slo {
lateinit var sloType: String
var threshold by Delegates.notNull<Int>()
......@@ -28,11 +32,13 @@ class BenchmarkExecution {
var warmup by Delegates.notNull<Int>()
}
@RegisterForReflection
class LoadDefinition {
lateinit var loadType: String
lateinit var loadValues: List<Int>
}
@RegisterForReflection
class ResourceDefinition {
lateinit var resourceType: String
lateinit var resourceValues: List<Int>
......
......@@ -2,6 +2,7 @@ package theodolite.benchmark
import io.fabric8.kubernetes.api.model.KubernetesResource
import io.fabric8.kubernetes.client.DefaultKubernetesClient
import io.quarkus.runtime.annotations.RegisterForReflection
import mu.KotlinLogging
import theodolite.k8s.K8sResourceLoader
import theodolite.patcher.PatcherFactory
......@@ -11,6 +12,7 @@ private val logger = KotlinLogging.logger {}
private var DEFAULT_NAMESPACE = "default"
@RegisterForReflection
class KubernetesBenchmark : Benchmark {
lateinit var name: String
lateinit var appResource: List<String>
......@@ -19,9 +21,10 @@ class KubernetesBenchmark : Benchmark {
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 path = "./../../../resources/main/yaml/"
val parser = YamlParser()
namespace = System.getenv("NAMESPACE") ?: DEFAULT_NAMESPACE
......@@ -30,7 +33,7 @@ class KubernetesBenchmark : Benchmark {
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)
......
......@@ -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 io.quarkus.runtime.annotations.RegisterForReflection
import mu.KotlinLogging
import theodolite.benchmark.Benchmark
import theodolite.benchmark.BenchmarkExecution
......@@ -12,6 +13,7 @@ import java.time.Duration
private val logger = KotlinLogging.logger {}
@RegisterForReflection
class BenchmarkExecutorImpl(
benchmark: Benchmark,
results: Results,
......@@ -28,6 +30,8 @@ class BenchmarkExecutorImpl(
benchmarkDeployment.teardown()
benchmarkDeployment.teardown()
this.results.setResult(Pair(load, res), result)
return result
}
......
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