Kubernetes Deployment

class conu.backend.k8s.deployment.Deployment(name=None, selector=None, labels=None, image_metadata=None, namespace='default', create_in_cluster=False, from_template=None)
__init__(name=None, selector=None, labels=None, image_metadata=None, namespace='default', create_in_cluster=False, from_template=None)

Utility functions for kubernetes deployments.

Parameters:
  • name – str, name of the deployment
  • selector – Label selector for pods. Existing ReplicaSets whose pods are selected by this will be the ones affected by this deployment. It must match the pod template’s labels
  • labels – dict, dict of labels
  • image_metadata – ImageMetadata
  • namespace – str, name of the namespace
  • create_in_cluster – bool, if True deployment is created in Kubernetes cluster
  • from_template – str, deployment template, example: - https://kubernetes.io/docs/concepts/workloads/controllers/deployment/
all_pods_ready()

Check if number of replicas with same selector is equals to number of ready replicas :return: bool

create_in_cluster()

call Kubernetes API and create this Deployment in cluster, raise ConuException if the API call fails :return: None

delete()

delete Deployment from the Kubernetes cluster :return: None

get_status()

get status of the Deployment :return: V1DeploymentStatus, https://git.io/vhKE3

wait(timeout=15)

block until all replicas are not ready, raises an exc ProbeTimeout if timeout is reached :param timeout: int or float (seconds), time to wait for pods to run :return: None