kubernetes-probes
Advanced tools
Comparing version 0.1.1 to 0.1.2
{ | ||
"name": "kubernetes-probes", | ||
"version": "0.1.1", | ||
"version": "0.1.2", | ||
"description": "Listener for health probes from kubernetes.", | ||
@@ -5,0 +5,0 @@ "private": false, |
# kubernetes-probes | ||
Library for an express listener on specified port to expose an http probe endpoint that kubelet can use to check container status. | ||
Both readiness and liveness probes are supported. | ||
This library supports a model whereby an app could have several asynchronous aspects that define readiness or liveness. | ||
You define one or more functions for each aspect of readiness or liveness. | ||
When probed (readiness or liveness), kubernetes-probes calls the appropriate one or more defined functions. | ||
Use of this library infers your app is implementing both (all) probes. | ||
If kubernetes-probes gets a probe and there are no functions defined for that type of probe, the response will be negative, i.e., a status code of 200. | ||
This will indicate to kubernetes that the app is not ready/lively. | ||
## Usage | ||
In this examplet here is one liveness function and two readiness functions. | ||
```javascript | ||
var k8sProbes = require('kubernetes-probes'); | ||
k8sProbes.addReadinessFunction(alive); | ||
k8sProbes.addLivenessFunction(ready); | ||
k8sProbes.addReadinessFunction(alive, "ready 1"); | ||
k8sProbes.addReadinessFunction(alive, "ready 2"); | ||
k8sProbes.listen(80); | ||
// | ||
// Readiness function | ||
var ready = function(cb) { | ||
cb(true, "I am ready."); | ||
}; | ||
// | ||
// Liveness function | ||
@@ -21,2 +26,12 @@ var alive = function(cb) { | ||
}; | ||
// | ||
// Readiness function #1 | ||
var ready1 = function(cb) { | ||
cb(true, "I am ready."); | ||
}; | ||
// | ||
// Readiness function #2 | ||
var ready2 = function(cb) { | ||
cb(true, "I am ready."); | ||
}; | ||
``` | ||
@@ -26,2 +41,3 @@ | ||
* Express | ||
* Async | ||
@@ -28,0 +44,0 @@ ## API |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Native code
Supply chain riskContains native code (e.g., compiled binaries or shared libraries). Including native code can obscure malicious behavior.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
55316
12
78
3