From 413629fce54e54c0f2565cd6fab78d1c9d38a1dc Mon Sep 17 00:00:00 2001 From: Pavel Zhukov <33721692+LeaveMyYard@users.noreply.github.com> Date: Sat, 13 May 2023 23:08:50 +0300 Subject: Add brew installation process --- README.md | 50 ++++++++++++++++++-------------------------------- 1 file changed, 18 insertions(+), 32 deletions(-) diff --git a/README.md b/README.md index cac4f65..f10fa8b 100644 --- a/README.md +++ b/README.md @@ -139,42 +139,25 @@ More features (like seeing graphs, based on which recommendations were made) com ### Installation - - 1. Make sure you have [Python 3.9](https://www.python.org/downloads/) (or greater) installed 2. Clone the repo: @@ -195,6 +178,9 @@ pip install -r requirements.txt python krr.py --help ``` +Notice that using source code requires you to run as a python script, when installing with brew allows to run `krr`. +All above examples show running command as `krr ...`, replace it with `python krr.py ...` if you are using a manual installation. + To use krr with [Google Cloud Managed Service for Prometheus](https://cloud.google.com/stackdriver/docs/managed-prometheus) some [additional configuration](./docs/google-cloud-managed-service-for-prometheus.md) is necessary.

(back to top)

@@ -206,43 +192,43 @@ To use krr with [Google Cloud Managed Service for Prometheus](https://cloud.goog Straightforward usage, to run the simple strategy: ```sh -python krr.py simple +krr simple ``` If you want only specific namespaces (default and ingress-nginx): ```sh -python krr.py simple -n default -n ingress-nginx +krr simple -n default -n ingress-nginx ``` By default krr will run in the current context. If you want to run it in a different context: ```sh -python krr.py simple -c my-cluster-1 -c my-cluster-2 +krr simple -c my-cluster-1 -c my-cluster-2 ``` If you want to get the output in JSON format (--logtostderr is required so no logs go to the result file): ```sh -python krr.py simple --logtostderr -f json > result.json +krr simple --logtostderr -f json > result.json ``` If you want to get the output in YAML format: ```sh -python krr.py simple --logtostderr -f yaml > result.yaml +krr simple --logtostderr -f yaml > result.yaml ``` If you want to see additional debug logs: ```sh -python krr.py simple -v +krr simple -v ``` More specific information on Strategy Settings can be found using ```sh -python krr.py simple --help +krr simple --help ```

(back to top)

@@ -279,7 +265,7 @@ kubectl port-forward pod/kube-prometheus-st-prometheus-0 9090 Then, open another terminal and run krr in it, giving an explicit prometheus url: ```sh -python krr.py simple -p http://127.0.0.1:9090 +krr simple -p http://127.0.0.1:9090 ```

(back to top)

-- cgit v1.2.3 From 222eac8c31e3f90fef482b971f8c67bc568a332f Mon Sep 17 00:00:00 2001 From: Pavel Zhukov <33721692+LeaveMyYard@users.noreply.github.com> Date: Sat, 13 May 2023 23:30:27 +0300 Subject: Update README.md --- README.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/README.md b/README.md index f10fa8b..386c04a 100644 --- a/README.md +++ b/README.md @@ -156,6 +156,11 @@ brew install krr krr --help ``` +#### Installing on Windows: + +We will use chocolatey for easier installing on Windows, but currently it is not yet supported. +If you want to still run on Windows, you can do that by installing using brew (see above) on [WSL2](https://docs.brew.sh/Homebrew-on-Linux), or installing manually: + #### Manual 1. Make sure you have [Python 3.9](https://www.python.org/downloads/) (or greater) installed -- cgit v1.2.3 From 4b1b38972ce52276a30bed6654f710adfe37eda8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9F=D0=B0=D0=B2=D0=B5=D0=BB=20=D0=96=D1=83=D0=BA=D0=BE?= =?UTF-8?q?=D0=B2?= <33721692+LeaveMyYard@users.noreply.github.com> Date: Mon, 15 May 2023 10:00:18 +0300 Subject: Process no config found --- robusta_krr/core/models/config.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/robusta_krr/core/models/config.py b/robusta_krr/core/models/config.py index fb910a6..75a5403 100644 --- a/robusta_krr/core/models/config.py +++ b/robusta_krr/core/models/config.py @@ -1,5 +1,6 @@ from typing import Any, Literal, Optional, Union +import sys import pydantic as pd from kubernetes import config from kubernetes.config.config_exception import ConfigException @@ -9,10 +10,16 @@ from robusta_krr.core.abstract.strategies import AnyStrategy, BaseStrategy try: config.load_incluster_config() - IN_CLUSTER = True except ConfigException: - config.load_kube_config() + try: + config.load_kube_config() + except ConfigException: + print("[CRITICAL] Could not load kubernetes configuration. Do you have kubeconfig set up?") + sys.exit(1) + IN_CLUSTER = False +else: + IN_CLUSTER = True class Config(pd.BaseSettings): -- cgit v1.2.3