2024-03-03 20:01:53 +01:00
|
|
|
{ lib
|
|
|
|
, python3
|
|
|
|
, fetchFromGitHub
|
|
|
|
, testers
|
|
|
|
, krr
|
|
|
|
}:
|
|
|
|
|
|
|
|
python3.pkgs.buildPythonPackage rec {
|
|
|
|
pname = "krr";
|
2024-03-05 13:22:12 +01:00
|
|
|
version = "1.7.1";
|
2024-03-03 20:01:53 +01:00
|
|
|
pyproject = true;
|
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "robusta-dev";
|
|
|
|
repo = "krr";
|
|
|
|
rev = "refs/tags/v${version}";
|
2024-03-05 13:22:12 +01:00
|
|
|
hash = "sha256-Bc1Ql3z/UmOXE2RJYC5/sE4a3MFdE06I3HwKY+SdSlk=";
|
2024-03-03 20:01:53 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
postPatch = ''
|
2024-03-07 13:36:24 +01:00
|
|
|
substituteInPlace robusta_krr/__init__.py \
|
|
|
|
--replace-warn '1.7.0-dev' '${version}'
|
|
|
|
|
2024-03-03 20:01:53 +01:00
|
|
|
substituteInPlace pyproject.toml \
|
2024-03-07 13:36:24 +01:00
|
|
|
--replace-warn '1.7.0-dev' '${version}' \
|
2024-03-03 20:01:53 +01:00
|
|
|
--replace-fail 'aiostream = "^0.4.5"' 'aiostream = "*"' \
|
|
|
|
--replace-fail 'kubernetes = "^26.1.0"' 'kubernetes = "*"' \
|
|
|
|
--replace-fail 'pydantic = "1.10.7"' 'pydantic = "*"' \
|
|
|
|
--replace-fail 'typer = { extras = ["all"], version = "^0.7.0" }' 'typer = { extras = ["all"], version = "*" }'
|
|
|
|
'';
|
|
|
|
|
|
|
|
propagatedBuildInputs = with python3.pkgs; [
|
|
|
|
aiostream
|
|
|
|
alive-progress
|
|
|
|
kubernetes
|
|
|
|
numpy
|
|
|
|
poetry-core
|
|
|
|
prometheus-api-client
|
|
|
|
prometrix
|
|
|
|
pydantic_1
|
|
|
|
slack-sdk
|
|
|
|
typer
|
|
|
|
] ++ typer.optional-dependencies.all;
|
|
|
|
|
|
|
|
nativeCheckInputs = with python3.pkgs; [
|
|
|
|
pytestCheckHook
|
|
|
|
];
|
|
|
|
|
|
|
|
pythonImportsCheck = [
|
|
|
|
"robusta_krr"
|
|
|
|
];
|
|
|
|
|
|
|
|
passthru.tests.version = testers.testVersion {
|
|
|
|
package = krr;
|
|
|
|
command = "krr version";
|
|
|
|
};
|
|
|
|
|
|
|
|
meta = with lib; {
|
|
|
|
description = "Prometheus-based Kubernetes resource recommendations";
|
|
|
|
longDescription = ''
|
|
|
|
Robusta KRR (Kubernetes Resource Recommender) is a CLI tool for optimizing
|
|
|
|
resource allocation in Kubernetes clusters. It gathers Pod usage data from
|
|
|
|
Prometheus and recommends requests and limits for CPU and memory. This
|
|
|
|
reduces costs and improves performance.
|
|
|
|
'';
|
|
|
|
homepage = "https://github.com/robusta-dev/krr";
|
|
|
|
changelog = "https://github.com/robusta-dev/krr/releases/tag/v${src.rev}";
|
|
|
|
license = licenses.mit;
|
|
|
|
maintainers = with lib.maintainers; [ azahi ];
|
|
|
|
mainProgram = "krr";
|
|
|
|
};
|
|
|
|
}
|