jina.peapods.pods.k8slib.kubernetes_deployment module

jina.peapods.pods.k8slib.kubernetes_deployment.to_dns_name(name)[source]

Converts the pod name to a dns compatible name.

Parameters

name (str) – name of the pod

Return type

str

Returns

dns compatible name

jina.peapods.pods.k8slib.kubernetes_deployment.deploy_service(name, namespace, image_name, container_cmd, container_args, logger, replicas, pull_policy, init_container=None, custom_resource_dir=None, port_expose=None)[source]

Deploy service on Kubernetes.

Parameters
  • name (str) – name of the service and deployment

  • namespace (str) – k8s namespace of the service and deployment

  • image_name (str) – image for the k8s deployment

  • container_cmd (str) – command executed on the k8s pods

  • container_args (str) – arguments used for the k8s pod

  • logger (JinaLogger) – used logger

  • replicas (int) – number of replicas

  • pull_policy (str) – pull policy used for fetching the Docker images from the registry.

  • init_container (Optional[Dict]) – additional arguments used for the init container

  • 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.

  • port_expose (Optional[int]) – port which will be exposed by the deployed containers

Return type

str

Returns

dns name of the created service

jina.peapods.pods.k8slib.kubernetes_deployment.get_cli_params(arguments, skip_list=())[source]

Get cli parameters based on the arguments.

Parameters
  • arguments (Namespace) – arguments where the cli parameters are generated from

  • skip_list (Tuple[str]) – list of arguments which should be ignored

Return type

str

Returns

string which contains all cli parameters

jina.peapods.pods.k8slib.kubernetes_deployment.get_image_name(uses)[source]

The image can be provided in different formats by the user. This function converts it to an image name which can be understood by k8s. It uses the Hub api to get the image name and the latest tag on Docker Hub. :type uses: str :param uses: image name

Return type

str

Returns

normalized image name

jina.peapods.pods.k8slib.kubernetes_deployment.dictionary_to_cli_param(dictionary)[source]

Convert the dictionary into a string to pass it as argument in k8s. :param dictionary: dictionary which has to be passed as argument in k8s.

Return type

str

Returns

string representation of the dictionary

jina.peapods.pods.k8slib.kubernetes_deployment.get_init_container_args(pod)[source]

Return the init container arguments for the k8s pod.

Parameters

pod – pod where the init container is used.

Return type

Optional[Dict]

Returns

dictionary of init container arguments