Skip to content

Commit

Permalink
bug: return nil on error
Browse files Browse the repository at this point in the history
  • Loading branch information
katallaxie authored Nov 29, 2024
1 parent 0b94296 commit f5eb9fc
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 6 deletions.
3 changes: 1 addition & 2 deletions controllers/natsaccount_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -276,11 +276,10 @@ func (r *NatsAccountReconciler) reconcileSecret(ctx context.Context, account *na

if op == controllerutil.OperationResultCreated || op == controllerutil.OperationResultUpdated {
r.Recorder.Event(account, corev1.EventTypeNormal, conv.String(EventReasonAccountSecretCreateSucceeded), "secret created or updated")

log.Info("secret created or updated", "operation", op)
}

return err
return nil
}

// SetupWithManager sets up the controller with the Manager.
Expand Down
12 changes: 9 additions & 3 deletions controllers/natsoperator_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -205,12 +205,15 @@ func (r *NatsOperatorReconciler) reconcileSystemAccount(ctx context.Context, ope

return nil
})
if err != nil {
return err
}

if op == controllerutil.OperationResultCreated || op == controllerutil.OperationResultUpdated {
log.Info("system account created or updated", "operation", op)
}

return err
return nil
}

func (r *NatsOperatorReconciler) reconcileOperator(ctx context.Context, operator *natsv1alpha1.NatsOperator) error {
Expand Down Expand Up @@ -268,12 +271,15 @@ func (r *NatsOperatorReconciler) reconcileServerConfig(ctx context.Context, oper

return controllerutil.SetControllerReference(operator, serverConfig, r.Scheme)
})
if err != nil {
return err
}

if op == controllerutil.OperationResultCreated || op == controllerutil.OperationResultUpdated {
log.Info("system account created or updated", "operation", op)
}

return err
return nil
}

func (r *NatsOperatorReconciler) reconcileStatus(ctx context.Context, operator *natsv1alpha1.NatsOperator) error {
Expand Down Expand Up @@ -387,7 +393,7 @@ func (r *NatsOperatorReconciler) reconcileSecret(ctx context.Context, operator *
return err
}

return err
return nil
}

// SetupWithManager sets up the controller with the Manager.
Expand Down
2 changes: 1 addition & 1 deletion controllers/natsuser_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,7 @@ func (r *NatsUserReconciler) reconcileSecret(ctx context.Context, user *natsv1al
log.Info("secret created or updated", "operation", op)
}

return err
return nil
}

// SetupWithManager sets up the controller with the Manager.
Expand Down

0 comments on commit f5eb9fc

Please sign in to comment.