From 68dae0f67f071cb04042c4cea0bef669997c686d Mon Sep 17 00:00:00 2001 From: Andrew Collins Date: Thu, 10 Aug 2023 14:18:50 -0500 Subject: [PATCH] Fixes #413 --- pkg/burner/job.go | 12 ++++++------ pkg/measurements/factory.go | 3 ++- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/pkg/burner/job.go b/pkg/burner/job.go index 94f66821b..d41fc9e31 100644 --- a/pkg/burner/job.go +++ b/pkg/burner/job.go @@ -113,16 +113,16 @@ func Run(configSpec config.Spec, prometheusClients []*prometheus.Prometheus, ale } jobList[jobPosition].Start = time.Now().UTC() measurements.SetJobConfig(&job.Job) + if job.Cleanup { + ctx, cancel := context.WithTimeout(context.Background(), globalConfig.GCTimeout) + defer cancel() + CleanupNamespaces(ctx, v1.ListOptions{LabelSelector: fmt.Sprintf("kube-burner-job=%s", job.Name)}, true) + CleanupNonNamespacedResources(ctx, v1.ListOptions{LabelSelector: fmt.Sprintf("kube-burner-job=%s", job.Name)}, true) + } log.Infof("Triggering job: %s", job.Name) measurements.Start() switch job.JobType { case config.CreationJob: - if job.Cleanup { - ctx, cancel := context.WithTimeout(context.Background(), globalConfig.GCTimeout) - defer cancel() - CleanupNamespaces(ctx, v1.ListOptions{LabelSelector: fmt.Sprintf("kube-burner-job=%s", job.Name)}, true) - CleanupNonNamespacedResources(ctx, v1.ListOptions{LabelSelector: fmt.Sprintf("kube-burner-job=%s", job.Name)}, true) - } if job.Churn { log.Info("Churning enabled") log.Infof("Churn duration: %v", job.ChurnDuration) diff --git a/pkg/measurements/factory.go b/pkg/measurements/factory.go index 69d9b2d8f..bfff8deb6 100644 --- a/pkg/measurements/factory.go +++ b/pkg/measurements/factory.go @@ -92,7 +92,8 @@ func SetJobConfig(jobConfig *config.Job) { // Start starts registered measurements func Start() { var wg sync.WaitGroup - for _, measurement := range factory.createFuncs { + for name, measurement := range factory.createFuncs { + log.Infof("Starting measurement: %s", name) wg.Add(1) go measurement.start(&wg) }