@staticmethod<EOL><INDENT>def create(image_data):<DEDENT>
<EOL>env_variables = []<EOL>for key, value in image_data.env_variables.items():<EOL><INDENT>env_variables.append(client.V1EnvVar(name=key, value=value))<EOL><DEDENT>exposed_ports = []<EOL>if image_data.exposed_ports is not None:<EOL><INDENT>for port in image_data.exposed_ports:<EOL><INDENT>splits = port.split("<STR_LIT:/>", <NUM_LIT:1>)<EOL>port = int(splits[<NUM_LIT:0>])<EOL>protocol = splits[<NUM_LIT:1>].upper() if len(splits) > <NUM_LIT:1> else None<EOL>exposed_ports.append(client.V1ContainerPort(container_port=port, protocol=protocol))<EOL><DEDENT><DEDENT>image_name = image_data.name.split("<STR_LIT:/>")[-<NUM_LIT:1>].split("<STR_LIT::>")[<NUM_LIT:0>]<EOL>random_string = '<STR_LIT>'.join(<EOL>random.choice(string.ascii_lowercase + string.digits) for _ in range(<NUM_LIT:4>))<EOL>container_name = '<STR_LIT>'.format(<EOL>image_name=image_name,<EOL>user_name=getpass.getuser(),<EOL>random_string=random_string)<EOL>container = client.V1Container(command=image_data.command,<EOL>env=env_variables,<EOL>image=image_data.name,<EOL>name=container_name,<EOL>ports=exposed_ports)<EOL>pod_metadata = client.V1ObjectMeta(name=container_name + "<STR_LIT>")<EOL>pod_spec = client.V1PodSpec(containers=[container])<EOL>pod = client.V1Pod(spec=pod_spec, metadata=pod_metadata)<EOL>return pod<EOL>
:param image_data: ImageMetadata
:return: V1Pod,
    https://github.com/kubernetes-client/python/blob/master/kubernetes/docs/V1Pod.md