From f6133857a7892b979f44ea65781663c2bbdffe6d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nick=20J=C3=BCttner?= Date: Wed, 8 Nov 2023 16:09:18 +0100 Subject: [PATCH] fix --- controllers/common_test.go | 8 ++++---- pkg/iam/cluster_autoscaler_template.go | 8 ++++---- pkg/iam/iam.go | 6 ------ 3 files changed, 8 insertions(+), 14 deletions(-) diff --git a/controllers/common_test.go b/controllers/common_test.go index 015f106a..6ce771d6 100644 --- a/controllers/common_test.go +++ b/controllers/common_test.go @@ -562,6 +562,7 @@ var clusterAutoscalerRoleInfo = RoleInfo{ "Version": "2012-10-17", "Statement": [ { + "Effect": "Allow", "Action": [ "autoscaling:DescribeAutoScalingGroups", "autoscaling:DescribeAutoScalingInstances", @@ -571,10 +572,10 @@ var clusterAutoscalerRoleInfo = RoleInfo{ "ec2:DescribeInstanceTypes", "ec2:DescribeLaunchTemplateVersions", ], - "Resource": "*", - "Effect": "Allow" + "Resource": "*" }, { + "Effect": "Allow", "Action": [ "autoscaling:SetDesiredCapacity", "autoscaling:TerminateInstanceInAutoScalingGroup", @@ -582,8 +583,7 @@ var clusterAutoscalerRoleInfo = RoleInfo{ "ec2:GetInstanceTypesFromInstanceRequirements", "eks:DescribeNodegroup" ], - "Resource": "*", - "Effect": "Allow" + "Resource": "*" } ] }`, diff --git a/pkg/iam/cluster_autoscaler_template.go b/pkg/iam/cluster_autoscaler_template.go index d1b1239d..bae092ea 100644 --- a/pkg/iam/cluster_autoscaler_template.go +++ b/pkg/iam/cluster_autoscaler_template.go @@ -4,6 +4,7 @@ const clusterAutoscalerPolicyTemplate = `{ "Version": "2012-10-17", "Statement": [ { + "Effect": "Allow", "Action": [ "autoscaling:DescribeAutoScalingGroups", "autoscaling:DescribeAutoScalingInstances", @@ -13,10 +14,10 @@ const clusterAutoscalerPolicyTemplate = `{ "ec2:DescribeInstanceTypes", "ec2:DescribeLaunchTemplateVersions", ], - "Resource": "*", - "Effect": "Allow" + "Resource": "*" }, { + "Effect": "Allow", "Action": [ "autoscaling:SetDesiredCapacity", "autoscaling:TerminateInstanceInAutoScalingGroup", @@ -24,8 +25,7 @@ const clusterAutoscalerPolicyTemplate = `{ "ec2:GetInstanceTypesFromInstanceRequirements", "eks:DescribeNodegroup" ], - "Resource": "*", - "Effect": "Allow" + "Resource": "*" } ] }` diff --git a/pkg/iam/iam.go b/pkg/iam/iam.go index d7660b73..40547b93 100644 --- a/pkg/iam/iam.go +++ b/pkg/iam/iam.go @@ -458,12 +458,6 @@ func (s *IAMService) DeleteRolesForIRSA() error { return err } - // delete cluster-autoscaler role - err = s.deleteRole(roleName(ClusterAutoscalerRole, s.clusterName)) - if err != nil { - return err - } - s.log.Info("finished deleting IAM roles for IRSA") return nil }