NamespaceStorage¶
- class controller.storage.kubernetes.namespace.NamespaceStorage(api_client, logger)¶
Bases:
object
Storage layer for
Namespace
objects.- Parameters:
api_client (
ApiClient
) – Kubernetes API client.logger (
BoundLogger
) – Logger to use.
Methods Summary
create
(body, timeout, *[, replace])Create a new namespace.
delete
(name, timeout, *[, wait])Delete a namespace.
list
(timeout)List all namespaces.
read
(name, timeout)Read a namespace.
wait_for_deletion
(name, timeout)Wait for a namespace deletion to complete.
Methods Documentation
- async create(body, timeout, *, replace=False)¶
Create a new namespace.
- Parameters:
- Raises:
ControllerTimeoutError – Raised if the timeout expired waiting for deletion.
KubernetesError – Raised for exceptions from the Kubernetes API server.
TimeoutError – Raised if the timeout expired.
- Return type:
- async delete(name, timeout, *, wait=False)¶
Delete a namespace.
If the namespace does not exist, this is silently treated as success.
- Parameters:
- Raises:
ControllerTimeoutError – Raised if the timeout expired.
KubernetesError – Raised for exceptions from the Kubernetes API server.
- Return type:
- async list(timeout)¶
List all namespaces.
- Parameters:
timeout (
Timeout
) – Timeout on operation.- Returns:
List of namespaces.
- Return type:
list of kubernetes_asyncio.client.models.V1Namespace
- Raises:
KubernetesError – Raised for exceptions from the Kubernetes API server.
TimeoutError – Raised if the timeout expired.
- async read(name, timeout)¶
Read a namespace.
- Parameters:
- Returns:
Namespace, or
None
if it does not exist.- Return type:
kubernetes_asyncio.client.models.V1Namespace or None
- Raises:
KubernetesError – Raised for exceptions from the Kubernetes API server.
TimeoutError – Raised if the timeout expired.
- async wait_for_deletion(name, timeout)¶
Wait for a namespace deletion to complete.
- Parameters:
- Raises:
ControllerTimeoutError – Raised if the timeout expired.
KubernetesError – Raised for exceptions from the Kubernetes API server.
- Return type: