From d0b126d2ff175737515b1ec101be0bc5eb14737d Mon Sep 17 00:00:00 2001 From: Raul Sevilla Date: Fri, 16 Jul 2021 17:42:46 +0200 Subject: [PATCH] Decrease default verbosity Signed-off-by: Raul Sevilla --- cmd/kube-burner/kube-burner.go | 1 + pkg/burner/create.go | 4 ++-- pkg/burner/delete.go | 19 +++++++++---------- pkg/burner/namespaces.go | 2 +- 4 files changed, 13 insertions(+), 13 deletions(-) diff --git a/cmd/kube-burner/kube-burner.go b/cmd/kube-burner/kube-burner.go index eddece9af..8690a4db0 100644 --- a/cmd/kube-burner/kube-burner.go +++ b/cmd/kube-burner/kube-burner.go @@ -301,6 +301,7 @@ func steps(uuid string, p *prometheus.Prometheus, alertM *alerting.AlertManager) // Iterate through job list for jobPosition, job := range jobList { jobList[jobPosition].Start = time.Now().UTC() + log.Infof("Triggering job: %s", job.Config.Name) measurements.SetJobConfig(&job.Config) switch job.Config.JobType { case config.CreationJob: diff --git a/pkg/burner/create.go b/pkg/burner/create.go index ff728ba0a..d08a5e1a0 100644 --- a/pkg/burner/create.go +++ b/pkg/burner/create.go @@ -89,7 +89,6 @@ func setupCreateJob(jobConfig config.Job) Executor { // RunCreateJob executes a creation job func (ex *Executor) RunCreateJob() { - log.Infof("Triggering job: %s", ex.Config.Name) nsLabels := map[string]string{ "kube-burner-job": ex.Config.Name, "kube-burner-uuid": ex.uuid, @@ -120,6 +119,7 @@ func (ex *Executor) RunCreateJob() { } } for i := 1; i <= ex.Config.JobIterations; i++ { + log.Infof("Creating object replicas from iteration %d", i) if ex.Config.NamespacedIterations { ns = fmt.Sprintf("%s-%d", ex.Config.Namespace, i) nsLabels["name"] = ns @@ -227,7 +227,7 @@ func createRequest(gvr schema.GroupVersionResource, ns string, obj *unstructured log.Error("Retrying object creation") return false, nil } - log.Infof("Created %s/%s in namespace %s", uns.GetKind(), uns.GetName(), ns) + log.Debugf("Created %s/%s in namespace %s", uns.GetKind(), uns.GetName(), ns) return true, err }) } diff --git a/pkg/burner/delete.go b/pkg/burner/delete.go index 761e9e128..22208a90e 100644 --- a/pkg/burner/delete.go +++ b/pkg/burner/delete.go @@ -55,8 +55,7 @@ func setupDeleteJob(jobConfig config.Job) Executor { // RunDeleteJob executes a deletion job func (ex *Executor) RunDeleteJob() { var wg sync.WaitGroup - var resp *unstructured.UnstructuredList - log.Infof("Triggering job: %s", ex.Config.Name) + var itemList *unstructured.UnstructuredList _, RestConfig, err := config.GetClientSet(ex.Config.QPS, ex.Config.Burst) if err != nil { log.Fatalf("Error creating restConfig for kube-burner: %s", err) @@ -71,7 +70,7 @@ func (ex *Executor) RunDeleteJob() { LabelSelector: labelSelector, } err = RetryWithExponentialBackOff(func() (done bool, err error) { - resp, err = dynamicClient.Resource(obj.gvr).List(context.TODO(), listOptions) + itemList, err = dynamicClient.Resource(obj.gvr).List(context.TODO(), listOptions) if err != nil { log.Errorf("Error found listing %s labeled with %s: %s", obj.gvr.Resource, labelSelector, err) return false, nil @@ -81,8 +80,8 @@ func (ex *Executor) RunDeleteJob() { if err != nil { continue } - log.Infof("Found %d %s with selector %s", len(resp.Items), obj.gvr.Resource, labelSelector) - for _, item := range resp.Items { + log.Infof("Found %d %s with selector %s, removing them", len(itemList.Items), obj.gvr.Resource, labelSelector) + for _, item := range itemList.Items { wg.Add(1) go func(item unstructured.Unstructured) { defer wg.Done() @@ -93,9 +92,9 @@ func (ex *Executor) RunDeleteJob() { } else { ns := item.GetNamespace() if ns != "" { - log.Infof("Removing %s/%s from namespace %s", item.GetKind(), item.GetName(), ns) + log.Debugf("Removing %s/%s from namespace %s", item.GetKind(), item.GetName(), ns) } else { - log.Infof("Removing %s/%s", item.GetKind(), item.GetName()) + log.Debugf("Removing %s/%s", item.GetKind(), item.GetName()) } } }(item) @@ -103,12 +102,12 @@ func (ex *Executor) RunDeleteJob() { if ex.Config.WaitForDeletion { wg.Wait() wait.PollImmediateInfinite(2*time.Second, func() (bool, error) { - resp, err = dynamicClient.Resource(obj.gvr).List(context.TODO(), listOptions) + itemList, err = dynamicClient.Resource(obj.gvr).List(context.TODO(), listOptions) if err != nil { return false, err } - if len(resp.Items) > 0 { - log.Infof("Waiting for %d %s labeled with %s to be deleted", len(resp.Items), obj.gvr.Resource, labelSelector) + if len(itemList.Items) > 0 { + log.Debugf("Waiting for %d %s labeled with %s to be deleted", len(itemList.Items), obj.gvr.Resource, labelSelector) return false, nil } return true, nil diff --git a/pkg/burner/namespaces.go b/pkg/burner/namespaces.go index aa4e1b926..b7bc94cfe 100644 --- a/pkg/burner/namespaces.go +++ b/pkg/burner/namespaces.go @@ -44,7 +44,7 @@ func createNamespace(clientset *kubernetes.Clientset, namespaceName string, nsLa log.Errorf("Unexpected error creating namespace %s: %s", ns.Name, err) return false, nil } - log.Infof("Created namespace: %s", ns.Name) + log.Debugf("Created namespace: %s", ns.Name) return true, err }) }