class_docstr: Contains Kubernetes Airflow Worker configuration logic.
  
  Represents a kubernetes pod and manages execution of a single pod.
  Any configuration that is container specific gets applied to
  the first container in the list of containers.
  
  :param image: The docker image
  :param name: name in the metadata section (not the container name)
  :param namespace: pod namespace
  :param volume_mounts: list of kubernetes volumes mounts
  :param envs: A dict containing the environment variables
  :param cmds: The command to be run on the first container
  :param args: The arguments to be run on the pod
  :param labels: labels for the pod metadata
  :param node_selectors: node selectors for the pod
  :param ports: list of ports. Applies to the first container.
  :param volumes: Volumes to be attached to the first container
  :param image_pull_policy: Specify a policy to cache or always pull an image
  :param restart_policy: The restart policy of the pod
  :param image_pull_secrets: Any image pull secrets to be given to the pod.
      If more than one secret is required, provide a comma separated list:
      secret_a,secret_b
  :param init_containers: A list of init containers
  :param service_account_name: Identity for processes that run in a Pod
  :param resources: Resource requirements for the first containers
  :param annotations: annotations for the pod
  :param affinity: A dict containing a group of affinity scheduling rules
  :param hostnetwork: If True enable host networking on the pod
  :param tolerations: A list of kubernetes tolerations
  :param security_context: A dict containing the security context for the pod
  :param configmaps: Any configmap refs to read ``configmaps`` for environments from.
      If more than one configmap is required, provide a comma separated list
      configmap_a,configmap_b
  :param dnspolicy: Specify a dnspolicy for the pod
  :param schedulername: Specify a schedulername for the pod
  :param pod: The fully specified pod. Mutually exclusive with `path_or_string`
  :param extract_xcom: Whether to bring up a container for xcom
  :param priority_class_name: priority class name for the launched Pod
docstr: Convert to pod from obj.
docstr_tok: ["Convert","to","pod","from","obj","."]
code: def from_obj(obj) -> k8s.V1Pod | None:
      """Convert to pod from obj."""
      if obj is None:
          return None
  
      if isinstance(obj, PodGenerator):
          return obj.gen_pod()
  
      if not isinstance(obj, dict):
          raise TypeError(
              "Cannot convert a non-dictionary or non-PodGenerator "
              "object into a KubernetesExecutorConfig"
          )
  
      # We do not want to extract constant here from ExecutorLoader because it is just
      # A name in dictionary rather than executor selection mechanism and it causes cyclic import
      namespaced = obj.get("KubernetesExecutor", {})
  
      if not namespaced:
          return None
  
      resources = namespaced.get("resources")
  
      if resources is None:
          requests = {
              "cpu": namespaced.get("request_cpu"),
              "memory": namespaced.get("request_memory"),
              "ephemeral-storage": namespaced.get("ephemeral-storage"),
          }
          limits = {
              "cpu": namespaced.get("limit_cpu"),
              "memory": namespaced.get("limit_memory"),
              "ephemeral-storage": namespaced.get("ephemeral-storage"),
          }
          all_resources = list(requests.values()) + list(
              limits.values()
          )
          if all(r is None for r in all_resources):
              resources = None
          else:
              resources = k8s.V1ResourceRequirements(
                  requests=requests, limits=limits
              )
      namespaced["resources"] = resources
      return PodGenerator(**namespaced).gen_pod()
  
file_path: airflow/airflow/providers/cncf/kubernetes/pod_generator_deprecated.py
imports: from __future__ import annotations
  import copy
  import uuid
  import re2
  from kubernetes.client import models
  from airflow.utils.hashlib_wrapper import md5
label_desc: Use image node_id 4 for calling the PodGenerator obj's underlying member method code with example usage: obj.from_obj(obj) and returns: PodGenerator, None, obj, None