diff --git a/theodolite-quarkus/src/main/kotlin/theodolite/benchmark/KafkaLagExporterRemover.kt b/theodolite-quarkus/src/main/kotlin/theodolite/benchmark/KafkaLagExporterRemover.kt new file mode 100644 index 0000000000000000000000000000000000000000..9e241cabfa208a0632635a30c658590faec2c1a8 --- /dev/null +++ b/theodolite-quarkus/src/main/kotlin/theodolite/benchmark/KafkaLagExporterRemover.kt @@ -0,0 +1,14 @@ +package theodolite.benchmark; + +import io.fabric8.kubernetes.client.NamespacedKubernetesClient +import mu.KotlinLogging + +private val logger = KotlinLogging.logger {} + +class KafkaLagExporterRemover(private val client : NamespacedKubernetesClient) { + + fun remove(label: String){ + this.client.pods().withLabel(label).delete() + logger.info{"Pod with label: $label deleted"} + } +} diff --git a/theodolite-quarkus/src/main/kotlin/theodolite/benchmark/KubernetesBenchmarkDeployment.kt b/theodolite-quarkus/src/main/kotlin/theodolite/benchmark/KubernetesBenchmarkDeployment.kt index 342ceebb89a2ccd04a84ba40fb49a1e4872fa24d..35d7cc79ba8aafa17584d392d94443e59a7fa590 100644 --- a/theodolite-quarkus/src/main/kotlin/theodolite/benchmark/KubernetesBenchmarkDeployment.kt +++ b/theodolite-quarkus/src/main/kotlin/theodolite/benchmark/KubernetesBenchmarkDeployment.kt @@ -15,6 +15,9 @@ class KubernetesBenchmarkDeployment( private val kafkaController = TopicManager(this.kafkaConfig) private val kubernetesManager = K8sManager(DefaultKubernetesClient().inNamespace(namespace)) + private val LABEL = "app.kubernetes.io/name=kafka-lag-exporter" + private val client = DefaultKubernetesClient().inNamespace(namespace) + override fun setup() { kafkaController.createTopics(this.topics) resources.forEach { @@ -23,6 +26,7 @@ class KubernetesBenchmarkDeployment( } override fun teardown() { + KafkaLagExporterRemover(client).remove(LABEL) kafkaController.removeTopics(this.topics.map { topic -> topic.name() }) resources.forEach { kubernetesManager.remove(it)