Skip to content

Commit

Permalink
Merge branch 'add-visibility-out-of-the-box-into-evictions' of github…
Browse files Browse the repository at this point in the history
….com:robusta-dev/robusta into add-visibility-out-of-the-box-into-evictions
  • Loading branch information
itisallgood committed Jul 12, 2024
2 parents 800d623 + f48648b commit 7aae9a6
Show file tree
Hide file tree
Showing 24 changed files with 772 additions and 285 deletions.
2 changes: 1 addition & 1 deletion .flake8
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@ exclude = .git,
.mypy_cache,
src/robusta/integrations/kubernetes/autogenerated,
src/robusta/integrations/kubernetes/custom_models.py
ignore = E501, W503, E203
ignore = E501, W503, E203, E402
2 changes: 1 addition & 1 deletion .github/workflows/deploy-docs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ jobs:
- name: Upload docs to public gcp bucket
if: needs.has-secrets.outputs.docs
run: gsutil rsync -R ./docs/_build/html "gs://robusta-public/${GITHUB_REF##*/}/"
run: gsutil rsync -R ./docs/_build/html "gs://robusta-docs/${GITHUB_REF##*/}/"

- name: Upload docs artifact
uses: actions/upload-artifact@v2
Expand Down
5 changes: 5 additions & 0 deletions docs/configuration/sinks/mail.rst
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,11 @@ Configuring the mail sink
- mail_sink:
name: mail_sink
mailto: "mailtos://user:password@server&from=a@x&to=b@y,c@z"
with_header: false # optional
The default value of the optional `with_header` parameter is `true`. If set to `false`, mails
sent by this sink will *not* include header information, such as the finding header, investigate
button and the source of the notification.

.. note::

Expand Down
38 changes: 38 additions & 0 deletions docs/configuration/sinks/ms-teams.rst
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ Configuring the MS Teams sink
- ms_teams_sink:
name: main_ms_teams_sink
webhook_url: teams-incoming-webhook # see instructions below
webhook_override: DYNAMIC MS TEAMS WEBHOOK URL OVERRIDE (Optional)
Then do a :ref:`Helm Upgrade <Simple Upgrade>`.

Expand All @@ -35,3 +36,40 @@ Obtaining a webhook URL
.. image:: /images/msteams_sink/msteam_get_webhook_url.gif
:width: 1024
:align: center


Dynamically Route MS Teams Alerts
-------------------------------------------------------------------

You can set the MS Teams webhook url value dynamically, based on the value of a specific ``annotation`` and environmental variable passed to runner.

This can be done using the optional ``webhook_override`` sink parameter.

As for now, the ``webhook_override`` parameter supports retrieving values specifically from annotations. You can specify an annotation key to retrieve the MS Teams webhook URL using the format ``annotations.<annotation_key>``. For example, if you use ``annotations.ms-team-alerts-sink``, the webhook URL will be taken from an annotation with the key ``ms-team-alerts-sink``.

If the specified annotation does not exist, the default webhook URL from the ``webhook_url`` parameter will be used. If the annotation exists but does not contain a URL, the system will look for an environmental variable with the name matching the ``annotation`` value.

.. code-block:: yaml
sinksConfig:
# MS Teams integration params
- ms_teams_sink:
name: main_ms_teams_sink
webhook_url: teams-incoming-webhook # see instructions below
webhook_override: "annotations.ms-team-alerts-sink"
A replacement pattern is also allowed, using ``$`` sign, before the variable.
For cases where labels or annotations include special characters, such as ``${annotations.kubernetes.io/service-name}``, you can use the `${}` replacement pattern to represent the entire key, including special characters.
For example, if you want to dynamically set the MS Teams webhook url based on the annotation ``kubernetes.io/service-name``, you can use the following syntax:

- ``webhook_override: "${annotations.kubernetes.io/service-name}"``

Example:

.. code-block:: yaml
sinksConfig:
- ms_teams_sink:
name: main_ms_teams_sink
webhook_url: teams-incoming-webhook # see instructions below
webhook_override: ${annotations.kubernetes.io/service-name}
6 changes: 5 additions & 1 deletion docs/configuration/sinks/slack.rst
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,17 @@ Alternatively, generate a key by running ``robusta integrations slack`` and set
# slack integration params
- slack_sink:
name: main_slack_sink
api_key: MY SLACK KEY
api_key: MY SLACK KEY # to avoid putting your key in Helm values, see below
slack_channel: MY SLACK CHANNEL
max_log_file_limit_kb: <Optional> # (Default: 1000) The maximum allowed file size for "snippets" (in kilobytes) uploaded to the Slack channel. Larger files can be sent to Slack, but they may not be viewable directly within the Slack.
channel_override: DYNAMIC SLACK CHANNEL OVERRIDE (Optional)
Then do a :ref:`Helm Upgrade <Simple Upgrade>`.

.. warning::

If you don't want to put your Slack key in Helm values, you can use a secret. See the :ref:`Managing Secrets <Managing Secrets>` section for more information.

Notification Grouping
-----------------------------
Slack allows grouping multiple notifications into summary messages and Slack threads. Refer to :ref:`Notification Grouping <notification-grouping>`.
Expand Down
2 changes: 1 addition & 1 deletion helm/robusta/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -535,7 +535,7 @@ platformPlaybooks:
actions:
- create_finding:
aggregation_key: "JobFailure"
title: "Job Failed"
title: "Job $name on namespace $namespace failed"
- job_info_enricher: {}
- job_events_enricher: {}
- job_pod_enricher: {}
Expand Down
6 changes: 4 additions & 2 deletions playbooks/robusta_playbooks/common_actions.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,9 @@ def customise_finding(event: ExecutionBaseEvent, params: FindingOverrides):

class FindingFields(ActionParams):
"""
:var title: Finding title. Title can be templated with name/namespace/kind/node of the resource, if applicable
:var title: Finding title. Title can be templated with name/namespace/kind/node of the resource, if applicable.
|
Additionally, templating with labels and annotations of the resource is supported via $labels.label_name and $annotations.annotation_name.
:var aggregation_key: Aggregation Keys are used for grouping similar types of notifications together.
|
For example, all CrashLoopBackOff notifications should have the same Aggregation Key so that Sinks can group them together.
Expand All @@ -54,7 +56,7 @@ class FindingFields(ActionParams):
:var description: Finding description. Description can be templated
:var severity: Finding severity. Allowed values: DEBUG, INFO, LOW, MEDIUM, HIGH
:example title: "Job $name on namespace $namespace failed"
:example title: "Job $name (importance: $labels.importance) in namespace $namespace failed"
:example aggregation_key: "JobFailure"
:example severity: DEBUG
"""
Expand Down
Loading

0 comments on commit 7aae9a6

Please sign in to comment.