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
code: def __init__(
      self,
      image: str | None = None,
      name: str | None = None,
      namespace: str | None = None,
      volume_mounts: list[k8s.V1VolumeMount | dict] | None = None,
      envs: dict[str, str] | None = None,
      cmds: list[str] | None = None,
      args: list[str] | None = None,
      labels: dict[str, str] | None = None,
      node_selectors: dict[str, str] | None = None,
      ports: list[k8s.V1ContainerPort | dict] | None = None,
      volumes: list[k8s.V1Volume | dict] | None = None,
      image_pull_policy: str | None = None,
      restart_policy: str | None = None,
      image_pull_secrets: str | None = None,
      init_containers: list[k8s.V1Container] | None = None,
      service_account_name: str | None = None,
      resources: k8s.V1ResourceRequirements | dict | None = None,
      annotations: dict[str, str] | None = None,
      affinity: dict | None = None,
      hostnetwork: bool = False,
      tolerations: list | None = None,
      security_context: k8s.V1PodSecurityContext | dict | None = None,
      configmaps: list[str] | None = None,
      dnspolicy: str | None = None,
      schedulername: str | None = None,
      extract_xcom: bool = False,
      priority_class_name: str | None = None,
  ):
      self.pod = k8s.V1Pod()
      self.pod.api_version = "v1"
      self.pod.kind = "Pod"
  
      # Pod Metadata
      self.metadata = k8s.V1ObjectMeta()
      self.metadata.labels = labels
      self.metadata.name = name
      self.metadata.namespace = namespace
      self.metadata.annotations = annotations
  
      # Pod Container
      self.container = k8s.V1Container(name="base")
      self.container.image = image
      self.container.env = []
  
      if envs:
          if isinstance(envs, dict):
              for key, val in envs.items():
                  self.container.env.append(
                      k8s.V1EnvVar(name=key, value=val)
                  )
          elif isinstance(envs, list):
              self.container.env.extend(envs)
  
      configmaps = configmaps or []
      self.container.env_from = []
      for configmap in configmaps:
          self.container.env_from.append(
              k8s.V1EnvFromSource(
                  config_map_ref=k8s.V1ConfigMapEnvSource(
                      name=configmap
                  )
              )
          )
  
      self.container.command = cmds or []
      self.container.args = args or []
      if image_pull_policy:
          self.container.image_pull_policy = image_pull_policy
      self.container.ports = ports or []
      self.container.resources = resources
      self.container.volume_mounts = volume_mounts or []
  
      # Pod Spec
      self.spec = k8s.V1PodSpec(containers=[])
      self.spec.security_context = security_context
      self.spec.tolerations = tolerations
      if dnspolicy:
          self.spec.dns_policy = dnspolicy
      self.spec.scheduler_name = schedulername
      self.spec.host_network = hostnetwork
      self.spec.affinity = affinity
      self.spec.service_account_name = service_account_name
      self.spec.init_containers = init_containers
      self.spec.volumes = volumes or []
      self.spec.node_selector = node_selectors
      if restart_policy:
          self.spec.restart_policy = restart_policy
      self.spec.priority_class_name = priority_class_name
  
      self.spec.image_pull_secrets = []
  
      if image_pull_secrets:
          for image_pull_secret in image_pull_secrets.split(","):
              self.spec.image_pull_secrets.append(
                  k8s.V1LocalObjectReference(name=image_pull_secret)
              )
  
      # Attach sidecar
      self.extract_xcom = extract_xcom
  
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 1 to create a new PodGenerator object  with example: obj = PodGenerator(image, name, namespace, volume_mounts, envs, cmds, args, labels, node_selectors, ports, volumes, image_pull_policy, restart_policy, image_pull_secrets, init_containers, service_account_name, resources, annotations, affinity, hostnetwork, tolerations, security_context, configmaps, dnspolicy, schedulername, extract_xcom, priority_class_name)