From 10748266737a77f74221fdef14acd1fbe87039a2 Mon Sep 17 00:00:00 2001 From: Andrew Dye Date: Wed, 25 Oct 2023 11:49:20 -0700 Subject: [PATCH] Restore deprecated NotificationsConfig.Region field (#4299) Signed-off-by: Andrew Dye --- charts/flyte-core/templates/admin/configmap.yaml | 5 +++++ flyteadmin/pkg/async/notifications/factory.go | 12 ++++++++++-- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/charts/flyte-core/templates/admin/configmap.yaml b/charts/flyte-core/templates/admin/configmap.yaml index 53af659e8b..04e5cac6b3 100644 --- a/charts/flyte-core/templates/admin/configmap.yaml +++ b/charts/flyte-core/templates/admin/configmap.yaml @@ -48,6 +48,11 @@ data: notifications.yaml: | notifications: type: {{ .Values.workflow_notifications.config.notifications.type }} + {{- if not .Values.workflow_notifications.config.notifications.aws }} + {{- with .Values.workflow_notifications.config.notifications.region }} + region: {{ tpl . $ }} + {{- end }} + {{- end }} {{- if eq .Values.workflow_notifications.config.notifications.type "aws" }} {{- with .Values.workflow_notifications.config.notifications.aws }} aws: {{ tpl (toYaml .) $ | nindent 8 }} diff --git a/flyteadmin/pkg/async/notifications/factory.go b/flyteadmin/pkg/async/notifications/factory.go index 53e96f7e67..f94129a1d5 100644 --- a/flyteadmin/pkg/async/notifications/factory.go +++ b/flyteadmin/pkg/async/notifications/factory.go @@ -64,7 +64,11 @@ func GetEmailer(config runtimeInterfaces.NotificationsConfig, scope promutils.Sc switch config.Type { case common.AWS: - awsConfig := aws.NewConfig().WithRegion(config.Region).WithMaxRetries(maxRetries) + region := config.AWSConfig.Region + if region == "" { + region = config.Region + } + awsConfig := aws.NewConfig().WithRegion(region).WithMaxRetries(maxRetries) awsSession, err := session.NewSession(awsConfig) if err != nil { panic(err) @@ -98,7 +102,11 @@ func NewNotificationsProcessor(config runtimeInterfaces.NotificationsConfig, sco // However, the message body of SQS is the SNS message format which isn't Base64 encoded. ConsumeBase64: &enable64decoding, } - sqsConfig.Region = config.Region + if config.AWSConfig.Region != "" { + sqsConfig.Region = config.AWSConfig.Region + } else { + sqsConfig.Region = config.Region + } var err error err = async.Retry(reconnectAttempts, reconnectDelay, func() error { sub, err = gizmoAWS.NewSubscriber(sqsConfig)