Skip to content

Commit

Permalink
Simplify; single flow
Browse files Browse the repository at this point in the history
Signed-off-by: Arnob kumar saha <[email protected]>
  • Loading branch information
ArnobKumarSaha committed Aug 1, 2024
1 parent 283365a commit af3ce0c
Showing 1 changed file with 10 additions and 13 deletions.
23 changes: 10 additions & 13 deletions pkg/controllers/feature/feature_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -338,25 +338,22 @@ func (r *frReconciler) checkRequiredWorkloadExistence(ctx context.Context) (*req
}

const requiredGroup = ""
for _, w := range groups[requiredGroup] {
status, err := r.checkWorkload(ctx, w)
if err != nil || !status.found || !status.ready {
return status, err
}
}
for _, workloads := range groups {
for group, workloads := range groups {
var found, ready bool
if group == requiredGroup {
found, ready = true, true
}
for _, w := range workloads {
status, err := r.checkWorkload(ctx, w)
if err != nil {
return status, err
} else if status.found && status.ready {
found = true
ready = true
break
}
if status.found {
found = true
if group == requiredGroup {
found = found && status.found
ready = ready && status.ready
} else {
found = found || status.found
ready = ready || status.ready
}
}

Expand Down

0 comments on commit af3ce0c

Please sign in to comment.