The kubragen2.kutil module

kubragen2.kutil.secret_data_encode(data: Union[bytes, str]) → str

Encode bytes or str Kuberentes secret. The encoding is done using base64, using the utf-8 charset.

Parameters

data – Data to encode

Returns

encoded secret

Raises

KG2Exception – on error

kubragen2.kutil.secret_data_encode_bytes(data: bytes) → bytes

Encode bytes secret using the current provider. The encoding is done using base64, and raw bytes are returned

Parameters

data – Data to encode

Returns

encoded secret

Raises

KG2Exception – on error

kubragen2.kutil.unit_to_bytes(value: str) → int

Convert Kubernetes units to byte.

Parameters

value – a Kubernetes unit.

Returns

the byte equivalent of the unit.