From 98a57ecf8c28664937e641169f83a8808cf774f4 Mon Sep 17 00:00:00 2001
From: "stu126940@mail.uni-kiel.de" <stu126940@mail.uni-kiel.de>
Date: Tue, 13 Apr 2021 11:36:50 +0200
Subject: [PATCH] fix native image error use local k8s clients instead of a
 class member var

---
 .../kotlin/theodolite/benchmark/KubernetesBenchmark.kt     | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/theodolite-quarkus/src/main/kotlin/theodolite/benchmark/KubernetesBenchmark.kt b/theodolite-quarkus/src/main/kotlin/theodolite/benchmark/KubernetesBenchmark.kt
index f14a0e4f3..a75cd96ef 100644
--- a/theodolite-quarkus/src/main/kotlin/theodolite/benchmark/KubernetesBenchmark.kt
+++ b/theodolite-quarkus/src/main/kotlin/theodolite/benchmark/KubernetesBenchmark.kt
@@ -21,14 +21,13 @@ class KubernetesBenchmark : Benchmark, CustomResource(), Namespaced {
     lateinit var resourceTypes: List<TypeName>
     lateinit var loadTypes: List<TypeName>
     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"
-    val client = DefaultKubernetesClient().inNamespace(namespace)
 
     private fun loadKubernetesResources(resources: List<String>): List<Pair<String, KubernetesResource>> {
         val parser = YamlParser()
 
-        val loader = K8sResourceLoader(client)
+        val loader = K8sResourceLoader(DefaultKubernetesClient().inNamespace(namespace))
         return resources
             .map { resource ->
                 val resourcePath = "$path/$resource"
@@ -68,7 +67,7 @@ class KubernetesBenchmark : Benchmark, CustomResource(), Namespaced {
             resources = resources.map { r -> r.second },
             kafkaConfig = hashMapOf("bootstrap.servers" to kafkaConfig.bootstrapServer),
             topics = kafkaConfig.getKafkaTopics(),
-            client = client
+            client = DefaultKubernetesClient().inNamespace(namespace)
         )
     }
 }
-- 
GitLab