<#7563 fix(apps): run app pods under a configurabl...
# flyte-github
a
#7563 fix(apps): run app pods under a configurable service account Pull request opened by pingsutw Why are the changes needed? The app deployment controller (
app/internal/k8s/app_client.go
) builds the Knative pod spec without setting
serviceAccountName
, so every app pod runs under its namespace's
default
ServiceAccount. On clusters that use IRSA (EKS), the
default
SA has no
eks.amazonaws.com/role-arn
annotation, so the pod-identity webhook injects no
AWS_REGION
and no credentials
. The object-store client (obstore) then defaults to
us-east-1
, and an app whose bucket lives in another region fails to download its own code bundle:
Copy code
Generic S3 error: Error performing HEAD https://s3.us-east-1.amazonaws.com/<bucket>/... -
Received redirect without LOCATION, this normally indicates an incorrectly configured region
Task pods already avoid this via `executor.defaultK8sServiceAccount`; apps had no equivalent. What changes were proposed in this pull request? •
app/internal/k8s/app_client.go
—
buildKService
now sets
PodSpec.ServiceAccountName
, preferring the app's own security context (
spec.security_context.run_as.k8s_service_account
) and falling back to the new config default. •
app/config/config.go
— add
InternalAppConfig.DefaultServiceAccount
(
internalApps.defaultServiceAccount
). Empty preserves the old behavior (namespace
default
SA). Deployments set
internalApps.defaultServiceAccount
to the flyte service account (which carries the IRSA role) so app pods get cloud credentials/region. How was this patch tested? •
go build ./app/...
and
app/internal/k8s
tests pass. • Live on the
flyte-development
EKS/ALB cluster: before, the streamlit app pod ran under SA
default
(no IRSA) and CrashLoopBackOff'd with the S3 region error. After deploying this change with
internalApps.defaultServiceAccount: flyte2
, a new revision's pod runs under SA
flyte2
with
AWS_REGION=us-east-2
and
AWS_ROLE_ARN=...flyte-binary
injected, and starts cleanly (2/2 Running). Labels • fixed Check all the applicable boxes • I updated the documentation accordingly. • All new and existing tests passed. • All commits are signed-off. flyteorg/flyte