Skip to content

Commit

Permalink
Merge branch 'main' into fix/victoria-metrics
Browse files Browse the repository at this point in the history
  • Loading branch information
LeaveMyYard authored May 29, 2023
2 parents f85331c + a562d52 commit bf8d63d
Show file tree
Hide file tree
Showing 25 changed files with 388 additions and 120 deletions.
1 change: 0 additions & 1 deletion .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ __pycache__
.gitignore
Dockerfile
*.md
*.txt
.vscode

# Exclude logs and cache
Expand Down
16 changes: 3 additions & 13 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,22 +6,12 @@ WORKDIR /app

# Install system dependencies required for Poetry
RUN apt-get update && \
apt-get install --no-install-recommends -y curl && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*
dpkg --add-architecture arm64

# Install Poetry
RUN curl -sSL https://install.python-poetry.org | python -

# Add Poetry to the PATH
ENV PATH="/root/.local/bin:${PATH}"

# Copy the pyproject.toml files
COPY pyproject.toml ./
COPY ./requirements.txt requirements.txt

# Install the project dependencies
RUN poetry config virtualenvs.create false \
&& poetry install --no-dev --no-interaction --no-ansi --no-root
RUN pip install -r requirements.txt

# Copy the rest of the application code
COPY . .
Expand Down
35 changes: 35 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,40 @@ More features (like seeing graphs, based on which recommendations were made) com
<p align="right">(<a href="#readme-top">back to top</a>)</p>
<!-- ADVANCED USAGE EXAMPLES -->
### Slack integration
Put cost savings on autopilot. Get notified in Slack about recommendations above X%. Send a weekly global report, or one report per team.
![Slack Screen Shot][slack-screenshot]
#### Prerequisites
* A Slack workspace
#### Setup
1. [Install Robusta with Helm to your cluster and configure slack](https://docs.robusta.dev/master/installation.html)
2. Create your KRR slack playbook by adding the following to `generated_values.yaml`:
```
customPlaybooks:
# Runs a weekly krr scan on the namespace devs-namespace and sends it to the configured slack channel
customPlaybooks:
- triggers:
- on_schedule:
fixed_delay_repeat:
repeat: 1 # number of times to run or -1 to run forever
seconds_delay: 604800 # 1 week
actions:
- krr_scan:
args: "--namespace devs-namespace" ## KRR args here
sinks:
- "main_slack_sink" # slack sink you want to send the report to here
```
3. Do a Helm upgrade to apply the new values: `helm upgrade robusta robusta/robusta --values=generated_values.yaml --set clusterName=<YOUR_CLUSTER_NAME>`
<p align="right">(<a href="#readme-top">back to top</a>)</p>
<!-- GETTING STARTED -->
## Getting Started
Expand Down Expand Up @@ -393,4 +427,5 @@ Project Link: [https://github.com/robusta-dev/krr](https://github.com/robusta-de
[linkedin-shield]: https://img.shields.io/badge/-LinkedIn-black.svg?style=for-the-badge&logo=linkedin&colorB=555
[linkedin-url]: https://linkedin.com/in/othneildrew
[product-screenshot]: images/screenshot.jpeg
[slack-screenshot]: images/krr_slack_example.png
[ui-screenshot]: images/ui_screenshot.jpeg
20 changes: 20 additions & 0 deletions build_linux.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Remove old build
rm -rf build
rm -rf dist

# MacOS Build first

# Active venv
# python -m pip install -r requirements.txt
pip install pyinstaller
apt-get install binutils

# source .venv/bin/activate

# Build
pyinstaller krr.py
cd dist
# zip -r "krr-linux-v1.1.0.zip" krr

# Deactivate venv
# deactivate
13 changes: 13 additions & 0 deletions build_local.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Remove old build
rm -rf build
rm -rf dist

# Active venv
source .venv/bin/activate
pip install -r requirements.txt
pip install pyinstaller

# Build
pyinstaller krr.py
cd dist
zip -r "krr-macos-v1.1.0.zip" krr
6 changes: 6 additions & 0 deletions build_release.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
docker buildx build \
--build-arg BUILDKIT_INLINE_CACHE=1 \
--platform linux/arm64,linux/amd64 \
--tag us-central1-docker.pkg.dev/genuine-flight-317411/devel/krr:${TAG} \
--push \
.
Binary file added images/krr_slack_example.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
131 changes: 128 additions & 3 deletions poetry.lock

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

3 changes: 2 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "robusta-krr"
version = "1.0.0"
version = "1.1.1"
description = "Robusta's Resource Recommendation engine for Kubernetes"
authors = ["Павел Жуков <33721692+LeaveMyYard@users.noreply.github.com>"]
license = "MIT"
Expand Down Expand Up @@ -29,6 +29,7 @@ pydantic = "1.10.7"
kubernetes = "^26.1.0"
prometheus-api-client = "^0.5.3"
numpy = "^1.24.2"
alive-progress = "^3.1.2"


[tool.poetry.group.dev.dependencies]
Expand Down
5 changes: 5 additions & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
about-time==4.2.1 ; python_version >= "3.9" and python_version < "3.12"
alive-progress==3.1.2 ; python_version >= "3.9" and python_version < "3.12"
cachetools==5.3.0 ; python_version >= "3.9" and python_version < "3.12"
certifi==2022.12.7 ; python_version >= "3.9" and python_version < "3.12"
charset-normalizer==3.0.1 ; python_version >= "3.9" and python_version < "3.12"
Expand All @@ -9,8 +11,10 @@ cycler==0.11.0 ; python_version >= "3.9" and python_version < "3.12"
dateparser==1.1.7 ; python_version >= "3.9" and python_version < "3.12"
fonttools==4.39.0 ; python_version >= "3.9" and python_version < "3.12"
google-auth==2.16.2 ; python_version >= "3.9" and python_version < "3.12"
grapheme==0.6.0 ; python_version >= "3.9" and python_version < "3.12"
httmock==1.4.0 ; python_version >= "3.9" and python_version < "3.12"
idna==3.4 ; python_version >= "3.9" and python_version < "3.12"
importlib-resources==5.12.0 ; python_version >= "3.9" and python_version < "3.10"
kiwisolver==1.4.4 ; python_version >= "3.9" and python_version < "3.12"
kubernetes==26.1.0 ; python_version >= "3.9" and python_version < "3.12"
matplotlib==3.7.1 ; python_version >= "3.9" and python_version < "3.12"
Expand Down Expand Up @@ -43,3 +47,4 @@ tzdata==2022.7 ; python_version >= "3.9" and python_version < "3.12"
tzlocal==4.2 ; python_version >= "3.9" and python_version < "3.12"
urllib3==1.26.14 ; python_version >= "3.9" and python_version < "3.12"
websocket-client==1.5.1 ; python_version >= "3.9" and python_version < "3.12"
zipp==3.15.0 ; python_version >= "3.9" and python_version < "3.10"
2 changes: 1 addition & 1 deletion robusta_krr/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from .main import run

__version__ = "1.0.0"
__version__ = "1.1.1"
__all__ = ["run", "__version__"]
Loading

0 comments on commit bf8d63d

Please sign in to comment.