Pod spec to be used to create pods for project: tensorboard, notebooks.

def get_project_pod_spec(volume_mounts,
                         volumes,
                         image,
                         command,
                         args,
                         ports,
                         env_vars=None,
                         env_from=None,
                         container_name=None,
                         resources=None,
                         node_selector=None,
                         affinity=None,
                         tolerations=None,
                         image_pull_policy=None,
                         restart_policy=None,
                         service_account_name=None):
    """Pod spec to be used to create pods for project: tensorboard, notebooks."""
    volume_mounts = to_list(volume_mounts, check_none=True)
    volumes = to_list(volumes, check_none=True)

    gpu_volume_mounts, gpu_volumes = get_gpu_volumes_def(resources)
    volume_mounts += gpu_volume_mounts
    volumes += gpu_volumes

    ports = [client.V1ContainerPort(container_port=port) for port in ports]

    pod_container = get_pod_container(
        volume_mounts=volume_mounts,
        image=image,
        command=command,
        args=args,
        ports=ports,
        env_vars=env_vars,
        env_from=env_from,
        container_name=container_name,
        resources=resources,
        image_pull_policy=image_pull_policy)
    containers = [pod_container]

    if service_account_name and not conf.get('K8S_RBAC_ENABLED'):
        service_account_name = None

    return client.V1PodSpec(restart_policy=restart_policy,
                            security_context=get_security_context(),
                            service_account_name=service_account_name,
                            containers=containers,
                            volumes=volumes,
                            node_selector=node_selector,
                            affinity=affinity,
                            tolerations=tolerations)