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 deploymentnamespace (
str
) – k8s namespace of the service and deploymentimage_name (
str
) – image for the k8s deploymentcontainer_cmd (
str
) – command executed on the k8s podscontainer_args (
str
) – arguments used for the k8s podreplicas (
int
) – number of replicaspull_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 topod_type (
str
) – type os this pod, can be gateway/head/workershard_id (
Optional
[int
]) – id of this shard, None if shards=1 or this is gateway/headport_expose (
Optional
[int
]) – port which will be exposed by the deployed containersenv (
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 deploymentimage_name_uses_after (
Optional
[str
]) – image for uses_after container in the k8s deploymentcontainer_cmd_uses_before (
Optional
[str
]) – command executed in the uses_before container on the k8s podscontainer_cmd_uses_after (
Optional
[str
]) – command executed in the uses_after container on the k8s podscontainer_args_uses_before (
Optional
[str
]) – arguments used for uses_before container on the k8s podcontainer_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 fromskip_list (
Tuple
[str
]) – list of arguments which should be ignoredport_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