feat: Add irsa_tag_values variable #2584
Merged
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.
Description
Add
irsa_tag_values
variable for more control over the generated IAM policy.Motivation and Context
This allows karpenter to be used in a setup where the EKS cluster and VPC subnets do not have matching
karpenter.sh/discovery
tags. An example is using an existing VPC and launching multiple EKS clusters for testing with the same VPC.Currently, the
KarpenterIRSA-*
IAM role creates an IAM policy that contains a IAM permission that restrictsec2:RunInstances
,ec2:TerminateInstances
,ec2:DeleteLaunchTemplates
to restrict based onkarpenter.sh/discovery": "${CLUSTER_NAME}"
, something like this:Source:
terraform-aws-eks/modules/karpenter/main.tf
Lines 89 to 115 in 0f9d9fa
So we cannot use an existing VPC with an existing subnet tag. IE: We cannot use VPC with subnet tags
karpenter.sh/discovery=my-subnet-tag
with multiple EKS clusters. Karpenter isn't permitted to successfully launch new nodes, due to the IAM permission assumption.Searched and did not find related issues.
Breaking Changes
Nope
How Has This Been Tested?
examples/*
to demonstrate and validate my change(s)examples/*
projectsRan the examples/karpenter and confirmed it works as a regression test.
Tested with an existing VPC with existing subnet tags, deployed EKS cluster, and deployed karpenter. Something like this:
Scaled up a deployment to trigger Karpenter to add nodes. Confirmed that the nodes register successfully.
pre-commit run -a
on my pull requestClick to see pre-commit run -a results: