An open API service indexing awesome lists of open source software.

https://github.com/zvdy/kube-classify


https://github.com/zvdy/kube-classify

Last synced: 5 months ago
JSON representation

Awesome Lists containing this project

README

          

# Kubectl Infra Classifier

Classifies if a kubectl command modifies infrastructure (yes/no).

## Features
- Detects if a kubectl command is modifying ("yes") or non-modifying ("no")
- Handles real-world, piped, and complex kubectl command scenarios
- Designed for extensibility and production use

## Installation

```sh
pip install .
# or with build isolation
pip install --use-pep517 .
```

## Usage

### As a Python package
```python
from kube_classify.utils import load_model
model = load_model("models/kubectl_classifier.joblib")
result = model.predict(["kubectl apply -f deployment.yaml"])
print("yes" if result[0] == 1 else "no")
```

### Training
Train a new model with your dataset:
```sh
make train
```

## Makefile Commands
- `make install` — Install the package in editable mode for development
- `make train` — Train the model (ensures correct PYTHONPATH)
- `make test` — Run the test suite
- `make lint` — Lint the codebase with flake8
- `make clean` — Remove model artifacts and cache files

## Project Structure
- `src/kube_classify/` — Main package code
- `data/` — Training data
- `models/` — Saved models
- `tests/` — Test suite

## License
MIT