From ea6d3d979bcb759af4e400de9f2e3bb782ad9b77 Mon Sep 17 00:00:00 2001 From: Haim Kortovich Date: Thu, 16 May 2024 17:09:20 -0500 Subject: [PATCH] Handle config not found [ZITADOPER-1] --- src/internal/controller/zitadelcluster_controller.go | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/internal/controller/zitadelcluster_controller.go b/src/internal/controller/zitadelcluster_controller.go index 6c33fa7..0267eff 100644 --- a/src/internal/controller/zitadelcluster_controller.go +++ b/src/internal/controller/zitadelcluster_controller.go @@ -192,7 +192,7 @@ func (r *ZitadelClusterReconciler) Reconcile(ctx context.Context, req ctrl.Reque } if err := errBundle.ErrorOrNil(); err != nil { - return ctrl.Result{RequeueAfter: 2 * time.Minute}, fmt.Errorf("error reconciling %s: %v", p.Name, err) + return ctrl.Result{}, fmt.Errorf("error reconciling %s: %v", p.Name, err) } } if !result.IsZero() { @@ -464,9 +464,11 @@ func (r *ZitadelClusterReconciler) reconcileSMTPConfig(ctx context.Context, zita } resp, err := adminClient.GetSMTPConfig(ctx, &adm.GetSMTPConfigRequest{}) if err != nil { - return ctrl.Result{}, fmt.Errorf("Error getting SMTP config: %v", err) + if !strings.Contains(err.Error(), "SMTP configuration not found") { + return ctrl.Result{}, fmt.Errorf("Error getting SMTP config: %v", err) + } } - if resp.SmtpConfig != nil { + if resp != nil { adminRequest := &adm.UpdateSMTPConfigRequest{ SenderAddress: zitadel.Spec.SMTPConfig.SenderAddress, SenderName: zitadel.Spec.SMTPConfig.SenderName,