<#1170 PodTemplate capability helpers (allow_fuse ...
# flyte-github
a
#1170 PodTemplate capability helpers (allow_fuse / allow_nested_sandboxing, from_spec) + fix GPU accelerator in override() Pull request opened by kumare3 Two changes: 1. PodTemplate capability helpers Image-style chainable methods for requesting pod privileges without hand-writing Kubernetes security contexts: pt = flyte.PodTemplate.from_spec(my_v1_pod_spec) # wrap an existing pod spec pt = flyte.PodTemplate().allow_fuse() # /dev/fuse + SYS_ADMIN + privileged pt = my_pt.allow_nested_sandboxing() # bwrap prerequisites: SYS_ADMIN + AppArmor unconfined + allowPrivilegeEscalation=false pt = my_pt.allow_fuse(privileged=False).allow_nested_sandboxing() # composable on clusters that permit /dev/fuse unprivileged Helpers are pure augmentors with tested laws: never mutate the input, idempotent, additive over user-set fields (sidecars/volumes/securityContext preserved), order-free where composable, stamp
flyte.org/capability-<name>
annotations for auditability, and raise loudly on conflicting pre-set security posture (e.g.
allow_fuse()
after
allow_nested_sandboxing()
). 2. Fix:
task.override(resources=...)
dropped the GPU accelerator
TaskDetails.override
only copied
container.resources
and never set
task_template.extended_resources
, so
task.override(resources=flyte.Resources(gpu="L40s:1"))
produced a pod with no accelerator nodeSelector/toleration and scheduled on a non-GPU node. Now mirrors the build path (
get_proto_extended_resources
), clearing the field when the replacement has no extended resources. Enables per-run GPU overrides. Test plan • `tests/user_api/test_pod_template.py`: 51 tests —
from_spec
resolution rules, parametrized augmentor-law suite over all three grant variants, conflict and both-order composition tests • `tests/flyte/remote/test_task.py`: GPU override sets `gpu_accelerator.device == "nvidia-l40s"`; cpu-only re-override clears
extended_resources
• Full sweep: 662 passed (user_api + remote + task/app/resources serde) 🤖 Generated with Claude Code flyteorg/flyte-sdk