Skip to content

Commit

Permalink
remove inline elb and cloud watch policy eksctl-io#7139
Browse files Browse the repository at this point in the history
  • Loading branch information
ibnjunaid committed Feb 23, 2024
1 parent 7447691 commit 16d9288
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 33 deletions.
8 changes: 1 addition & 7 deletions pkg/cfn/builder/iam.go
Original file line number Diff line number Diff line change
Expand Up @@ -105,13 +105,7 @@ func (c *ClusterResourceSet) addResourcesForIAM() {
if api.IsSetAndNonEmptyString(c.spec.IAM.ServiceRolePermissionsBoundary) {
role.PermissionsBoundary = gfnt.NewString(*c.spec.IAM.ServiceRolePermissionsBoundary)
}
refSR := c.newResource("ServiceRole", role)
c.rs.attachAllowPolicy("PolicyCloudWatchMetrics", refSR, cloudWatchMetricsStatements())
// These are potentially required for creating load balancers but aren't included in the
// AmazonEKSClusterPolicy
// See https://docs.aws.amazon.com/elasticloadbalancing/latest/userguide/elb-api-permissions.html#required-permissions-v2
// and weaveworks/eksctl#2488
c.rs.attachAllowPolicy("PolicyELBPermissions", refSR, elbStatements())
c.newResource("ServiceRole", role)

c.rs.defineOutputFromAtt(outputs.ClusterServiceRoleARN, "ServiceRole", "Arn", true, func(v string) error {
c.spec.IAM.ServiceRoleARN = &v
Expand Down
26 changes: 0 additions & 26 deletions pkg/cfn/builder/statement.go
Original file line number Diff line number Diff line change
Expand Up @@ -250,32 +250,6 @@ func loadBalancerControllerStatements() []cft.MapOfInterfaces {
}
}

func elbStatements() []cft.MapOfInterfaces {
return []cft.MapOfInterfaces{
{
"Effect": effectAllow,
"Resource": resourceAll,
"Action": []string{
"ec2:DescribeAccountAttributes",
"ec2:DescribeAddresses",
"ec2:DescribeInternetGateways",
},
},
}
}

func cloudWatchMetricsStatements() []cft.MapOfInterfaces {
return []cft.MapOfInterfaces{
{
"Effect": effectAllow,
"Resource": resourceAll,
"Action": []string{
"cloudwatch:PutMetricData",
},
},
}
}

func certManagerHostedZonesStatements() []cft.MapOfInterfaces {
return []cft.MapOfInterfaces{
{
Expand Down

0 comments on commit 16d9288

Please sign in to comment.