Open
Description
Describe the bug
Currently a Role resource, can only use either policies
or PolicyRefs
. PolicyRefs
would come from customer managed policies that are also created in the cluster while policies
would be AWS managed policies. When trying to use both, the following error is thrown:
status:
conditions:
- lastTransitionTime: "2025-04-09T21:58:24Z"
message: Reference resolution failed
reason: 'both resource reference wrapper and ID cannot be used together: Policies,PolicyRefs'
status: Unknown
type: ACK.ReferencesResolved
Steps to reproduce
apiVersion: iam.services.k8s.aws/v1alpha1
kind: Role
metadata:
name: karpenter-node
namespace: karpenter-system
spec:
assumeRolePolicyDocument: |
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "EKSNodeAssumeRole",
"Effect": "Allow",
"Principal": {
"Service": "ec2.amazonaws.com"
},
"Action": "sts:AssumeRole"
}
]
}
name: karpenter-node
policies:
- AmazonEC2ContainerRegistryReadOnly
- AmazonEKS_CNI_Policy
- AmazonEKSWorkerNodePolicy
policyRefs:
- from:
name: karpenter-node
namespace: karpenter-system
Expected outcome
I would expect, similar to in the AWS console, a IAM Role can use both customer managed and AWS managed policies.
Environment
- Kubernetes version
1.31
- Using EKS (yes/no), if so version?
v1.31.6-eks-bc803b4
- AWS service targeted (S3, RDS, etc.)
- IAM