Make replyToAddress optional

[ZITADOPER-1]
This commit is contained in:
Haim Kortovich
2024-05-16 16:03:02 -05:00
parent 85a88256b9
commit 7bdffef346
5 changed files with 13 additions and 8 deletions

View File

@@ -221,7 +221,6 @@ spec:
type: string type: string
required: required:
- host - host
- replyToAddress
- senderAddress - senderAddress
- senderName - senderName
- tls - tls

View File

@@ -42,7 +42,7 @@ type SMTPConfig struct {
Host string `json:"host"` Host string `json:"host"`
User *string `json:"user,omitempty"` User *string `json:"user,omitempty"`
Password *Password `json:"password,omitempty"` Password *Password `json:"password,omitempty"`
ReplyToAddress string `json:"replyToAddress"` ReplyToAddress *string `json:"replyToAddress,omitempty"`
} }
type DomainSettings struct { type DomainSettings struct {

View File

@@ -668,6 +668,11 @@ func (in *SMTPConfig) DeepCopyInto(out *SMTPConfig) {
*out = new(Password) *out = new(Password)
(*in).DeepCopyInto(*out) (*in).DeepCopyInto(*out)
} }
if in.ReplyToAddress != nil {
in, out := &in.ReplyToAddress, &out.ReplyToAddress
*out = new(string)
**out = **in
}
} }
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SMTPConfig. // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SMTPConfig.

View File

@@ -222,7 +222,6 @@ spec:
type: string type: string
required: required:
- host - host
- replyToAddress
- senderAddress - senderAddress
- senderName - senderName
- tls - tls

View File

@@ -463,11 +463,10 @@ func (r *ZitadelClusterReconciler) reconcileSMTPConfig(ctx context.Context, zita
return ctrl.Result{}, err return ctrl.Result{}, err
} }
adminRequest := &adm.AddSMTPConfigRequest{ adminRequest := &adm.AddSMTPConfigRequest{
SenderAddress: zitadel.Spec.SMTPConfig.SenderAddress, SenderAddress: zitadel.Spec.SMTPConfig.SenderAddress,
SenderName: zitadel.Spec.SMTPConfig.SenderName, SenderName: zitadel.Spec.SMTPConfig.SenderName,
Tls: zitadel.Spec.SMTPConfig.TLS, Tls: zitadel.Spec.SMTPConfig.TLS,
Host: zitadel.Spec.SMTPConfig.Host, Host: zitadel.Spec.SMTPConfig.Host,
ReplyToAddress: zitadel.Spec.SMTPConfig.ReplyToAddress,
} }
if zitadel.Spec.SMTPConfig.User != nil && zitadel.Spec.SMTPConfig.Password != nil { if zitadel.Spec.SMTPConfig.User != nil && zitadel.Spec.SMTPConfig.Password != nil {
passwordSecret, err := r.RefResolver.SecretKeyRef(ctx, zitadel.Spec.SMTPConfig.Password.SecretKeyRef, zitadel.Namespace) passwordSecret, err := r.RefResolver.SecretKeyRef(ctx, zitadel.Spec.SMTPConfig.Password.SecretKeyRef, zitadel.Namespace)
@@ -477,6 +476,9 @@ func (r *ZitadelClusterReconciler) reconcileSMTPConfig(ctx context.Context, zita
adminRequest.Password = passwordSecret adminRequest.Password = passwordSecret
adminRequest.User = *zitadel.Spec.SMTPConfig.User adminRequest.User = *zitadel.Spec.SMTPConfig.User
} }
if zitadel.Spec.SMTPConfig.ReplyToAddress != nil {
adminRequest.ReplyToAddress = *zitadel.Spec.SMTPConfig.ReplyToAddress
}
if _, err = adminClient.AddSMTPConfig(ctx, adminRequest); err != nil { if _, err = adminClient.AddSMTPConfig(ctx, adminRequest); err != nil {
return ctrl.Result{}, fmt.Errorf("Could not add SMTP config: %v", err) return ctrl.Result{}, fmt.Errorf("Could not add SMTP config: %v", err)