Skip to content

[Flyteconnector] Construct pod spec and render arguments#7270

Merged
Sovietaced merged 2 commits into
flyteorg:masterfrom
madiyar-wayve:madiyar/flyteconnector-construct-k8s-pod-spec
Apr 27, 2026
Merged

[Flyteconnector] Construct pod spec and render arguments#7270
Sovietaced merged 2 commits into
flyteorg:masterfrom
madiyar-wayve:madiyar/flyteconnector-construct-k8s-pod-spec

Conversation

@madiyar-wayve
Copy link
Copy Markdown

Tracking issue

Closes: #7227.

Why are the changes needed?

The Flyte connector (and agent) webapi plugins don't build a K8s pod spec and render command arguments when the task template target is K8sPod instead of Container. As a result, agents executing k8s_pod_task workloads receive literal template placeholders like {{.input}} and {{.outputPrefix}} instead of resolved values, causing the task to fail. The plugin should construct the pod spec and render arguments for K8sPod targets, just like it already does for Container targets.

What changes were proposed in this pull request?

In the Create method of both flyteplugins/go/tasks/plugins/webapi/agent/plugin.go and .../connector/plugin.go, handle the K8sPod target in addition to Container:

  • Cast webapi.TaskExecutionContext to core.TaskExecutionContext and call flytek8s.ToK8sPodSpec(...) to build a fully rendered pod spec.
  • Marshal the rendered PodSpec into a structpb.Struct, temporarily swap it onto taskTemplate.GetK8SPod().PodSpec for the CreateTaskRequest, and restore the original via defer (mirroring the existing container-args pattern).

How was this patch tested?

Added an end-to-end test run a k8s_pod task with rendered template args in both agent/integration_test.go and connector/integration_test.go. The test submits a K8sPod template with {{.input}} / {{.outputPrefix}} in container args and uses a mock.MatchedBy matcher on CreateTask to assert the received pod spec contains no {{ placeholders; a fallback expectation fails the test if an unrendered request slips through.

Labels

  • fixed — K8sPod targets now get their pod spec built and args rendered in the agent/connector webapi plugins.

Setup process

N/A

Screenshots

N/A

Check all the applicable boxes

  • I updated the documentation accordingly.
  • All new and existing tests passed.
  • All commits are signed-off.

@davidmirror-ops
Copy link
Copy Markdown
Contributor

thanks @madiyar-wayve. Could you fix the DCO test?

@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 24, 2026

Codecov Report

❌ Patch coverage is 60.00000% with 12 lines in your changes missing coverage. Please review.
✅ Project coverage is 56.96%. Comparing base (c283e7e) to head (00d1ad7).
⚠️ Report is 1 commits behind head on master.

Files with missing lines Patch % Lines
...yteplugins/go/tasks/plugins/webapi/agent/plugin.go 60.00% 3 Missing and 3 partials ⚠️
...lugins/go/tasks/plugins/webapi/connector/plugin.go 60.00% 3 Missing and 3 partials ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##           master    #7270   +/-   ##
=======================================
  Coverage   56.96%   56.96%           
=======================================
  Files         931      931           
  Lines       58247    58277   +30     
=======================================
+ Hits        33179    33198   +19     
- Misses      22014    22019    +5     
- Partials     3054     3060    +6     
Flag Coverage Δ
unittests-datacatalog 53.51% <ø> (ø)
unittests-flyteadmin 53.15% <ø> (ø)
unittests-flytecopilot 43.06% <ø> (ø)
unittests-flytectl 64.09% <ø> (ø)
unittests-flyteidl 75.71% <ø> (ø)
unittests-flyteplugins 60.19% <60.00%> (-0.01%) ⬇️
unittests-flytepropeller 53.71% <ø> (ø)
unittests-flytestdlib 62.61% <ø> (+0.02%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link
Copy Markdown
Member

@pingsutw pingsutw left a comment

Choose a reason for hiding this comment

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

Thanks, looks good to me. there are some unit tests are failing, could you take a look

@madiyar-wayve madiyar-wayve force-pushed the madiyar/flyteconnector-construct-k8s-pod-spec branch from e15a430 to fe0faa4 Compare April 25, 2026 10:04
@madiyar-wayve
Copy link
Copy Markdown
Author

madiyar-wayve commented Apr 25, 2026

@pingsutw thanks for taking a look! I fixed lint and DCO tests, can you re-run the tests please?

@Sovietaced Sovietaced merged commit 89a0846 into flyteorg:master Apr 27, 2026
48 checks passed
@welcome
Copy link
Copy Markdown

welcome Bot commented Apr 27, 2026

Congrats on merging your first pull request! 🎉

nuthalapativarun pushed a commit to nuthalapativarun/flyte that referenced this pull request May 1, 2026
Signed-off-by: madiyar-wayve <[email protected]>
Co-authored-by: Jason Parraga <[email protected]>
Signed-off-by: Varun Nuthalapati <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] Construct k8s pod in connector/agent plugin

4 participants