Kubernetes Pod¶
- class conu.backend.k8s.pod.Pod(namespace, name=None, spec=None, from_template=None)¶
- __init__(namespace, name=None, spec=None, from_template=None)¶
Utility functions for kubernetes pods.
- Parameters:
namespace – str, namespace in which is pod created
name – name of pod
spec – pod spec
https://github.com/kubernetes-client/python/blob/master/kubernetes/docs/V1PodSpec.md :param from_template: str, pod template, example:
- static create(image_data)¶
- Parameters:
image_data – ImageMetadata
- Returns:
V1Pod, https://github.com/kubernetes-client/python/blob/master/kubernetes/docs/V1Pod.md
- delete()¶
delete pod from the Kubernetes cluster :return: None
- get_conditions()¶
get conditions through which the pod has passed :return: list of PodCondition enum or empty list
- get_ip()¶
get IP address of Pod :return: str, IP address or empty string if is not allocated yet
- get_logs()¶
print logs from pod :return: str or None
- get_phase()¶
get phase of the pod :return: PodPhase enum
- get_status()¶
get status of the Pod :return: V1PodStatus, https://github.com/kubernetes-client/python/blob/master/kubernetes/docs/V1PodStatus.md
- is_ready()¶
Check if pod is in READY condition :return: bool
- wait(timeout=15)¶
block until pod is not ready, raises an exc ProbeTimeout if timeout is reached :param timeout: int or float (seconds), time to wait for pod to run :return: None
- class conu.backend.k8s.pod.PodPhase(*values)¶
https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle/#pod-phase Additional values in conu: TERMINATING - phase right after delete() method is called on pod
- classmethod get_from_string(string_phase)¶
Convert string value obtained from k8s API to PodPhase enum value :param string_phase: str, phase value from Kubernetes API :return: PodPhase
- class conu.backend.k8s.pod.PodCondition(*values)¶
https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle/#pod-conditions
- classmethod get_from_string(string_condition)¶
Convert string value obtained from k8s API to PodCondition enum value :param string_condition: str, condition value from Kubernetes API :return: PodCondition