jina.orchestrate.deployments.config.k8slib.kubernetes_deployment module

jina.orchestrate.deployments.config.k8slib.kubernetes_deployment.get_deployment_yamls(name, namespace, image_name, container_cmd, container_args, replicas, pull_policy, jina_deployment_name, pod_type, shard_id=None, port_expose=None, env=None, gpus=None, image_name_uses_before=None, image_name_uses_after=None, container_cmd_uses_before=None, container_cmd_uses_after=None, container_args_uses_before=None, container_args_uses_after=None)[source]

Get the yaml description of a 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

    • replicas (int) – number of replicas

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

    • jina_deployment_name (str) – Name of the Jina Deployment this deployment belongs to

    • pod_type (str) – type os this pod, can be gateway/head/worker

    • shard_id (Optional[int]) – id of this shard, None if shards=1 or this is gateway/head

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

    • env (Optional[Dict]) – environment variables to be passed into configmap.

    • gpus (Union[int, str, None]) – number of gpus to use, for k8s requires you pass an int number, refers to the number of requested gpus.

    • image_name_uses_before (Optional[str]) – image for uses_before container in the k8s deployment

    • image_name_uses_after (Optional[str]) – image for uses_after container in the k8s deployment

    • container_cmd_uses_before (Optional[str]) – command executed in the uses_before container on the k8s pods

    • container_cmd_uses_after (Optional[str]) – command executed in the uses_after container on the k8s pods

    • container_args_uses_before (Optional[str]) – arguments used for uses_before container on the k8s pod

    • container_args_uses_after (Optional[str]) – arguments used for uses_after container on the k8s pod

    Return type

    List[Dict]

    Returns

    Return a dictionary with all the yaml configuration needed for a deployment

jina.orchestrate.deployments.config.k8slib.kubernetes_deployment.get_cli_params(arguments, skip_list=(), port_in=None)[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

    • port_in (Optional[int]) – overwrite port_in with the provided value if set

    Return type

    str

    Returns

    string which contains all cli parameters

jina.orchestrate.deployments.config.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