class_docstr: Responsible for launching a container executor on Kubernetes.
class_docstr_tok: ["Responsible","for","launching","a","container","executor","on","Kubernetes","."]
docstr: Build a pod spec.
  
  The function builds a pod spec by patching executor container spec into
  the pod spec from component config.
  
  Args:
    pod_name: The name of the pod.
    container_spec: The resolved executor container spec.
  
  Returns:
    The pod manifest in dictionary format.
docstr_tok: ["Build","a","pod","spec",".","The","function","builds","a","pod","spec","by","patching","executor","container","spec","into","the","pod","spec","from","component","config",".","Args",":","pod_name",":","The","name","of","the","pod",".","container_spec",":","The","resolved","executor","container","spec",".","Returns",":","The","pod","manifest","in","dictionary","format","."]
code: def _build_pod_manifest(
      self,
      pod_name: str,
      container_spec: executor_spec.ExecutorContainerSpec,
  ) -> Dict[str, Any]:
      """Build a pod spec.
  
      The function builds a pod spec by patching executor container spec into
      the pod spec from component config.
  
      Args:
        pod_name: The name of the pod.
        container_spec: The resolved executor container spec.
  
      Returns:
        The pod manifest in dictionary format.
      """
      if self._component_config:
          kubernetes_config = cast(
              kubernetes_component_config.KubernetesComponentConfig,
              self._component_config,
          )
          pod_manifest = container_common.to_swagger_dict(
              kubernetes_config.pod
          )
      else:
          pod_manifest = {}
  
      pod_manifest.update(
          {
              "apiVersion": "v1",
              "kind": "Pod",
          }
      )
      # TODO(hongyes): figure out a better way to figure out type hints for nested
      # dict.
      metadata = pod_manifest.setdefault(
          "metadata", {}
      )  # type: Dict[str, Any]  # pytype: disable=annotation-type-mismatch
      metadata.update({"name": pod_name})
      spec = pod_manifest.setdefault(
          "spec", {}
      )  # type: Dict[str, Any]  # pytype: disable=annotation-type-mismatch
      spec.update({"restartPolicy": "Never"})
      containers = spec.setdefault(
          "containers", []
      )  # type: List[Dict[str, Any]]
      container = None  # type: Optional[Dict[str, Any]]
      for c in containers:
          if c["name"] == kube_utils.ARGO_MAIN_CONTAINER_NAME:
              container = c
              break
      if not container:
          container = {"name": kube_utils.ARGO_MAIN_CONTAINER_NAME}
          containers.append(container)
      container.update(
          {
              "image": container_spec.image,
              "command": container_spec.command,
              "args": container_spec.args,
          }
      )
      return pod_manifest
  
file_path: tfx/tfx/orchestration/launcher/kubernetes_component_launcher.py
imports: from typing import Any, Dict, List, Optional, cast
  from absl import logging
  from kubernetes import client
  from tfx import types
  from tfx.dsl.component.experimental import executor_specs
  from tfx.dsl.components.base import executor_spec
  from tfx.orchestration.config import base_component_config
  from tfx.orchestration.config import kubernetes_component_config
  from tfx.orchestration.launcher import base_component_launcher
  from tfx.orchestration.launcher import container_common
  from tfx.utils import kube_utils
label_desc: Use image node_id 3 for calling the KubernetesComponentLauncher obj's underlying member method code with example usage: obj._build_pod_manifest(pod_name, container_spec) and returns: pod_manifest