Backend - Kubernetes

class conu.backend.k8s.backend.K8sBackend(api_key=None, logging_level=20, logging_kwargs=None, cleanup=None)

Bases: conu.apidefs.backend.Backend

ContainerClass

alias of conu.apidefs.container.Container

ImageClass

alias of conu.apidefs.image.Image

__init__(api_key=None, logging_level=20, logging_kwargs=None, cleanup=None)

This method serves as a configuration interface for conu.

Parameters:
  • api_key – str, Bearer API token
  • logging_level – int, control logger verbosity: see logging.{DEBUG,INFO,ERROR}
  • logging_kwargs – dict, additional keyword arguments for logger set up, for more info see docstring of set_logging function
  • cleanup – list, list of k8s cleanup policy values, examples: - [CleanupPolicy.EVERYTHING] - [CleanupPolicy.PODS, CleanupPolicy.SERVICES] - [CleanupPolicy.NOTHING]
cleanup_containers()

Remove containers associated with this backend instance

Returns:None
cleanup_deployments()

Delete all deployments created in namespaces associated with this backend :return: None

cleanup_images()

Remove images associated with this backend instance

Returns:None
cleanup_namespaces()

Delete all namespaces created by this backend :return: None

cleanup_pods()

Delete all pods created in namespaces associated with this backend :return: None

cleanup_services()

Delete all services created in namespaces associated with this backend :return: None

cleanup_volumes()

Remove volumes associated with this backend instance

Returns:None
create_namespace()

Create namespace with random name :return: name of new created namespace

delete_namespace(name)

Delete namespace with specific name :param name: str, namespace to delete :return: None

list_containers()

list all available containers for this backend

Returns:collection of instances of conu.apidefs.container.Container
list_deployments()

List all available deployments.

Returns:collection of instances of conu.backend.k8s.deployment.Deployment
list_images()

list all available images for this backend

Returns:collection of instances of conu.apidefs.image.Image
list_pods()

List all available pods.

Returns:collection of instances of conu.backend.k8s.pod.Pod
list_services()

List all available services.

Returns:collection of instances of conu.backend.k8s.service.Service
class conu.backend.k8s.backend.K8sCleanupPolicy

This Enum defines the policy for cleanup.

  • NOTHING - clean nothing
  • EVERYTHING - delete just objects in all namespaces
    associated with this backend - (pods, service, deployments)
  • NAMESPACES - delete all namespaces associated with this backend and
    objects in these namespaces (pods, service, deployments)
  • PODS - delete all pods in namespaces associated with this backend
  • SERVICES - delete all services in namespaces associated with this backend
  • DEPLOYMENTS - delete all deployments in namespaces associated with this backend