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:
  • body (V1Namespace) – Namespace object to create.

  • timeout (Timeout) – Timeout on operation.

  • replace (bool, default: False) – If True and a namespace of that name already exists, delete the existing namespace and then try again.

Raises:
Return type:

None

async delete(name, timeout, *, wait=False)#

Delete a namespace.

If the namespace does not exist, this is silently treated as success.

Parameters:
  • name (str) – Name of the namespace.

  • timeout (Timeout) – Timeout on operation.

  • wait (bool, default: False) – Whether to wait for the namespace to be deleted.

Raises:
Return type:

None

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:
async read(name, timeout)#

Read a namespace.

Parameters:
  • name (str) – Name of the namespace.

  • timeout (Timeout) – Timeout on operation.

Returns:

Namespace, or None if it does not exist.

Return type:

kubernetes_asyncio.client.models.V1Namespace or None

Raises:
async wait_for_deletion(name, timeout)#

Wait for a namespace deletion to complete.

Parameters:
  • name (str) – Name of the namespace.

  • timeout (Timeout) – How long to wait for deletion.

Raises:
Return type:

None