Build from SourceΒΆ
Install Robusta from source to develop new features for the Robusta Engine (robusta-runner).
To install Robusta as a user, follow Monitor Kubernetes from Scratch instead.
To develop new playbook actions, you don't need to install from source. Refer to Developing New Actions.
Using Mirrord (Recommended)ΒΆ
Use Mirrord to build and test Robusta on your local machine:
Clone Robusta's source code:
git clone https://github.com/robusta-dev/robusta.git && cd robustaRun Robusta via Mirrord
./run_runner_locally.shand follow the instructions in your terminal.
Developing Playbooks LocallyΒΆ
Run Robusta with Mirrord, as described above
Add a local playbooks directory to
deployment/playbooks/active_playbooks.yaml:
# this example shows how to locally develop https://github.com/robusta-dev/kubernetes-chatgpt-bot
playbook_repos:
chatgpt_robusta_actions:
url: "file:///path/to/kubernetes-chatgpt-bot"
To apply changes to your playbook without restarting Robusta, simply run:
touch deployment/playbooks/active_playbooks.yaml.
Common Errors
This error occurs on macOS devices with Apple Silicon. It's related to security restrictions on multi-threading involving fork() in Python.
Solution:
To resolve this issue, set the following environment variable in your project's environment variables:
OBJC_DISABLE_INITIALIZE_FORK_SAFETY=YES
Setting the Environment Variable in IDEs:
PyCharm:
In PyCharm, go to 'Run' -> 'Edit Configurations', then find your project's configuration. Under 'Environment variables', add:
OBJC_DISABLE_INITIALIZE_FORK_SAFETY=YES.VSCode:
In VSCode, modify your .vscode/launch.json file by adding the following line to your configuration settings:
"env": {"OBJC_DISABLE_INITIALIZE_FORK_SAFETY": "YES"}.
Occurs on Mac OS if dependencies are missing. Run brew install libjpeg.
Sometimes, when attaching a debugger to Robusta the following error occurs: NotADirectoryError: [Errno 20] Not a directory
If this occurs, disable the Attach to subprocess option on your debugger.
Using Skaffold (Alternative to Using Mirrord)ΒΆ
Instead of running Robusta locally with Mirrord, you can test Robusta inside a Kubernetes cluster using Skaffold:
git clonethe source code.Run
helm repo add prometheus-community https://prometheus-community.github.io/helm-chartsRun
robusta gen-configand copy the result todeployment/generated_values.yamlRun
skaffold run --tail. On M1 Macs, add-p apple-m1-dev
Alert SimulationΒΆ
To simulate a Prometheus alerts and cause relevant playbooks to run:
poetry run robusta demo-alert --alert=Test123 --labels=label1=123,label2=abc
If running multiple times in a row, change a label value each time so that AlertManager doesn't supress retransmissions.
CLI DevelopmentΒΆ
To develop the robusta cli:
git clonethe source codepoetry installpoetry run robusta
Alternative method, using pip not poetry
Install the robusta cli into your global python environment:
git clonethe source codepip3 install .
Running TestsΒΆ
See tests/README.md