Skip to content

Commit

Permalink
patch - bug fixing (#68)
Browse files Browse the repository at this point in the history
  • Loading branch information
OrNovo authored Aug 28, 2023
1 parent 31cf6ac commit b46ac47
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -106,8 +106,13 @@ func (r *RecordingRuleGroupSetReconciler) Reconcile(ctx context.Context, req ctr
log.V(1).Info("Deleting RecordingRuleGroupSet", "recordingRuleGroup ID", id)
if _, err := rRGClient.DeleteRecordingRuleGroupSet(ctx, deleteRRGReq); err != nil {
// if fail to delete the external dependency here, return with error
// so that it can be retried
// so that it can be retried unless it is deleted manually.
log.Error(err, "Received an error while Deleting a RecordingRuleGroupSet", "recordingRuleGroup ID", id)
if status.Code(err) == codes.NotFound {
controllerutil.RemoveFinalizer(ruleGroupSetCRD, myFinalizerName)
err := r.Update(ctx, ruleGroupSetCRD)
return ctrl.Result{}, err
}
return ctrl.Result{}, err
}

Expand Down
7 changes: 6 additions & 1 deletion controllers/alphacontrollers/rulegroup_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -107,8 +107,13 @@ func (r *RuleGroupReconciler) Reconcile(ctx context.Context, req ctrl.Request) (
log.V(1).Info("Deleting Rule-Group", "Rule-Group ID", ruleGroupId)
if _, err := rulesGroupsClient.DeleteRuleGroup(ctx, deleteRuleGroupReq); err != nil {
// if fail to delete the external dependency here, return with error
// so that it can be retried
// so that it can be retried unless it is deleted manually.
log.Error(err, "Received an error while Deleting a Rule-Group", "Rule-Group ID", ruleGroupId)
if status.Code(err) == codes.NotFound {
controllerutil.RemoveFinalizer(ruleGroupCRD, myFinalizerName)
err := r.Update(ctx, ruleGroupCRD)
return ctrl.Result{}, err
}
return ctrl.Result{}, err
}

Expand Down

0 comments on commit b46ac47

Please sign in to comment.