code: def __init__(
      self,
      kube_api_client=None,
      image=None,
      job_name=None,
      namespace=None,
      scheduler_num=1,
      scheduler_cpu=None,
      scheduler_mem=None,
      worker_num=1,
      worker_cpu=None,
      worker_mem=None,
      worker_spill_paths=None,
      worker_cache_mem=None,
      min_worker_num=None,
      web_num=1,
      web_cpu=None,
      web_mem=None,
      slb_endpoint=None,
      verify_ssl=True,
      timeout=None,
      **kwargs,
  ):
      from kubernetes import client as kube_client
  
      self._kube_api_client = kube_api_client
      self._custom_api = kube_client.CustomObjectsApi(kube_api_client)
  
      self._slb_endpoint = slb_endpoint.rstrip("/")
      self._verify_ssl = verify_ssl
  
      self._job_name = job_name
      self._mars_endpoint = None
      self._namespace = namespace or "default"
      self._image = image
      self._timeout = timeout
      self._extra_volumes = kwargs.pop("extra_volumes", ())
      self._pre_stop_command = kwargs.pop("pre_stop_command", None)
      self._log_when_fail = kwargs.pop("log_when_fail", False)
      self._node_selectors = kwargs.pop("node_selectors", None)
  
      extra_modules = kwargs.pop("extra_modules", None) or []
      extra_modules = (
          extra_modules.split(",")
          if isinstance(extra_modules, str)
          else extra_modules
      )
      extra_envs = kwargs.pop("extra_env", None) or dict()
  
      if not verify_ssl:
          extra_envs["KUBE_VERIFY_SSL"] = "0"
  
      def _override_modules(updates):
          modules = set(extra_modules)
          updates = (
              updates.split(",")
              if isinstance(updates, str)
              else updates
          )
          modules.update(updates)
          return sorted(modules)
  
      def _override_envs(updates):
          ret = extra_envs.copy()
          ret.update(updates)
          return ret
  
      self._scheduler_num = scheduler_num
      self._scheduler_cpu = scheduler_cpu
      self._scheduler_mem = scheduler_mem
      self._scheduler_extra_modules = _override_modules(
          kwargs.pop("scheduler_extra_modules", [])
      )
      self._scheduler_extra_env = _override_envs(
          kwargs.pop("scheduler_extra_env", None) or dict()
      )
  
      self._worker_num = worker_num
      self._worker_cpu = worker_cpu
      self._worker_mem = worker_mem
      self._worker_spill_paths = worker_spill_paths
      self._worker_cache_mem = worker_cache_mem
      self._min_worker_num = min_worker_num or worker_num
      self._worker_extra_modules = _override_modules(
          kwargs.pop("worker_extra_modules", [])
      )
      self._worker_extra_env = _override_envs(
          kwargs.pop("worker_extra_env", None) or dict()
      )
  
      self._web_num = web_num
      self._web_cpu = web_cpu
      self._web_mem = web_mem
      self._web_extra_modules = _override_modules(
          kwargs.pop("web_extra_modules", [])
      )
      self._web_extra_env = _override_envs(
          kwargs.pop("web_extra_env", None) or dict()
      )
  
imports: import logging
  import time
  import warnings
  import requests
  from ...session import new_session
  from .config import MarsSchedulerSpecConfig, MarsWorkerSpecConfig, MarsWebSpecConfig, MarsJobConfig
label_desc: Use image node_id 1 to create a new KubeDLCluster object  with example: obj = KubeDLCluster(kube_api_client, image, job_name, namespace, scheduler_num, scheduler_cpu, scheduler_mem, worker_num, worker_cpu, worker_mem, worker_spill_paths, worker_cache_mem, min_worker_num, web_num, web_cpu, web_mem, slb_endpoint, verify_ssl, timeout)