Skip to content

devops-ia/simple-krr-dashboard

Repository files navigation

simple-krr-dashboard

Note

This project is not affiliated with robusta-dev/krr.

Simple KRR dashboard for Kubernetes resource reporting, using robusta-dev/krr to gather data.

simple-dashboard-demo

Requirements

Installation

Data Collection

The dashboard uses data generated by krr using the following command:

krr simple --fileoutput report.table.csv --use-oomkill-data --formatter csv

Local Installation

  1. Clone the repository

  2. Create and activate a virtual environment:

    python -m venv .venv
    source .venv/bin/activate  # On Unix/macOS
    # or
    .venv\Scripts\activate  # On Windows
  3. Install dependencies:

    pipenv install

Docker Installation

  1. Build the Docker image:

    docker build -t simple-krr-dashboard .
  2. Run the container:

    docker run -v $(pwd)/reports:/reports -p 80:80 simple-krr-dashboard

The dashboard will be available at http://localhost:80

Usage

Local Usage

To run the dashboard:

pipenv run start

Or directly using Python (make sure you're in the project root directory):

PYTHONPATH=src python src/simple_krr_dashboard/main.py

Docker Usage

The Docker container exposes port 80 for the web interface. You can access the dashboard by opening your web browser and navigating to http://localhost:80

Development Commands

# Run tests
pipenv run test

# Run linter
pipenv run lint

# Format code
pipenv run format

# Type checking
pipenv run typecheck

Environment Variables

The following environment variables can be used to configure the application:

Variable Description Default Required
APP_NAME Name of the application "Simple KRR Dashboard" No
APP_VERSION Version of the application "1.0.0" No
KUBERNETES_CLUSTER_NAME Name of the Kubernetes cluster None No
KUBERNETES_DASHBOARD_CSV_PATH Path to the CSV file containing Kubernetes data "/reports/report.table.csv" No
LOG_LEVEL Logging level (DEBUG, INFO, WARNING, ERROR, CRITICAL) "INFO" No
LOG_FORMAT Format string for log messages "%(asctime)s - %(name)s - %(levelname)s - %(message)s" No

Testing

The project uses pytest for testing. To run the tests:

  1. Install test dependencies:

    pipenv install --dev
  2. Run the tests:

    pipenv run pytest
  3. Run tests with coverage report:

    pipenv run pytest --cov=simple_krr_dashboard tests/

Test Structure

The tests are organized in the following structure:

tests/
├── __init__.py
├── conftest.py           # Common test fixtures
├── test_app.py          # Application tests
├── test_config.py       # Configuration tests
├── test_dashboard.py    # Dashboard component tests
├── test_data.py         # Data processing tests
├── test_logging.py      # Logging tests
└── test_utils.py        # Utility function tests

Writing Tests

When adding new features, please include corresponding tests. The project follows these testing guidelines:

  • Use pytest fixtures for common setup
  • Mock external dependencies (e.g., file system, data processing)
  • Test both success and error cases
  • Include docstrings for test functions
  • Use meaningful test names that describe the behavior being tested

Contributing

Please read the CONTRIBUTING.md file for details on our code of conduct and the process for submitting pull requests.


Developed with ❤️ by @ialejandro and Cursor.com