$ show robusta-dev/krr
Robusta KRR is a CLI tool for optimizing Kubernetes resource allocation by recommending CPU and memory requests/limits based on Prometheus metrics. It features a modular architecture with pluggable strategies for recommendation algorithms, multiple output formats, and integrations with various Prometheus-compatible systems. The project includes an enforcer component (mutating webhook) for automatic application of recommendations. The codebase demonstrates good engineering practices with clear separation of concerns, proper error handling, and extensible design patterns.
The LLM identified 3 files worth highlighting for reuse:
Self-contained utility for parsing and formatting Kubernetes resource units (millicores, Mi, Gi, etc.). Handles both binary (Ki, Mi) and decimal (k, M) unit systems correctly. Zero dependencies beyond standard library, making it highly reusable in any project dealing with Kubernetes resources.
Base class for Prometheus metric loaders that implements robust querying with retry logic, batching of large queries, and filtering logic. Demonstrates skill in handling Prometheus API interactions with proper error handling and performance optimizations. The abstraction allows easy extension for different metric types while maintaining consistent behavior.
Handles generation of JSON patches for updating Kubernetes container resources. Includes validation logic to ensure patches are valid (requests > 0, limits >= requests). Demonstrates skill in strategic patch generation that only updates changed values, minimizing unnecessary API calls. Self-contained with clear separation of concerns.