microscopic-needle-82602
09/19/2025, 8:52 AMancient-wolf-19325
09/19/2025, 8:52 AMvalues.yaml via the clusterResourceTemplates.inline section. Define a Role and RoleBinding template that uses {{ namespace }} for the namespace, and Flyte's cluster resource manager will create these for each project-domain namespace. Example:
clusterResourceTemplates:
inline:
001_namespace.yaml: |
apiVersion: v1
kind: Namespace
metadata:
name: '{{ namespace }}'
002_serviceaccount.yaml: |
apiVersion: v1
kind: ServiceAccount
metadata:
name: my-sa
namespace: '{{ namespace }}'
003_role.yaml: |
apiVersion: rbac.authorization.k8s.io/v1
kind: Role
metadata:
name: my-role
namespace: '{{ namespace }}'
rules:
- apiGroups: [""]
resources: ["pods"]
verbs: ["get", "list"]
004_rolebinding.yaml: |
apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
metadata:
name: my-rolebinding
namespace: '{{ namespace }}'
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: Role
name: my-role
subjects:
- kind: ServiceAccount
name: my-sa
namespace: '{{ namespace }}'
This ensures each namespace gets its own ServiceAccount, Role, and RoleBinding. For more, see the example in flyte-binary/gke-starter.yaml and flyte-core/values-eks.yaml.
Would you like more detail on how to reference this ServiceAccount in your Flyte tasks?
Sources:
- flyte-binary/gke-starter.yaml
- flyte-core/values-eks.yaml π 0 button π 0 button π‘ Hint: Mention @runllm in the thread for followups.microscopic-needle-82602
09/19/2025, 8:56 AMancient-wolf-19325
09/19/2025, 8:56 AMeks.amazonaws.com/role-arn annotation in your values.yaml under clusterResourceTemplates.inline. Example:
clusterResourceTemplates:
inline:
001_namespace.yaml: |
apiVersion: v1
kind: Namespace
metadata:
name: '{{ namespace }}'
002_serviceaccount.yaml: |
apiVersion: v1
kind: ServiceAccount
metadata:
name: default
namespace: '{{ namespace }}'
annotations:
eks.amazonaws.com/role-arn: '{{ defaultIamRole }}'
Set the defaultIamRole for each namespace in the cluster_resources.customData section, mapping the correct IAM role ARN to each project-domain. See eks-starter.yaml for a full example.
Would you like more detail on how to configure defaultIamRole for each namespace?
Sources:
- flyte-binary/eks-starter.yaml π 0 button π 0 button π‘ Hint: Mention @runllm in the thread for followups.microscopic-needle-82602
09/19/2025, 8:58 AMancient-wolf-19325
09/19/2025, 8:58 AMdefaultIamRole (IAM role ARN) for each namespace (project-domain), set the mapping in the inline.cluster_resources.customData section of your values.yaml. For example:
inline:
cluster_resources:
customData:
- production:
- defaultIamRole:
value: arn:aws:iam::<ACCOUNT_ID>:role/production-flyte-role
- staging:
- defaultIamRole:
value: arn:aws:iam::<ACCOUNT_ID>:role/staging-flyte-role
- development:
- defaultIamRole:
value: arn:aws:iam::<ACCOUNT_ID>:role/development-flyte-role
This ensures that when a new project-domain namespace is created, the ServiceAccount in that namespace is annotated with the correct IAM role ARN. The annotation is referenced in the ServiceAccount template as shown previously. For a complete example, see eks-starter.yaml and values-eks.yaml.
Let me know if you want a step-by-step breakdown or a full sample values.yaml.
Sources:
- flyte-binary/eks-starter.yaml
- flyte-core/values-eks.yaml π 0 button π 0 button π‘ Hint: Mention @runllm in the thread for followups.microscopic-needle-82602
09/19/2025, 9:00 AMancient-wolf-19325
09/19/2025, 9:00 AMproject-a-production, project-b-production) in the customData section under cluster_resources in your values.yaml. For each namespace, set the defaultIamRole to the desired IAM role ARN:
inline:
cluster_resources:
customData:
- project-a-production:
- defaultIamRole:
value: arn:aws:iam::<ACCOUNT_ID>:role/project-a-role
- project-b-production:
- defaultIamRole:
value: arn:aws:iam::<ACCOUNT_ID>:role/project-b-role
This will annotate the ServiceAccount in each namespace with the correct IAM role. See the pattern in eks-starter.yaml and values-eks.yaml.
Would you like a full example including the ServiceAccount template?
Sources:
- flyte-binary/eks-starter.yaml
- flyte-core/values-eks.yaml π 0 button π 0 button π‘ Hint: Mention @runllm in the thread for followups.microscopic-needle-82602
09/19/2025, 9:32 AMancient-wolf-19325
09/19/2025, 9:32 AMpod_template or pod_template_name argument in the @task decorator, referencing a Kubernetes PodTemplate that includes your desired node affinity. This is the recommended approach as of Flyte v1.13.x and later. You define the PodTemplate in your cluster and reference it by name in your task:
from flytekit import task
@task(pod_template_name="my-affinity-podtemplate")
def my_task():
...
Alternatively, for full customization, you can use the Pod task plugin and specify a V1PodSpec with node affinity directly in the task_config (requires flytekitplugins-pod):
from flytekit import task
from flytekitplugins.pod import Pod
from kubernetes.client.models import V1PodSpec, V1Affinity, V1NodeAffinity, V1NodeSelector, V1NodeSelectorTerm, V1NodeSelectorRequirement
affinity = V1Affinity(
node_affinity=V1NodeAffinity(
required_during_scheduling_ignored_during_execution=V1NodeSelector(
node_selector_terms=[
V1NodeSelectorTerm(
match_expressions=[
V1NodeSelectorRequirement(
key="disktype",
operator="In",
values=["ssd"]
)
]
)
]
)
)
)
@task(
task_config=Pod(
pod_spec=V1PodSpec(
affinity=affinity
)
)
)
def my_task():
...
See the Kubernetes task pod configuration guide and flytekitplugins-pod README for details.
Would you like a step-by-step example for your use case?
Sources:
- flytekitplugins-pod README
- Pod plugin example π 0 button π 0 button π‘ Hint: Mention @runllm in the thread for followups.microscopic-needle-82602
09/19/2025, 10:04 AMcluster_resources:
customData:
- production:
- defaultIamRole:
value: <flyte-role>
- staging:
- defaultIamRole:
value: <flyte-role>
- development:
- defaultIamRole:
value: <flyte-role>
- project-a-development:
- defaultIamRole:
value: value-a
@ancient-wolf-19325 my service account in project-a-development is still using the default flyte role, not value aancient-wolf-19325
09/19/2025, 10:04 AMcustomData is keyed by domain (e.g., development, production), not by full namespace like project-a-development. The standard Flyte Helm chart and cluster resource manager expect keys to match the domain, not the full project-domain namespace, so your project-a-development entry may be ignored and the domain-level default is used instead. See flyte-binary/eks-starter.yaml and flyte-core/values-eks.yaml.
If you need project-specific IAM roles, you may need to adjust your cluster resource manager or templates to support project-domain keys, or remove the domain-level default for development so only the project-specific entry is present. Would you like more detail on how to customize this mapping or patch the resource manager?
Sources:
- flyte-binary/eks-starter.yaml
- flyte-core/values-eks.yaml π 0 button π 0 button π‘ Hint: Mention @runllm in the thread for followups.microscopic-needle-82602
09/19/2025, 10:05 AMancient-wolf-19325
09/19/2025, 10:05 AMproject-a-development), you need to ensure that the cluster resource manager and your templates are set up to match on the full project-domain key, not just the domain. By default, Flyteβs cluster resource manager matches on domain first, so if both development and project-a-development are present, the more general development may take precedence.
To force project-specific roles, remove the generic domain-level entry (e.g., - development:) so only the project-specific entry remains for that namespace. Your customData should look like:
cluster_resources:
customData:
- project-a-development:
- defaultIamRole:
value: arn:aws:iam::<ACCOUNT_ID>:role/project-a-role
- project-b-development:
- defaultIamRole:
value: arn:aws:iam::<ACCOUNT_ID>:role/project-b-role
# (repeat for other project-domain combinations)
This way, only the specific mapping is available, and Flyte will annotate the ServiceAccount in project-a-development with the correct IAM role. If you need both domain-level and project-level mappings, you may need to customize the cluster resource manager logic to prefer the more specific key. For more, see the structure in flyte-binary/eks-starter.yaml.
Let me know if you want a step-by-step on customizing the resource manager or a full example.
Sources:
- flyte-binary/eks-starter.yaml
- flyte-core/values-eks.yaml π 0 button π 0 button π‘ Hint: Mention @runllm in the thread for followups.microscopic-needle-82602
09/19/2025, 10:12 AMancient-wolf-19325
09/19/2025, 10:12 AMcustomData. Flyteβs cluster resource manager will use the more specific project-domain mapping if it exists, and fall back to the domain-level default otherwise. For example:
cluster_resources:
customData:
- development:
- defaultIamRole:
value: arn:aws:iam::<ACCOUNT_ID>:role/default-dev-role
- project-a-development:
- defaultIamRole:
value: arn:aws:iam::<ACCOUNT_ID>:role/project-a-role
With this setup, project-a-development will use its custom IAM role, and all other *-development namespaces will use the default. This pattern is shown in flyte-binary/eks-starter.yaml.
Would you like a full example or more details on how the precedence works?
Sources:
- flyte-binary/eks-starter.yaml π 0 button π 0 button π‘ Hint: Mention @runllm in the thread for followups.microscopic-needle-82602
09/19/2025, 10:14 AMancient-wolf-19325
09/19/2025, 10:14 AMproject-a-development) will take precedence over the general domain key (e.g., development) if both are present in customData. This means you can safely specify both, and Flyte will use the project-specific IAM role for project-a-development and the default for all other development namespaces, as shown in flyte-binary/eks-starter.yaml.
Would you like a step-by-step example or more details on how this matching works?
Sources:
- flyte-binary/eks-starter.yaml π 0 button π 0 button π‘ Hint: Mention @runllm in the thread for followups.microscopic-needle-82602
09/19/2025, 10:18 AMancient-wolf-19325
09/19/2025, 10:18 AMdevelopment) is still taking precedence over the project-domain-specific entry (e.g., project-a-development). This is a known limitation discussed in the community, and the matching logic may not support project-domain overrides out-of-the-boxβsee flyte-binary/eks-starter.yaml and related issues.
To work around this, you may need to remove the generic domain entry for development and explicitly list all project-domain combinations that require the default role, or patch the cluster resource manager logic to prefer the more specific key. There is no official support for project-domain override precedence in the default Helm chart or resource manager as of now.
Would you like more detail on possible workarounds or how to patch the resource manager?
Sources:
- flyte-binary/eks-starter.yaml π 0 button π 0 button π‘ Hint: Mention @runllm in the thread for followups.