You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+25-10Lines changed: 25 additions & 10 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,18 +1,34 @@
1
1
# Python Kuberhealthy Client
2
2
3
-
This directory contains a minimal Python application that demonstrates how to
4
-
report status back to [Kuberhealthy](https://github.com/kuberhealthy/kuberhealthy).
5
-
The example loads the `KH_REPORTING_URL` and `KH_RUN_UUID` environment variables
6
-
provided to checker pods and includes commented calls to `report_ok` and
7
-
`report_error`.
3
+
This repository provides a small Python library for reporting check results back to [Kuberhealthy](https://github.com/kuberhealthy/kuberhealthy). It also includes a runnable example program and container configuration.
4
+
5
+
## Installing
6
+
7
+
Install the client into your own project:
8
+
9
+
```bash
10
+
pip install kuberhealthy-client
11
+
```
12
+
13
+
The library exposes two helpers:
14
+
15
+
```python
16
+
from kuberhealthy_client import report_ok, report_error
17
+
18
+
# Environment variables KH_REPORTING_URL and KH_RUN_UUID are read automatically.
19
+
report_ok()
20
+
report_error("something went wrong")
21
+
```
22
+
23
+
Both functions accept optional `url` and `run_uuid` keyword arguments if you prefer to supply values directly.
8
24
9
25
## Running the example
10
26
11
27
Set the `KH_REPORTING_URL` and `KH_RUN_UUID` environment variables, add your
12
-
check logic to `client.py`, and then run:
28
+
check logic to `example/client.py`, and then run:
13
29
14
30
```bash
15
-
python3 client.py
31
+
python3 example/client.py
16
32
```
17
33
18
34
Within the `main` function, uncomment either `report_ok()` or
@@ -30,9 +46,8 @@ make push IMG=myrepo/example-check:latest
30
46
31
47
## Using in your own checks
32
48
33
-
1. Add your check logic to `client.py` by replacing the placeholder in `main`.
34
-
Call `report_ok()` when the check succeeds or `report_error("message")`
35
-
when it fails.
49
+
1. Add your check logic to `example/client.py` or your own script. Call `report_ok()`
50
+
when the check succeeds or `report_error("message")` when it fails.
36
51
2. Build and push your image as shown above.
37
52
3. Create a `KuberhealthyCheck` resource pointing at your image and apply it to any
0 commit comments