Repository navigation
fix: apply the run-level service account and security.service_account setting to task pods - #8414
Merged
pingsutw merged 2 commits intoNov 16, 2026
Merged
Conversation
Signed-off-by: Jeff Chung <sh1001309@gmail.com>
Signed-off-by: Jeff Chung <sh1001309@gmail.com>
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
Contributor
Author
pingsutw
approved these changes
Nov 16, 2026
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.
Tracking issue
Closes #8241
Why are the changes needed?
A service account set on a run has no effect on task pods. The value is stored in
RunSpec.security_context.run_as.k8s_service_account, but every pod of the run uses thedefaultservice account. On EKS the pod then has no IRSA role, and the task fails on itsfirst S3 access.
Three entry points are affected:
flyte run --service-account my-sa ...flyte.with_runcontext(service_account="my-sa").run(...)security.service_accountat project or domain scopeThe cause has three parts:
did not copy the run-level value into the task template.
RunSpec. It inherits the run context from theTaskActionof its parent, and the CRD had no service account field.applyRunSettingsdid not applysecurity.service_account.What changes were proposed in this pull request?
The change follows the existing pattern of
PodTemplateName.ServiceAccounttoTaskActionSpec.applyRunSpecToTaskActioncopies the run-level service account from theRunSpecto theTaskAction.inheritRunContextFromParentTaskActioncopies it from the parentTaskAction.applyServiceAccountwrites it into the task template inembedTaskTemplate. A service account set on the task is kept. Other security contextfields (
IamRole,Secrets) are kept. The template is cloned before the write.applyRunSettingsusessecurity.service_accountwhen the run sets noservice account.
How was this patch tested?
Unit tests
actions/k8s:RunSpecto rootTaskAction, parent to child, the rules ofapplyServiceAccount, and the serialized task template.runs/service: four new cases inTestApplyRunSettings.go test ./actions/k8s/ ./runs/service/ ./executor/pkg/plugin/End to end on the devbox
I set up a testing flyte task:
I checked
spec.serviceAccountNameon each pod. The steps are in"Setup process".
mainpodchildpoddefaultdefault--service-accountmy-samy-samy-sawith_runcontextmy-samy-samy-sasettings-sasettings-sasettings-samy-sasettings-samy-samy-sachild:task-samy-sasettings-samy-satask-sachild:task-sasettings-sasettings-satask-sadefaultdefaultLabels
Setup process
Build and start the devbox from this branch.
Create the service accounts. Task pods run in the
flytenamespace on the devbox.Create
wf.py.Start a run for each case.
For the task-level cases, change
childto@env.task(service_account="task-sa").Check the result.
Screenshots
Not applicable. This PR has no UI change.
Check all the applicable boxes
Related PRs
Stack
If you do use
git townto manage PR Stacks, the stack relevant to this PRwill show below. Otherwise, you can ignore this section.
Docs link
Not applicable. This PR does not change the documentation.