Skip to content
Merged
Show file tree
Hide file tree
Changes from 28 commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
e343196
WIP: Enable bucket versioning
nss10 Jul 7, 2026
efdeabb
[UNTESTED]Add initial s3files setup + separate out s3 files into a ne…
nss10 Jul 21, 2026
41926ab
Update EKS security group filter to use EKS group name
nss10 Jul 21, 2026
6e9abd5
Update docstring
nss10 Jul 21, 2026
6e368cd
Add a TODO comment regarding security group creation, maybe can reduc…
nss10 Jul 21, 2026
f4f2b75
Fix minor bugs and add more TODOs.
nss10 Jul 21, 2026
0248c3d
Add file system status implementation and waiter
nss10 Jul 22, 2026
e172079
Update import path
nss10 Jul 22, 2026
73ad87c
Move boto3 clients to a different file to avoid circular imports
nss10 Jul 22, 2026
1ac0aa4
Update exception type
nss10 Jul 22, 2026
f363791
Fix get_s3_files_system and add/update TODO comments
nss10 Jul 22, 2026
15182e5
Create dynamic IAM role for S3Files
nss10 Jul 23, 2026
fbc7545
Add STORAGE_TYPE config variable, add documentation for s3files
nss10 Jul 23, 2026
80cd425
Make S3Files a configurable setup
nss10 Jul 23, 2026
0eaf83e
Merge branch 'master' into feat/s3Files
nss10 Jul 23, 2026
2cf8c10
Make mount target provisioning a bgTask + Update docs
nss10 Jul 23, 2026
fc32d15
Update comments
nss10 Jul 23, 2026
bb84de3
Add missing function call.
nss10 Jul 23, 2026
df89174
Add more comments
nss10 Jul 24, 2026
00f569f
Re-organize aws_utils into aws.bucket, aws.aws_utils, aws.clients. (T…
nss10 Jul 24, 2026
3f56313
Fix patching in unit tests. All current tests pass
nss10 Jul 24, 2026
28614f8
Add more TODOs
nss10 Jul 24, 2026
aeb3071
Add unit tests for S3Files
nss10 Jul 27, 2026
24ae147
Merge branch 'master' of github.com:uc-cdis/gen3-workflow into feat/s…
paulineribeyre Jul 28, 2026
9ed86df
update deps
paulineribeyre Jul 28, 2026
cc2f471
Delete versions
paulineribeyre Jul 29, 2026
186ce56
fix s3files tests
paulineribeyre Jul 29, 2026
a9d5e80
fix other tests
paulineribeyre Jul 29, 2026
ed12503
pull
paulineribeyre Jul 30, 2026
3bd72a6
EKS_SECURITY_GROUP_NAMES update
paulineribeyre Jul 30, 2026
dd7f7be
update tests
paulineribeyre Jul 30, 2026
d2ee9c5
address review comments
paulineribeyre Jul 30, 2026
dbea8ac
update deps
paulineribeyre Jul 30, 2026
3fc64d7
Merge branch 'master' of github.com:uc-cdis/gen3-workflow into delete…
paulineribeyre Jul 30, 2026
261d6a3
fix merge mistakes
paulineribeyre Jul 30, 2026
e357b4b
split test_storage.py and test_misc.py
paulineribeyre Jul 30, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions docs/s3Files.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# S3 Files Setup

## Overview
TES worker and executor pods use **S3 Files** (Amazon's EFS-backed service) to interact with a user's S3 bucket. While pod lifecycle is managed by the underlying execution engine (Funnel), Gen3Workflow is responsible for provisioning the supporting AWS resources — file systems, mount targets, IAM roles, and security groups — required for S3 Files to function.

## Enabling S3 Files
Set the following in your config:

```yaml
ENABLE_S3_FILES: true
```

For Helm-based deployments, set:

```yaml
{{ .Values.gen3WorkflowConfig.enableS3Files }}: true
```

## Prerequisites
* Gen3Workflow must be deployed on an EKS cluster.
* The EKS cluster must support S3 Files, provisioned via the [EFS CSI driver](https://github.com/kubernetes-sigs/aws-efs-csi-driver).


#### NOTE:
* Currently Gen3Workflow with S3Files only supports user bucket and the EKS cluster being present in the same region. Support shall be added in the future.
67 changes: 67 additions & 0 deletions gen3workflow/aws/aws_utils.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
import json
from typing import Union
from gen3workflow.config import config


def dict_to_sorted_json_str(obj: dict) -> str:
"""
Reads a Python dict and returns a JSON string with ordered keys
Use case: when comparing JSON objects returned by AWS, comparisons are deterministic and less flaky
"""
return json.dumps(obj, sort_keys=True, separators=(",", ":"))


def get_safe_name_from_hostname(
user_id: Union[str, None], reserved_length: int = 0
) -> str:
"""
Generate a valid and length-safe name (for IAM user, S3 bucket, or IAM role)
derived from the configured hostname and optional user ID.
Rules:
- IAM user names: up to 64 characters.
- S3 bucket / IAM role names: up to 63 characters.
- Only alphanumeric characters and the following are allowed: +=,.@_-
(assumes HOSTNAME and user IDs are already compliant).
Args:
user_id (str | None): The user's unique Gen3 ID. If None, will not be included in the safe name.
reserved_length (int): Number of characters to reserve for prefixes/suffixes.

Returns:
str: safe name
"""
escaped_hostname = config["HOSTNAME"].replace(".", "-")
safe_name = f"gen3wf-{escaped_hostname}"
max_chars = 63 - reserved_length
if user_id:
max_chars = max_chars - len(f"-{user_id}")
if len(safe_name) > max_chars:
safe_name = safe_name[:max_chars]
if user_id:
safe_name = f"{safe_name}-{user_id}"
return safe_name


def get_worker_sa_name(user_id: str) -> str:
"""
Generate the name of the Kubernetes service account used by worker pods for the specified user.

Args:
user_id (str): The user's unique Gen3 ID
Returns:
str: service account name
"""
safe_name = get_safe_name_from_hostname(user_id, reserved_length=len("-worker-sa"))
return f"{safe_name}-worker-sa"


def get_bucket_name_from_user_id(user_id: str) -> str:
"""
Generate the S3 bucket name for the specified user.

Args:
user_id (str): The user's unique Gen3 ID
Returns:
str: S3 bucket name
"""
# Abstracted for future flexibility — currently same as safe name.
return get_safe_name_from_hostname(user_id)
Loading
Loading