def _create_deployment_object(self, job_name, job_image,<EOL>deployment_name, port=<NUM_LIT>,<EOL>replicas=<NUM_LIT:1>,<EOL>cmd_string=None,<EOL>engine_json_file='<STR_LIT>',<EOL>engine_dir='<STR_LIT:.>',<EOL>volumes=[]):
<EOL>security_context = None<EOL>if self.user_id and self.group_id:<EOL><INDENT>security_context = client.V1SecurityContext(run_as_group=self.group_id,<EOL>run_as_user=self.user_id,<EOL>run_as_non_root=self.run_as_non_root)<EOL><DEDENT>environment_vars = client.V1EnvVar(name="<STR_LIT>", value="<STR_LIT>")<EOL>launch_args = ["<STR_LIT:-c>", "<STR_LIT>".format(cmd_string)]<EOL>volume_mounts = []<EOL>for volume in volumes:<EOL><INDENT>volume_mounts.append(client.V1VolumeMount(mount_path=volume[<NUM_LIT:1>],<EOL>name=volume[<NUM_LIT:0>]))<EOL><DEDENT>container = None<EOL>if security_context:<EOL><INDENT>container = client.V1Container(<EOL>name=job_name,<EOL>image=job_image,<EOL>ports=[client.V1ContainerPort(container_port=port)],<EOL>volume_mounts=volume_mounts,<EOL>command=['<STR_LIT>'],<EOL>args=launch_args,<EOL>env=[environment_vars],<EOL>security_context=security_context)<EOL><DEDENT>else:<EOL><INDENT>container = client.V1Container(<EOL>name=job_name,<EOL>image=job_image,<EOL>ports=[client.V1ContainerPort(container_port=port)],<EOL>volume_mounts=volume_mounts,<EOL>command=['<STR_LIT>'],<EOL>args=launch_args,<EOL>env=[environment_vars])<EOL><DEDENT>secret = None<EOL>if self.secret:<EOL><INDENT>secret = client.V1LocalObjectReference(name=self.secret)<EOL><DEDENT>volume_defs = []<EOL>for volume in volumes:<EOL><INDENT>volume_defs.append(client.V1Volume(name=volume[<NUM_LIT:0>],<EOL>persistent_volume_claim=client.V1PersistentVolumeClaimVolumeSource(<EOL>claim_name=volume[<NUM_LIT:0>])))<EOL><DEDENT>template = client.V1PodTemplateSpec(<EOL>metadata=client.V1ObjectMeta(labels={"<STR_LIT>": job_name}),<EOL>spec=client.V1PodSpec(containers=[container],<EOL>image_pull_secrets=[secret],<EOL>volumes=volume_defs<EOL>))<EOL>spec = client.ExtensionsV1beta1DeploymentSpec(replicas=replicas,<EOL>template=template)<EOL>deployment = client.ExtensionsV1beta1Deployment(<EOL>api_version="<STR_LIT>",<EOL>kind="<STR_LIT>",<EOL>metadata=client.V1ObjectMeta(name=deployment_name),<EOL>spec=spec)<EOL>return deployment<EOL>
Create a kubernetes deployment for the job.
        Args:
              - job_name (string) : Name of the job and deployment
              - job_image (string) : Docker image to launch
        KWargs:
             - port (integer) : Container port
             - replicas : Number of replica containers to maintain
        Returns:
              - True: The deployment object to launch