Skip to content

Commit

Permalink
Fix Reconciliation errors when PromRule/ConfigMap doesn't exist
Browse files Browse the repository at this point in the history
Signed-off-by: Arthur Silva Sens <[email protected]>
  • Loading branch information
Arthur Silva Sens committed Nov 27, 2023
1 parent 81a1493 commit fad4f84
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions kubernetes/controllers/servicelevelobjective.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,10 +79,9 @@ func (r *ServiceLevelObjectiveReconciler) reconcilePrometheusRule(ctx context.Co
if err := r.Create(ctx, newRule); err != nil {
return ctrl.Result{}, err
}
return ctrl.Result{}, fmt.Errorf("failed to create prometheus rule: %w", err)
} else {
return ctrl.Result{}, fmt.Errorf("failed to get prometheus rule: %w", err)
}

return ctrl.Result{}, fmt.Errorf("failed to get prometheus rule: %w", err)
}

newRule.ResourceVersion = rule.ResourceVersion
Expand Down Expand Up @@ -123,9 +122,9 @@ func (r *ServiceLevelObjectiveReconciler) reconcileConfigMap(
if err := r.Create(ctx, newConfigMap); err != nil {
return ctrl.Result{}, fmt.Errorf("failed to create config map: %w", err)
}
} else {
return ctrl.Result{}, fmt.Errorf("failed to get config map: %w", err)
}

return ctrl.Result{}, err
}

newConfigMap.ResourceVersion = existingConfigMap.ResourceVersion
Expand Down

0 comments on commit fad4f84

Please sign in to comment.