<#7486 feat(executor): configurable default servic...
# flyte-github
a
#7486 feat(executor): configurable default service account for task pods Pull request opened by pingsutw Tracking issue Why are the changes needed? Task pods always ran as the namespace
default
ServiceAccount — the executor's
GetK8sServiceAccount()
returned
""
, so Kubernetes assigned
default
. On EKS that SA typically has no IRSA
eks.amazonaws.com/role-arn
, so task pods get no cloud credentials and fail S3 operations (e.g. downloading the fast-register code bundle) with
403 Forbidden
. The auto-created
default
SA is awkward to annotate via Helm (it pre-exists and Helm won't adopt an unowned resource), so being able to point task pods at an existing, already-annotated ServiceAccount is a cleaner fix. What changes were proposed in this pull request? •
executor/pkg/config/config.go
— add
defaultK8sServiceAccount
to the executor config. Also change
MaxSystemFailures
from
uint32
to `int32`: the pflags generator doesn't support
uint32
, so
config_flags.go
couldn't be regenerated and its flag entry had been hand-added. It's cast back to
uint32
at the reconciler boundary (
executor/setup.go
), where it's compared against the CRD's
Status.SystemFailures uint32
. •
executor/pkg/config/config_flags.go
/
config_flags_test.go
— regenerated via
go generate ./executor/pkg/config/...
(genuine generator output now, including the new
defaultK8sServiceAccount
flag). •
executor/pkg/plugin/task_exec_metadata.go
—
GetK8sServiceAccount()
now resolves: 1. the ServiceAccount on the task's
SecurityContext.RunAs.K8SServiceAccount
if set, 2. else
executor.defaultK8sServiceAccount
, 3. else
""
→ Kubernetes uses the
default
ServiceAccount of the pod's own namespace (unchanged behavior). A deployment can now set e.g.
executor.defaultK8sServiceAccount: <flyte-binary SA>
so task pods run as the chart's IRSA-annotated ServiceAccount.
Note: pointing task pods at the server ServiceAccount grants task code that SA's IAM
role and RBAC. Prefer a dedicated, least-privilege worker ServiceAccount in production;
this option simply makes the account configurable.
How was this patch tested? • Unit test (
TestResolveServiceAccount
): a run-specified SA always wins; with no run SA it falls back to the executor config default (asserted with a non-empty configured value), and resolves to
""
when neither is set. Getters are nil-safe. •
go generate ./executor/pkg/config/...
,
go build ./executor/...
,
go vet
,
gofmt
, and the
config
pflag tests all pass. • Verified live on a dev cluster: with
defaultK8sServiceAccount
set to an IRSA-annotated SA, task pods assume that role and S3 access succeeds. Labels added Check all the applicable boxes • I updated the documentation accordingly. • All new and existing tests passed. • All commits are signed-off. flyteorg/flyte