@nuskin/health-status-utils
v1.1.0
Published
Allow SREs to monitor K8s containerized app's health
Downloads
341
Keywords
Readme
Health Status Library
Purpose
This package provides a series of options for the SREs to monitor the health of our K8s apps:
Install
yarn add @nuskin/health-status-utils
Pre-requisites
- Install Node.js version 14.0.0
Install
yarn add @nuskin/health-status-utils
Project Structure
The folder structure of this app is explained below:
| Name | Description | --- | --- | __mocks__ | Contains jest mocks | __tests__ | Contains jest tests | src | Contains source code | .gitignore | List of files and directories for Git to ignore | jest.config.js | Configuration options for Jest | jest.util.js | Configuration options for Jest | .eslintrc | Configuration options for ES Lint | .prettierrc | Configuration options for prettier | package.json | Contains npm dependencies as well as build scripts | .prettierignore | List of files and directories for prettier to ignore | cx.config | File needed for common pipeline to pass | yarn.lock | Yarn state snapshot | .gitlab-ci.yml | CI pipeline configuration | application.yaml | Configuration file
Running tests using yarn Scripts
yarn test
ESLint
ESLint is a code linter that helps catch minor code quality and style issues.
ESLint rules
All rules are configured through .eslintrc
.
Running ESLint
To run ESLint you can call the ESLint task.
yarn lint // runs only ES lint
Usage
General
When deployed via a Kubernetes (k8s) container your app will also includes k8s probes for liveness and readiness.
If you initiate the healthchecks then once your container has spun up it'll automatically start performing liveness checks.
Once your app is up and running it is #YOUR JOB# to let the health check know that you are ready using reportReadiness(true)
Example 1:
initHealthCheckSystems(healthCheckOnSig, healthCheckOnShutdown, readinessCallback, livenessCallback)
reportReadiness(true)
reportReadiness(false, ['mockErrorReason'])