Skip to content

Commit

Permalink
Don't return on error while waiting for stuff removal (kube-burner#264)
Browse files Browse the repository at this point in the history
* Don't return on error while waiting for stuff removal

Signed-off-by: Raul Sevilla <[email protected]>

* Remove nsObjects field

Signed-off-by: Raul Sevilla <[email protected]>

---------

Signed-off-by: Raul Sevilla <[email protected]>
  • Loading branch information
rsevilla87 authored Mar 3, 2023
1 parent 7b62be9 commit b4f1307
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 12 deletions.
6 changes: 3 additions & 3 deletions pkg/burner/create.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ func setupCreateJob(jobConfig config.Job) Executor {
}
// If any of the objects is namespaced, we configure the job to create namepaces
if o.Namespaced {
ex.nsObjects = true
ex.Config.NamespacedIterations = true
}
log.Infof("Job %s: %d iterations with %d %s replicas", jobConfig.Name, jobConfig.JobIterations, obj.replicas, gvk.Kind)
ex.objects = append(ex.objects, obj)
Expand All @@ -106,7 +106,7 @@ func (ex *Executor) RunCreateJob(iterationStart, iterationEnd int) {
for label, value := range ex.Config.NamespaceLabels {
nsLabels[label] = value
}
if ex.nsObjects && !ex.Config.NamespacedIterations {
if !ex.Config.NamespacedIterations {
ns = ex.Config.Namespace
if err = createNamespace(ClientSet, ns, nsLabels); err != nil {
log.Fatal(err.Error())
Expand All @@ -115,7 +115,7 @@ func (ex *Executor) RunCreateJob(iterationStart, iterationEnd int) {
start := time.Now().Round(time.Second)
for i := iterationStart; i <= iterationEnd; i++ {
log.Debugf("Creating object replicas from iteration %d", i)
if ex.nsObjects && ex.Config.NamespacedIterations {
if ex.Config.NamespacedIterations {
ns = fmt.Sprintf("%s-%d", ex.Config.Namespace, i)
if err = createNamespace(ClientSet, fmt.Sprintf("%s-%d", ex.Config.Namespace, i), nsLabels); err != nil {
log.Error(err.Error())
Expand Down
3 changes: 2 additions & 1 deletion pkg/burner/delete.go
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,8 @@ func (ex *Executor) RunDeleteJob() {
wait.PollImmediateInfinite(2*time.Second, func() (bool, error) {
itemList, err = dynamicClient.Resource(obj.gvr).List(context.TODO(), listOptions)
if err != nil {
return false, err
log.Error(err.Error())
return false, nil
}
if len(itemList.Items) > 0 {
log.Debugf("Waiting for %d %s labeled with %s to be deleted", len(itemList.Items), obj.gvr.Resource, labelSelector)
Expand Down
15 changes: 7 additions & 8 deletions pkg/burner/job.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,14 +52,13 @@ type object struct {

// Executor contains the information required to execute a job
type Executor struct {
objects []object
Start time.Time
End time.Time
Config config.Job
selector *util.Selector
uuid string
limiter *rate.Limiter
nsObjects bool
objects []object
Start time.Time
End time.Time
Config config.Job
selector *util.Selector
uuid string
limiter *rate.Limiter
}

const (
Expand Down

0 comments on commit b4f1307

Please sign in to comment.