k8s v0.5.2 K8s.Resource.Utilization

Deserializers for CPU and Memory values

Link to this section Summary

Functions

Deserializes CPU quantity

Deserializes memory quantity

Link to this section Functions

Deserializes CPU quantity

Examples

Parses whole values

iex> K8s.Resource.Utilization.cpu("3")
3

Parses millicpu values

iex> K8s.Resource.Utilization.cpu("500m")
0.5

Parses decimal values

iex> K8s.Resource.Utilization.cpu("1.5")
1.5
Link to this function

memory(str)

memory(binary()) :: number()

Deserializes memory quantity

Examples

Parses whole values

iex> K8s.Resource.Utilization.memory("1000000")
1000000

Parses decimal values

iex> K8s.Resource.Utilization.memory("10.75")
10.75

Parses decimalSI values

iex> K8s.Resource.Utilization.memory("10M")
10000000

Parses binarySI suffixes

iex> K8s.Resource.Utilization.memory("50Mi")
52428800

Returns the numeric value when the suffix is unrecognized

iex> K8s.Resource.Utilization.memory("50Foo")
50