-
-
Notifications
You must be signed in to change notification settings - Fork 1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: Add additional permissions to Karpenter EKS IRSA role for native node termination handling support #304
Merged
bryantbiggs
merged 8 commits into
terraform-aws-modules:master
from
FernandoMiguel:karpenter-nth
Nov 21, 2022
Merged
Changes from 3 commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
fbc1d13
add new karpenter nth iam policies
FernandoMiguel 1682078
Merge branch 'master' into karpenter-nth
bryantbiggs 9895156
iam reviewed
FernandoMiguel 934284f
add var for karpenter_sqs_queue_arn
FernandoMiguel b98c7c7
docs
FernandoMiguel ca409a0
Merge branch 'master' into karpenter-nth
FernandoMiguel 2fd187a
Merge branch 'master' into karpenter-nth
FernandoMiguel 877ead0
fix: Make SQS permissions optional depending on if an SQS ARN is prov…
bryantbiggs File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -509,24 +509,25 @@ resource "aws_iam_role_policy_attachment" "fsx_lustre_csi" { | |
# Karpenter Controller Policy | ||
################################################################################ | ||
|
||
# curl -fsSL https://karpenter.sh/v0.6.1/getting-started/cloudformation.yaml | ||
# https://github.com/aws/karpenter/blob/502d275cc330fb0f2435b124935c49632146d945/website/content/en/v0.19.0/getting-started/getting-started-with-eksctl/cloudformation.yaml#L34 | ||
data "aws_iam_policy_document" "karpenter_controller" { | ||
count = var.create_role && var.attach_karpenter_controller_policy ? 1 : 0 | ||
|
||
statement { | ||
actions = [ | ||
"ec2:CreateLaunchTemplate", | ||
"ec2:CreateFleet", | ||
"ec2:CreateLaunchTemplate", | ||
"ec2:CreateTags", | ||
"ec2:DescribeLaunchTemplates", | ||
"ec2:DescribeAvailabilityZones", | ||
"ec2:DescribeImages", | ||
"ec2:DescribeImages", | ||
"ec2:DescribeInstances", | ||
"ec2:DescribeSecurityGroups", | ||
"ec2:DescribeSubnets", | ||
"ec2:DescribeInstanceTypes", | ||
"ec2:DescribeInstanceTypeOfferings", | ||
"ec2:DescribeAvailabilityZones", | ||
"ec2:DescribeInstanceTypes", | ||
"ec2:DescribeLaunchTemplates", | ||
"ec2:DescribeSecurityGroups", | ||
"ec2:DescribeSpotPriceHistory", | ||
"ec2:DescribeSubnets", | ||
"pricing:GetProducts", | ||
] | ||
|
||
|
@@ -583,6 +584,19 @@ data "aws_iam_policy_document" "karpenter_controller" { | |
actions = ["iam:PassRole"] | ||
resources = var.karpenter_controller_node_iam_role_arns | ||
} | ||
|
||
statement { | ||
sid = "KarpenterEventPolicySQS" | ||
effect = "Allow" | ||
resources = ["arn:aws:sqs:${data.aws_region.current.name}:${local.account_id}:${var.karpenter_controller_cluster_id}"] | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. lets add a variable for this |
||
|
||
actions = [ | ||
"sqs:DeleteMessage", | ||
"sqs:GetQueueAttributes", | ||
"sqs:GetQueueUrl", | ||
"sqs:ReceiveMessage", | ||
] | ||
} | ||
} | ||
|
||
resource "aws_iam_policy" "karpenter_controller" { | ||
|
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lets make this dynamic if an SQS queue arn is provided
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@bryantbiggs what do you mean with dynamic?
i've already created a var for
karpenter_sqs_queue_arn
and a local