0.2.2 • Published 4 months ago

k8s-resource-parser v0.2.2

Weekly downloads
-
License
MIT
Repository
github
Last release
4 months ago

k8s-resource-parser (node)

Parses the strings used by Kubernetes (K8s) to represent memory and cpu requests and limits.

Only use when you expect correct strings (e.g. coming directly from the K8s API), as the parser isn't designed to handle maliciously-crafted inputs.

Example:

const { parseQuantity } = require('k8s-resource-parser');

parseQuantity("300m"); // Returns 0.3
parseQuantity("2K"); // Returns 2000
parseQuantity("2Ki"); // Returns 2048

Note that kubernetes doesn't represent these quantities as floats internally, so there may be slight discrepancies in the parse results given by this package and the results used in Kubernetes (thanks to floating point imprecision).

0.2.2

4 months ago

0.2.1

2 years ago

0.2.0

2 years ago

0.1.0

2 years ago