Skip to content
Snippets Groups Projects
Commit 98a57ecf authored by Benedikt Wetzel's avatar Benedikt Wetzel
Browse files

fix native image error

use local k8s clients instead of a class member var
parent 26bc2d4f
No related branches found
No related tags found
4 merge requests!159Re-implementation of Theodolite with Kotlin/Quarkus,!157Update Graal Image in CI pipeline,!109Introduce a Helm chart for the Theodolite operator,!83WIP: Re-implementation of Theodolite with Kotlin/Quarkus
...@@ -21,14 +21,13 @@ class KubernetesBenchmark : Benchmark, CustomResource(), Namespaced { ...@@ -21,14 +21,13 @@ class KubernetesBenchmark : Benchmark, CustomResource(), Namespaced {
lateinit var resourceTypes: List<TypeName> lateinit var resourceTypes: List<TypeName>
lateinit var loadTypes: List<TypeName> lateinit var loadTypes: List<TypeName>
lateinit var kafkaConfig: KafkaConfig lateinit var kafkaConfig: KafkaConfig
val namespace = System.getenv("NAMESPACE") ?: DEFAULT_NAMESPACE private val namespace = System.getenv("NAMESPACE") ?: DEFAULT_NAMESPACE
var path = System.getenv("THEODOLITE_APP_RESOURCES") ?: "./config" var path = System.getenv("THEODOLITE_APP_RESOURCES") ?: "./config"
val client = DefaultKubernetesClient().inNamespace(namespace)
private fun loadKubernetesResources(resources: List<String>): List<Pair<String, KubernetesResource>> { private fun loadKubernetesResources(resources: List<String>): List<Pair<String, KubernetesResource>> {
val parser = YamlParser() val parser = YamlParser()
val loader = K8sResourceLoader(client) val loader = K8sResourceLoader(DefaultKubernetesClient().inNamespace(namespace))
return resources return resources
.map { resource -> .map { resource ->
val resourcePath = "$path/$resource" val resourcePath = "$path/$resource"
...@@ -68,7 +67,7 @@ class KubernetesBenchmark : Benchmark, CustomResource(), Namespaced { ...@@ -68,7 +67,7 @@ class KubernetesBenchmark : Benchmark, CustomResource(), Namespaced {
resources = resources.map { r -> r.second }, resources = resources.map { r -> r.second },
kafkaConfig = hashMapOf("bootstrap.servers" to kafkaConfig.bootstrapServer), kafkaConfig = hashMapOf("bootstrap.servers" to kafkaConfig.bootstrapServer),
topics = kafkaConfig.getKafkaTopics(), topics = kafkaConfig.getKafkaTopics(),
client = client client = DefaultKubernetesClient().inNamespace(namespace)
) )
} }
} }
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