jina.peapods.pods.k8slib.kubernetes_tools module

jina.peapods.pods.k8slib.kubernetes_tools.create(template, params, logger=<jina.logging.logger.JinaLogger object>, custom_resource_dir=None)[source]

Create a resource on Kubernetes based on the template. It fills the template using the params.

Parameters
  • template (str) – path to the template file.

  • custom_resource_dir (Optional[str]) – Path to a folder containing the kubernetes yml template files. Defaults to the standard location jina.resources if not specified.

  • logger (JinaLogger) – logger to use. Defaults to the default logger.

  • params (Dict) – dictionary for replacing the placeholders (keys) with the actual values.

jina.peapods.pods.k8slib.kubernetes_tools.replace(deployment_name, namespace_name, template, params, custom_resource_dir=None)[source]

Create a resource on Kubernetes based on the template. It fills the template using the params.

Parameters
  • deployment_name (str) – The name of the deployment to replace

  • namespace_name (str) – The name of the namespace where the deployment exists

  • template (str) – path to the template file.

  • custom_resource_dir (Optional[str]) – Path to a folder containing the kubernetes yml template files. Defaults to the standard location jina.resources if not specified.

  • params (Dict) – dictionary for replacing the placeholders (keys) with the actual values.

jina.peapods.pods.k8slib.kubernetes_tools.get_port_forward_contextmanager(namespace, port_expose, config_path=None)[source]

Forward local requests to the gateway which is running in the Kubernetes cluster. :type namespace: str :param namespace: namespace of the gateway :type port_expose: int :param port_expose: exposed port of the gateway :type config_path: Optional[str] :param config_path: path to the Kubernetes config file :rtype: Generator[None, None, None] :return: context manager which sets up and terminates the port-forward