crate.operator.utils.formatting module¶
- crate.operator.utils.formatting.b64decode(s: str) str ¶
Wrapper to base 64 encode a string and return a string.
- crate.operator.utils.formatting.b64encode(s: str) str ¶
Wrapper to base 64 decode a string and return a string.
- crate.operator.utils.formatting.convert_to_bytes(value)¶
Converts disk size strings used in Kubernetes, e.g.
"256Gi"
or Bytes tobitmath.Byte
.
- crate.operator.utils.formatting.encode_decode_wrapper(fn, s)¶
Encode
s
to bytes, callfn
with that and decode the result again.The function uses UTF-8 for encoding and decoding.
- crate.operator.utils.formatting.format_bitmath(value)¶
Format a
bitmath.Byte
such that it is safe to use with Kubernetes.Under the hood, the format
{value}{unit}
is used, but without the trailingB
. Additionally, the “best” unit is picked. For example, passingbitmath.GiB(0.25)
would result in"256Mi"
.