Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Azure - Add mailer support to the Container Host helm chart #4711

Merged
merged 11 commits into from Sep 3, 2019

Conversation

axis7818
Copy link
Collaborator

@axis7818 axis7818 commented Aug 29, 2019

#4680

Add support for deploying c7n_mailer's docker image along with the container host through the helm chart. The mailer is deployed as a Kubernetes CronJob, and a custom cron schedule can be specified.

Other Fixes

  • proper text encoding for emails sent through the SendGrid SDK/API
  • deploy_chart.py modified to read in a helm values file. This cuts down on the number of CLI options that need to be parsed.

@axis7818 axis7818 added this to In progress in azure via automation Aug 29, 2019
@axis7818 axis7818 added this to the Azure Milestone A milestone Aug 29, 2019
@logachev logachev removed this from In progress in azure Aug 29, 2019
@@ -94,18 +96,19 @@ def sendgrid_handler(self, queue_message, to_addrs_to_email_messages_map):

for email_to_addrs, message in six.iteritems(to_addrs_to_email_messages_map):
for to_address in email_to_addrs:
message_string = base64.b64decode(message.get_payload()).decode('utf-8')
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will follow up offline about this. We should use sendgrids Mail.from_emailmessage() method and replace most of this code.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It wasn't quite as easy as calling Mail.from_EmailMessage. So, I copied that function at the bottom of this file and made some changes.

  1. I think SendGrid has a bug in that call which is fixed by creating a To object instead of an Email object when calling the Mail constructor.
  2. We set a number of headers on the message object that break the SendGrid API (they are reserved keys), so I ignore those headers when copying the headers over. more info

@axis7818 axis7818 marked this pull request as ready for review September 3, 2019 18:26
Copy link
Collaborator

@stefangordon stefangordon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for working through all that, good stuff.

tools/ops/azure/container-host/chart/values.yaml Outdated Show resolved Hide resolved
@axis7818 axis7818 merged commit 74ae873 into cloud-custodian:master Sep 3, 2019
fidelito pushed a commit to fidelito/cloud-custodian that referenced this pull request May 29, 2020
…stodian#4711)

* fix email content for sendgrid

* mailer support for helm chart

* update sendgrid email sdk

* update deployment script to read a values file

* cleanup deployment script

* update docs

* show more helm output

* fix typo
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants