Skip to main content

PodTemplate

Custom PodTemplate specification for a Task.

Attributes

AttributeTypeDescription
pod_specV1PodSpec = NoneThe Kubernetes V1PodSpec object defining the pod's execution environment, including containers, volumes, and affinity rules.
primary_container_namestr = _PRIMARY_CONTAINER_DEFAULT_NAMEThe name of the main container within the pod spec that executes the task logic.
labelsDict[str, str] = NoneA dictionary of key-value pairs used to organize and categorize the pod within the Kubernetes metadata.
annotationsDict[str, str] = NoneA dictionary of non-identifying metadata used to attach arbitrary information to the pod for use by tools and libraries.

Constructor

Signature

def PodTemplate(
pod_spec: Optional[V1PodSpec] = None,
primary_container_name: str = _PRIMARY_CONTAINER_DEFAULT_NAME,
labels: Optional[Dict[str, str]] = None,
annotations: Optional[Dict[str, str]] = None
) - > null

Parameters

NameTypeDescription
pod_specOptional[V1PodSpec] = NoneThe Kubernetes pod specification.
primary_container_namestr = _PRIMARY_CONTAINER_DEFAULT_NAMEThe name of the primary container within the pod.
labelsOptional[Dict[str, str]] = NoneA dictionary of labels to apply to the pod.
annotationsOptional[Dict[str, str]] = NoneA dictionary of annotations to apply to the pod.

Methods


to_k8s_pod()

@classmethod
def to_k8s_pod() - > K8sPod

Converts the PodTemplate instance into a Kubernetes Pod representation used by Flyte. This method serializes the pod specification and metadata into a format compatible with the Flyte backend.

Returns

TypeDescription
K8sPodA K8sPod object containing the serialized pod specification, metadata labels, annotations, and the designated primary container name.