Skip to content

Commit

Permalink
Decrease default verbosity
Browse files Browse the repository at this point in the history
Signed-off-by: Raul Sevilla <[email protected]>
  • Loading branch information
rsevilla87 committed Jul 16, 2021
1 parent 1bc7401 commit d0b126d
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 13 deletions.
1 change: 1 addition & 0 deletions cmd/kube-burner/kube-burner.go
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
4 changes: 2 additions & 2 deletions pkg/burner/create.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
})
}
19 changes: 9 additions & 10 deletions pkg/burner/delete.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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
Expand All @@ -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()
Expand All @@ -93,22 +92,22 @@ 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)
}
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
Expand Down
2 changes: 1 addition & 1 deletion pkg/burner/namespaces.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
})
}
Expand Down

0 comments on commit d0b126d

Please sign in to comment.