Skip to main content

Function: divideK8sResources()

function divideK8sResources(
a: string,
b: string,
resourceType?: "cpu" | "memory"): number;

Defined in: lib/units.ts:105

Divides two Kubernetes resource quantities. Useful for computing resource field references with divisors.

Parameters​

ParameterTypeDefault valueDescription
astringundefinedThe dividend resource string (e.g., "1Gi", "500m")
bstringundefinedThe divisor resource string (e.g., "1Mi", "1")
resourceType"cpu" | "memory"'memory'The type of resource ('cpu' or 'memory'). Defaults to 'memory'.

Returns​

number

The result of dividing a by b