Skip to content
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

fixed iam permissions bug for karpenter #7778

Merged
merged 1 commit into from
Jul 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 14 additions & 3 deletions pkg/cfn/builder/karpenter.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,15 @@ const (
ec2DescribeImages = "ec2:DescribeImages"
ec2DescribeSpotPriceHistory = "ec2:DescribeSpotPriceHistory"
// IAM
iamPassRole = "iam:PassRole"
iamCreateServiceLinkedRole = "iam:CreateServiceLinkedRole"
ssmGetParameter = "ssm:GetParameter"
iamPassRole = "iam:PassRole"
iamCreateServiceLinkedRole = "iam:CreateServiceLinkedRole"
iamGetInstanceProfile = "iam:GetInstanceProfile"
iamCreateInstanceProfile = "iam:CreateInstanceProfile"
iamDeleteInstanceProfile = "iam:DeleteInstanceProfile"
iamTagInstanceProfile = "iam:TagInstanceProfile"
iamAddRoleToInstanceProfile = "iam:AddRoleToInstanceProfile"
// SSM
ssmGetParameter = "ssm:GetParameter"
// Pricing
pricingGetProducts = "pricing:GetProducts"
// SQS
Expand Down Expand Up @@ -165,6 +171,11 @@ func (k *KarpenterResourceSet) addResourcesForKarpenter() error {
ec2DescribeSpotPriceHistory,
iamPassRole,
iamCreateServiceLinkedRole,
iamGetInstanceProfile,
iamCreateInstanceProfile,
iamDeleteInstanceProfile,
iamTagInstanceProfile,
iamAddRoleToInstanceProfile,
ssmGetParameter,
pricingGetProducts,
},
Expand Down
15 changes: 15 additions & 0 deletions pkg/cfn/builder/karpenter_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,11 @@ var expectedTemplate = `{
"ec2:DescribeSpotPriceHistory",
"iam:PassRole",
"iam:CreateServiceLinkedRole",
"iam:GetInstanceProfile",
"iam:CreateInstanceProfile",
"iam:DeleteInstanceProfile",
"iam:TagInstanceProfile",
"iam:AddRoleToInstanceProfile",
"ssm:GetParameter",
"pricing:GetProducts"
],
Expand Down Expand Up @@ -262,6 +267,11 @@ var expectedTemplateWithPermissionBoundary = `{
"ec2:DescribeSpotPriceHistory",
"iam:PassRole",
"iam:CreateServiceLinkedRole",
"iam:GetInstanceProfile",
"iam:CreateInstanceProfile",
"iam:DeleteInstanceProfile",
"iam:TagInstanceProfile",
"iam:AddRoleToInstanceProfile",
"ssm:GetParameter",
"pricing:GetProducts"
],
Expand Down Expand Up @@ -424,6 +434,11 @@ var expectedTemplateWithSpotInterruptionQueue = `{
"ec2:DescribeSpotPriceHistory",
"iam:PassRole",
"iam:CreateServiceLinkedRole",
"iam:GetInstanceProfile",
"iam:CreateInstanceProfile",
"iam:DeleteInstanceProfile",
"iam:TagInstanceProfile",
"iam:AddRoleToInstanceProfile",
"ssm:GetParameter",
"pricing:GetProducts"
],
Expand Down