-
Notifications
You must be signed in to change notification settings - Fork 260
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
bc663e5
commit 7c2b95f
Showing
20 changed files
with
1,560 additions
and
1,120 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,3 +19,4 @@ generated_values*.yaml | |
.isort.cfg | ||
skaffold.dev.yaml | ||
tests/last_used_tag.txt | ||
pytest.ini |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
################# | ||
|
||
Robusta can report issues and events in your Kubernetes cluster by sending | ||
emails. | ||
|
||
Connecting the mail sink | ||
------------------------------------------------ | ||
|
||
To set up the mail sink, you need access to an SMTP server. You should also | ||
set the sender and receiver(s) addresses. | ||
|
||
As Robusta uses the `Apprise library <https://github.com/caronc/apprise>`_ under the hood for running mail | ||
notifications, you can configure the "mailto" field described below using | ||
the convenient and sophisticated syntax provided by Apprise. For more details | ||
`see here <https://github.com/caronc/apprise/wiki/Notify_email>`_. | ||
|
||
Configuring the mail sink | ||
------------------------------------------------ | ||
|
||
.. admonition:: Add this to your generated_values.yaml | ||
|
||
.. code-block:: yaml | ||
sinksConfig: | ||
- mail_sink: | ||
name: mail_sink | ||
mailto: "mailtos://user:password@server&from=a@x&to=b@y,c@z" | ||
(Note the quotes around the value in mailto. It's highly recommended to add | ||
them as this ensures that characters like `:` are handled correctly) | ||
|
||
Then do a :ref:`Helm Upgrade <Simple Upgrade>`. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
from robusta.core.reporting.base import Finding | ||
from robusta.core.sinks.sink_base import SinkBase | ||
from robusta.core.sinks.mail.mail_sink_params import MailSinkConfigWrapper | ||
from robusta.integrations.mail.sender import MailSender | ||
|
||
|
||
class MailSink(SinkBase): | ||
def __init__(self, sink_config: MailSinkConfigWrapper, registry): | ||
super().__init__(sink_config.mail_sink, registry) | ||
self.sender = MailSender( | ||
sink_config.mail_sink.mailto, | ||
self.signing_key, | ||
self.account_id, | ||
self.cluster_name, | ||
) | ||
|
||
def write_finding(self, finding: Finding, platform_enabled: bool): | ||
self.sender.send_finding_via_email(finding, platform_enabled) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
from pydantic import validator | ||
|
||
from robusta.core.sinks.sink_base_params import SinkBaseParams | ||
from robusta.core.sinks.sink_config import SinkConfigBase | ||
|
||
|
||
class MailSinkParams(SinkBaseParams): | ||
mailto: str | ||
|
||
@validator("mailto") | ||
def validate_mailto(cls, mailto): | ||
# Make sure we only handle emails and exclude other schemes provided by apprise | ||
# (there is a lot of them). | ||
if not (mailto.startswith("mailto://") or mailto.startswith("mailtos://")): | ||
raise AttributeError(f"{mailto} is not a mailto(s) address") | ||
return mailto | ||
|
||
|
||
class MailSinkConfigWrapper(SinkConfigBase): | ||
mail_sink: MailSinkParams | ||
|
||
def get_params(self) -> SinkBaseParams: | ||
return self.mail_sink |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
Oops, something went wrong.