code: def restart_server(helm_release_name, namespace):
      res = True
      timeout = 120000
      # service_name = "%s.%s.svc.cluster.local" % (helm_release_name, namespace)
      config.load_kube_config()
      v1 = client.CoreV1Api()
      pod_name = None
      # config_map_names = v1.list_namespaced_config_map(namespace, pretty='true')
      # body = {"replicas": 0}
      pods = v1.list_namespaced_pod(namespace)
      for i in pods.items:
          if i.metadata.name.find(helm_release_name) != -1:
              pod_name = i.metadata.name
              break
              # v1.patch_namespaced_config_map(config_map_name, namespace, body, pretty='true')
      # status_res = v1.read_namespaced_service_status(helm_release_name, namespace, pretty='true')
      logger.debug("Pod name: %s" % pod_name)
      if pod_name is not None:
          try:
              v1.delete_namespaced_pod(pod_name, namespace)
          except Exception as e:
              logger.error(str(e))
              logger.error(
                  "Exception when calling CoreV1Api->delete_namespaced_pod"
              )
              res = False
              return res
          logger.error("Sleep 10s after pod deleted")
          time.sleep(10)
          # check if restart successfully
          pods = v1.list_namespaced_pod(namespace)
          for i in pods.items:
              pod_name_tmp = i.metadata.name
              logger.error(pod_name_tmp)
              if pod_name_tmp == pod_name:
                  continue
              elif pod_name_tmp.find(helm_release_name) == -1:
                  continue
              else:
                  status_res = v1.read_namespaced_pod_status(
                      pod_name_tmp, namespace, pretty="true"
                  )
                  logger.error(status_res.status.phase)
                  start_time = time.time()
                  ready_break = False
                  while time.time() - start_time <= timeout:
                      logger.error(time.time())
                      status_res = v1.read_namespaced_pod_status(
                          pod_name_tmp, namespace, pretty="true"
                      )
                      if status_res.status.phase == "Running":
                          logger.error("Already running")
                          ready_break = True
                          break
                      else:
                          time.sleep(5)
                  if time.time() - start_time > timeout:
                      logger.error(
                          "Restart pod: %s timeout" % pod_name_tmp
                      )
                      res = False
                      return res
                  if ready_break:
                      break
      else:
          raise Exception("Pod: %s not found" % pod_name)
      follow = True
      pretty = True
      previous = True  # bool | Return previous terminated container logs. Defaults to false. (optional)
      since_seconds = 56  # int | A relative time in seconds before the current time from which to show logs. If this value precedes the time a pod was started, only logs since the pod start will be returned. If this value is in the future, no logs will be returned. Only one of sinceSeconds or sinceTime may be specified. (optional)
      timestamps = True  # bool | If true, add an RFC3339 or RFC3339Nano timestamp at the beginning of every line of log output. Defaults to false. (optional)
      container = "milvus"
      # start_time = time.time()
      # while time.time() - start_time <= timeout:
      #     try:
      #         api_response = v1.read_namespaced_pod_log(pod_name_tmp, namespace, container=container, follow=follow,
      #                                                 pretty=pretty, previous=previous, since_seconds=since_seconds,
      #                                                 timestamps=timestamps)
      #         logging.error(api_response)
      #         return res
      #     except Exception as e:
      #         logging.error("Exception when calling CoreV1Api->read_namespaced_pod_log: %s\n" % e)
      #         # waiting for server start
      #         time.sleep(2)
      #         # res = False
      #         # return res
      # if time.time() - start_time > timeout:
      #     logging.error("Restart pod: %s timeout" % pod_name_tmp)
      #     res = False
      return res
  
file_path: milvus/tests/benchmark/milvus_benchmark/env/helm_utils.py
imports: import os
  import pdb
  import time
  import logging
  import hashlib
  import traceback
  from yaml import full_load, dump
  from milvus_benchmark import utils
  from milvus_benchmark import config
label_desc: Use image node_id 6 for calling a global function with example usage: restart_server(helm_release_name, namespace) and returns: res, res, res