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
+28-4Lines changed: 28 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,10 +1,34 @@
1
1
# JavaScript Kuberhealthy Client
2
2
3
-
This directory contains an example external check for [Kuberhealthy](https://github.com/kuberhealthy/kuberhealthy) written in JavaScript. The script demonstrates how to report a successful run or a failure back to Kuberhealthy using environment variables provided to every checker pod.
3
+
This repository contains a small client library and example external check for [Kuberhealthy](https://github.com/kuberhealthy/kuberhealthy).
4
4
5
-
## Usage
5
+
The reusable client lives in the `client/` directory and is published as `@kuberhealthy/client`. It can be imported into your own Node.js applications to report check results back to Kuberhealthy. An example checker using the client is provided in `check.js`.
6
6
7
-
1.**Add your logic**: edit `check.js` and replace the placeholder section in `main` with your own check logic. Call `report(true, [])` when the check succeeds or `report(false, ["message"])` on failure.
7
+
## Client Library
8
+
9
+
The package is published to the GitHub Packages npm registry under `@kuberhealthy/client`.
10
+
11
+
Install it by configuring npm to use the GitHub Packages registry for the `@kuberhealthy` scope:
Node.js 18 or newer is required for the built in `fetch` API used by the client.
28
+
29
+
## Example Checker
30
+
31
+
1.**Add your logic**: edit `check.js` and replace the placeholder section in `main` with your own check logic. Call `client.report(true, [])` when the check succeeds or `client.report(false, ["message"])` on failure.
8
32
2.**Build the image**: run `make build IMAGE=my-registry/my-check:tag` to build a container image containing your check.
9
33
3.**Push the image**: `make push IMAGE=my-registry/my-check:tag`.
10
34
4.**Create a KuberhealthyCheck**: write a khcheck resource that references your image and apply it to clusters where Kuberhealthy runs.
@@ -14,7 +38,7 @@ The check relies on two environment variables set automatically by Kuberhealthy:
14
38
-`KH_REPORTING_URL` – the endpoint where status reports are posted.
15
39
-`KH_RUN_UUID` – the UUID for this check run. It must be sent back in the `kh-run-uuid` header.
0 commit comments