Skip to content
Snippets Groups Projects
Commit 58f93b14 authored by Sören Henning's avatar Sören Henning
Browse files

Add brief pause after K8s deletion (fix #220)

parent ecc3aea7
No related branches found
No related tags found
3 merge requests!159Re-implementation of Theodolite with Kotlin/Quarkus,!157Update Graal Image in CI pipeline,!83WIP: Re-implementation of Theodolite with Kotlin/Quarkus
Pipeline #2925 canceled
......@@ -3,11 +3,14 @@ package theodolite.benchmark
import io.fabric8.kubernetes.api.model.KubernetesResource
import io.fabric8.kubernetes.client.NamespacedKubernetesClient
import io.quarkus.runtime.annotations.RegisterForReflection
import mu.KotlinLogging
import org.apache.kafka.clients.admin.NewTopic
import theodolite.k8s.K8sManager
import theodolite.k8s.TopicManager
import theodolite.util.KafkaConfig
private val logger = KotlinLogging.logger {}
/**
* Organizes the deployment of benchmarks in Kubernetes.
*
......@@ -26,7 +29,8 @@ class KubernetesBenchmarkDeployment(
) : BenchmarkDeployment {
private val kafkaController = TopicManager(this.kafkaConfig)
private val kubernetesManager = K8sManager(client)
private val LABEL = "app.kubernetes.io/name=kafka-lag-exporter"
private val LAG_EXPORTER_POD_LABEL = "app.kubernetes.io/name=kafka-lag-exporter"
private val SLEEP_AFTER_K8S_DELETION_MS = 2000L
/**
* Setup a [KubernetesBenchmark] using the [TopicManager] and the [K8sManager]:
......@@ -52,7 +56,9 @@ class KubernetesBenchmarkDeployment(
resources.forEach {
kubernetesManager.remove(it)
}
logger.info { "Kubernetes resources deleted. Allow for short pause before continuing." }
Thread.sleep(SLEEP_AFTER_K8S_DELETION_MS)
kafkaController.removeTopics(this.topics.map { topic -> topic.name })
KafkaLagExporterRemover(client).remove(LABEL)
KafkaLagExporterRemover(client).remove(LAG_EXPORTER_POD_LABEL)
}
}
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