Skip to content

Commit

Permalink
Restore deprecated NotificationsConfig.Region field (#4299)
Browse files Browse the repository at this point in the history
Signed-off-by: Andrew Dye <andrewwdye@gmail.com>
  • Loading branch information
andrewwdye authored Oct 25, 2023
1 parent 6cc1f15 commit 1074826
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
5 changes: 5 additions & 0 deletions charts/flyte-core/templates/admin/configmap.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
Expand Down
12 changes: 10 additions & 2 deletions flyteadmin/pkg/async/notifications/factory.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit 1074826

Please sign in to comment.