Skip to content

Restore accelerated-inputs volume mount in v2 flytek8s pod construction - #7790

Open
pvditt wants to merge 1 commit into
mainfrom
pvditt/accelerated-inputs-flytek8s
Open

Restore accelerated-inputs volume mount in v2 flytek8s pod construction#7790
pvditt wants to merge 1 commit into
mainfrom
pvditt/accelerated-inputs-flytek8s

Conversation

@pvditt

@pvditt pvditt commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

TL;DR

Accelerated inputs (node-local dataset mirror) was half-wired in v2: leaseworker injects the _F_PATH_REWRITE env var telling the SDK to read inputs locally, but the hostPath volume mount that makes the local path exist was commented out (TODO @pvditt) when flytek8s was ported — so the SDK's mount check always failed and every task silently fell back to S3. This restores the mount.

What

  • New config home: the commented-out code read flytepropeller/pkg/controller/config, a v1 dependency v2 deliberately severed. The config now lives on K8sPluginConfig (plugins.k8s.accelerated-inputs) with the same four fields and defaults as the v1 propeller section, so a working v1 config block ports value-for-value.
  • ApplyAcceleratedInputsSpec restored in ApplyFlytePodConfiguration: read-only mount of the union-persistent-data-volume hostPath into the primary container, gated on Enabled.
  • One behavior addition over v1: volume and primary-container mount are checked independently before adding. v1 only ever ran on freshly built specs; v2 has a second caller (fasttask environment builder applying it to SDK-supplied pod templates), so the function must be idempotent and must fill in whichever piece a template is missing.
  • Flag entries hand-added to the generated pflags files in the generator's exact format (pflags tool isn't vendored in this repo).

Testing

  • Restored the previously commented-out AcceleratedInputsEnabled test through ToK8sPodSpec (volume, mount path, read-only).
  • New TestApplyAcceleratedInputsSpec: pre-existing volume without a primary mount gets the mount added without duplicating the volume; repeated application stays at one volume/one mount.
  • Flag round-trip tests for the four new entries.

Consumer-side wiring (leaseworker feeds this config; fasttask builder injection) lands in the cloud repo.

🤖 Generated with Claude Code

https://claude.ai/code/session_01MsS7fjndEwkicFKLcguRpi

The accelerated-inputs pod wiring was commented out when flytek8s was
ported to v2 because it read config from the v1 propeller config
package, which v2 does not depend on.

Give the config a v2-native home on K8sPluginConfig
(plugins.k8s.accelerated-inputs, same fields and defaults as the v1
propeller section) and restore ApplyAcceleratedInputsSpec in
ApplyFlytePodConfiguration. The function matches v1 behavior for
freshly built pod specs, with one addition: the volume and the
primary-container mount are checked independently before adding, so
callers applying it to pre-populated pod templates (fasttask
environment builders) are idempotent and fill in whichever piece is
missing.

Flag entries are hand-added in the generated pflags files following the
generator's output format, since the pflags tool is not vendored here.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01MsS7fjndEwkicFKLcguRpi
Signed-off-by: Paul Dittamo <pvdittamo@gmail.com>
Copilot AI lite review requested due to automatic review settings August 6, 2026 00:52
@github-actions github-actions Bot added the flyte2 label Aug 6, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR restores “accelerated inputs” support in the v2 flytek8s pod construction path by reintroducing the hostPath volume + primary-container mount needed for node-local dataset access, and wiring the feature to the v2 K8sPluginConfig config surface (including flags and tests).

Changes:

  • Gate accelerated-inputs injection on config.GetK8sPluginConfig().AcceleratedInputs.Enabled and apply the mount/volume to the primary container.
  • Introduce K8sPluginConfig.AcceleratedInputs (with defaults) and add corresponding pflags + flag round-trip tests.
  • Add/restore unit tests covering both ToK8sPodSpec behavior and ApplyAcceleratedInputsSpec idempotency.

Reviewed changes

Copilot reviewed 3 out of 5 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
flyteplugins/go/tasks/pluginmachinery/flytek8s/pod_helper.go Restores accelerated-inputs hostPath volume + primary mount injection during pod construction.
flyteplugins/go/tasks/pluginmachinery/flytek8s/pod_helper_test.go Restores/extends tests for accelerated-inputs volume/mount behavior and idempotent application.
flyteplugins/go/tasks/pluginmachinery/flytek8s/config/k8spluginconfig_flags.go Adds CLI flags for the new accelerated-inputs config fields.
flyteplugins/go/tasks/pluginmachinery/flytek8s/config/k8spluginconfig_flags_test.go Adds flag round-trip tests for accelerated-inputs entries.
flyteplugins/go/tasks/pluginmachinery/flytek8s/config/config.go Adds AcceleratedInputs config struct and default values under K8sPluginConfig.
Files not reviewed (2)
  • flyteplugins/go/tasks/pluginmachinery/flytek8s/config/k8spluginconfig_flags.go: Generated file
  • flyteplugins/go/tasks/pluginmachinery/flytek8s/config/k8spluginconfig_flags_test.go: Generated file

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +1174 to +1187
hasMount := false
for _, mount := range cont.VolumeMounts {
if mount.Name == acceleratedInputsVolumeName {
hasMount = true
break
}
}
if !hasMount {
spec.Containers[i].VolumeMounts = append(cont.VolumeMounts, v1.VolumeMount{
Name: acceleratedInputsVolumeName,
ReadOnly: true,
MountPath: cfg.LocalPathPrefix,
})
}
Comment on lines +318 to +321
Enabled bool `json:"enabled" pflag:",Enabled accelerated inputs feature which overwrites remote artifacts path to local disk paths"`
RemotePathPrefix string `json:"remote-path-prefix" pflag:",Remote path prefix that should be replaced with local path prefix"`
LocalPathPrefix string `json:"local-path-prefix" pflag:",Path to locally mounted directory k8s pod"`
VolumePath string `json:"volume-path" pflag:",Path to locally mounted directory on k8s host node"`
Comment on lines +1151 to +1169
hasVolume := false
for _, vol := range spec.Volumes {
if vol.Name == acceleratedInputsVolumeName {
hasVolume = true
break
}
}
if !hasVolume {
hostPathType := v1.HostPathDirectory
spec.Volumes = append(spec.Volumes, v1.Volume{
Name: acceleratedInputsVolumeName,
VolumeSource: v1.VolumeSource{
HostPath: &v1.HostPathVolumeSource{
Path: cfg.VolumePath,
Type: &hostPathType,
},
},
})
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants