Skip to content
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
37 changes: 37 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -352,6 +352,43 @@ python krr.py simple --selector 'app.kubernetes.io/instance in (robusta, ingress
```
</details>

<details>
<summary>Group jobs by specific labels</summary>

Group jobs that have specific labels into GroupedJob objects for consolidated resource recommendations. This is useful for batch jobs, data processing pipelines, or any workload where you want to analyze resource usage across multiple related jobs.

```sh
krr simple --job-grouping-labels app,team
```

This will:
- Group jobs that have either `app` or `team` labels (or both)
- Create GroupedJob objects with names like `app=frontend`, `team=backend`, etc.
- Provide resource recommendations for the entire group instead of individual jobs
- Jobs with the specified labels will be excluded from regular Job listing

You can specify multiple labels separated by commas:

```sh
krr simple --job-grouping-labels app,team,environment
```

Each job will be grouped by each label it has, so a job with `app=api,team=backend` will appear in both `app=api` and `team=backend` groups.

### Limiting how many jobs are included per group

Use `--job-grouping-limit <N>` to cap how many jobs are included **per group** (useful when there are many historical jobs).

```sh
krr simple --job-grouping-labels app,team --job-grouping-limit 3
```

* Each label group will include at most **N** jobs (e.g., the first 3 returned by the API).
* Other matching jobs beyond the limit are ignored for that group.
* If not specified, the default limit is **500** jobs per group.

</details>

<details>
<summary>Override the kubectl context</summary>

Expand Down
2 changes: 2 additions & 0 deletions conftest.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Make sure pytest loads the asyncio plugin so `async def` tests run.
pytest_plugins = ("pytest_asyncio",)
162 changes: 156 additions & 6 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 4 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ kubernetes = "^26.1.0"
prometheus-api-client = "0.5.3"
numpy = ">=1.26.4,<1.27.0"
alive-progress = "^3.1.2"
prometrix = "^0.2.7"
prometrix = "0.2.5"
slack-sdk = "^3.21.3"
pandas = "2.2.2"
requests = ">2.32.4"
Expand All @@ -41,6 +41,7 @@ urllib3 = "^1.26.20"
setuptools = "^80.9.0"
zipp = "^3.19.1"
tenacity = "^9.0.0"
pyinstaller = "^5.9.0"



Expand All @@ -53,6 +54,8 @@ types-pyyaml = "^6.0.12.8"
types-cachetools = "^5.3.0.4"
types-requests = "^2.28.11.15"
pytest = "^7.2.2"
pytest-asyncio = ">=0.21,<0.24"
pyinstaller = "^5.9.0"

[build-system]
requires = ["poetry-core"]
Expand Down
3 changes: 2 additions & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ packaging==24.0 ; python_version >= "3.9" and python_full_version < "3.13"
pandas==2.2.2 ; python_version >= "3.9" and python_full_version < "3.13"
pillow==10.3.0 ; python_version >= "3.9" and python_full_version < "3.13"
prometheus-api-client==0.5.3 ; python_version >= "3.9" and python_full_version < "3.13"
prometrix==0.2.7 ; python_version >= "3.9" and python_full_version < "3.13"
prometrix==0.2.5 ; python_version >= "3.9" and python_full_version < "3.13"
pyasn1-modules==0.3.0 ; python_version >= "3.9" and python_full_version < "3.13"
pyasn1==0.5.1 ; python_version >= "3.9" and python_full_version < "3.13"
pydantic==1.10.15 ; python_version >= "3.9" and python_full_version < "3.13"
Expand All @@ -54,3 +54,4 @@ tzlocal==5.2 ; python_version >= "3.9" and python_full_version < "3.13"
urllib3==1.26.20 ; python_version >= "3.9" and python_full_version < "3.13"
websocket-client==1.7.0 ; python_version >= "3.9" and python_full_version < "3.13"
zipp==3.20.2 ; python_version >= "3.9" and python_full_version < "3.13"
pytest-asyncio==0.23.7 ; python_version >= "3.9" and python_full_version < "3.13"
Loading