feat(apps): fuse/parameter serde fixes for app pods + userspace volume-serve example#1157
Open
kumare3 wants to merge 1 commit into
Open
feat(apps): fuse/parameter serde fixes for app pods + userspace volume-serve example#1157kumare3 wants to merge 1 commit into
kumare3 wants to merge 1 commit into
Conversation
…serve example Three SDK fixes that make Volumes usable from Flyte apps, plus a new example that prototypes serving a sealed ROVolume from a scale-from-zero app with zero privileges. SDK fixes (found by deploying the example against a real cluster): - app_serde: the enable_fuse_mount pod augmentation built the pod template with primary container "primary"; the apps backend requires "app" (enforced in _get_k8s_pod), so deploys failed with "Primary container name must be 'app'". - app_serde: pod-templated apps never materialized RunOutput/delayed parameters — get_proto_container received parameter_overrides but _get_k8s_pod/_serialized_pod_spec did not, so the raw RunOutput JSON was baked into the fserve --parameters blob and reached on_startup un-materialized. Threaded parameter_overrides through the pod path. - _pod: new privileged_only mode for pod_template_with_fuse_mount. Knative's admission webhook rejects hostPath volumes (unsupported before Serving 1.17, feature-gated after) and gates capabilities.add; privileged alone implies device access + all caps, so app pods emit only that. (Knative drops `privileged` silently on every version, so kernel FUSE mounts still don't work in apps — hence the example below.) New example (examples/volumes/volume_browser_app.py): - a task snapshots the flyte-sdk repo into a Volume and seals it; the sealed ROVolume crosses into the app as its JSON spec via a RunOutput string parameter (getter=(1,)) - serve_volume_webdav(): prototype of a future ROVolume.serve() — the same juicefs engine mount() uses (index download + metadata materialization via plugin internals), exposed over localhost WebDAV (`juicefs webdav --read-only`) instead of through /dev/fuse. No privileges, no PodTemplate, runs on stock Knative. - FastAPI file browser over a stdlib WebDAV client (PROPFIND + GET), Scaling(replicas=(0, 1)) with a 5-minute scaledown. Verified end-to-end on demo.hosted.unionai.cloud: snapshot task ran, app deployed unprivileged, browse/file/404 paths all serve correctly. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Makes Volumes usable from Flyte apps. Three SDK fixes found by deploying a real app against
demo.hosted.unionai.cloud, plus a new example that serves a sealedROVolumefrom a scale-from-zero app with zero privileges.SDK fixes (
src/flyte)app_serde: wrong primary container name for FUSE apps. Theenable_fuse_mountpod augmentation built the template with primary container"primary"; the apps backend requires"app"(enforced in_get_k8s_pod). Deploys failed withPrimary container name must be 'app'.app_serde: pod-templated apps never materializedRunOutputparameters.get_proto_containerreceivedparameter_overrides, but_get_k8s_pod/_serialized_pod_specdid not — so the rawRunOutputJSON spec was baked into the fserve--parametersblob and reachedon_startupun-materialized (ValidationError: Field requiredwhen the app tried to parse it). Threadedparameter_overridesthrough the pod path._pod: newprivileged_only=mode forpod_template_with_fuse_mount. Knative's admission webhook rejects hostPath volumes (unsupported before Serving 1.17, feature-gated after) and gatescapabilities.add;privilegedalone implies device access + all caps, so app pods now emit only that. Caveat discovered en route: Knative silently dropsprivilegedon every version, so kernel FUSE mounts still don't work in apps — which motivates the example below.New example:
examples/volumes/volume_browser_app.pyrepo-snapshot.snapshot_repodownloads the flyte-sdk GitHub tarball into a freshVolume(FUSE-mounted task) and seals it; returns(ROVolume, json_spec)so the typed volume keeps UI lineage while the app picks up the JSON via aRunOutputstring parameter (getter=(1,)).serve_volume_webdav()— prototype for a futureROVolume.serve(): the same juicefs enginemount()uses (index download + metadata materialization via plugin internals), exposed over localhost WebDAV (juicefs webdav --read-only --no-bgjob) instead of through/dev/fuse. No privileges, no PodTemplate, runs on stock Knative — only the kernelmount(2)step is skipped.Depth:1+ GET; file-vs-dir decided from the self entry'sresourcetypesince PROPFIND on a file still 207s).Scaling(replicas=(0, 1), scaledown_after=300)— scale-from-zero; each cold start is one index download + a subprocess spawn.Test plan
tests/flyte/app/(121 tests) passfile://-backed juicefs volume (dir listing, file read, 404, read-only rejects writes)demo.hosted.unionai.cloud: snapshot run succeeded; app deployed unprivileged on Knative 1.16 (no feature flags);/browse/, deep listings, and file reads all serve from the sealed volume🤖 Generated with Claude Code