Skip to content

Commit

Permalink
eks*: remove "AmazonEKSServicePolicy" from EKS cluster role
Browse files Browse the repository at this point in the history
Signed-off-by: Gyuho Lee <[email protected]>
  • Loading branch information
gyuho committed Jun 2, 2021
1 parent 7bed9d8 commit 8fe9e9b
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 8 deletions.
6 changes: 4 additions & 2 deletions eks/cluster/role.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ Parameters:
RoleManagedPolicyARNs:
Type: CommaDelimitedList
Default: 'arn:aws:iam::aws:policy/AmazonEKSServicePolicy,arn:aws:iam::aws:policy/AmazonEKSClusterPolicy,arn:aws:iam::aws:policy/AmazonSSMFullAccess,arn:aws:iam::aws:policy/AmazonS3FullAccess,arn:aws:iam::aws:policy/AmazonEKSWorkerNodePolicy,arn:aws:iam::aws:policy/AmazonEKS_CNI_Policy,arn:aws:iam::aws:policy/AmazonEC2ContainerRegistryReadOnly,arn:aws:iam::aws:policy/ElasticLoadBalancingFullAccess'
Default: 'arn:aws:iam::aws:policy/AmazonEKSClusterPolicy,arn:aws:iam::aws:policy/AmazonSSMFullAccess,arn:aws:iam::aws:policy/AmazonS3FullAccess,arn:aws:iam::aws:policy/AmazonEKSWorkerNodePolicy,arn:aws:iam::aws:policy/AmazonEKS_CNI_Policy,arn:aws:iam::aws:policy/AmazonEC2ContainerRegistryReadOnly,arn:aws:iam::aws:policy/ElasticLoadBalancingFullAccess'
Description: EKS Role managed policy ARNs
Resources:
Expand Down Expand Up @@ -211,6 +211,9 @@ Outputs:
`

// Prior to April 16, 2020, AmazonEKSServicePolicy was also required and the suggested name was eksServiceRole. With the AWSServiceRoleForAmazonEKS service-linked role, that policy is no longer required for clusters created on or after April 16, 2020.
// ref. https://docs.aws.amazon.com/eks/latest/userguide/service_IAM_role.html

func (ts *tester) createClusterRole() error {
fmt.Printf(ts.cfg.EKSConfig.Colorize("\n\n[yellow]*********************************\n"))
fmt.Printf(ts.cfg.EKSConfig.Colorize("[light_green]createClusterRole [default](%q)\n"), ts.cfg.EKSConfig.ConfigPath)
Expand All @@ -223,7 +226,6 @@ func (ts *tester) createClusterRole() error {
ts.cfg.EKSConfig.Parameters.RoleName,
[]string{"eks.amazonaws.com"},
[]string{
"arn:aws:iam::aws:policy/AmazonEKSServicePolicy",
"arn:aws:iam::aws:policy/AmazonEKSClusterPolicy",
},
)
Expand Down
2 changes: 1 addition & 1 deletion eks/mng/role.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ Parameters:
RoleManagedPolicyARNs:
Type: CommaDelimitedList
Default: 'arn:aws:iam::aws:policy/AmazonEKSServicePolicy,arn:aws:iam::aws:policy/AmazonEKSClusterPolicy,arn:aws:iam::aws:policy/AmazonSSMFullAccess,arn:aws:iam::aws:policy/AmazonS3FullAccess,arn:aws:iam::aws:policy/AmazonEKSWorkerNodePolicy,arn:aws:iam::aws:policy/AmazonEKS_CNI_Policy,arn:aws:iam::aws:policy/AmazonEC2ContainerRegistryReadOnly,arn:aws:iam::aws:policy/CloudWatchAgentServerPolicy,arn:aws:iam::aws:policy/ElasticLoadBalancingFullAccess,arn:aws:iam::aws:policy/AmazonEKSFargatePodExecutionRolePolicy'
Default: 'arn:aws:iam::aws:policy/AmazonEKSClusterPolicy,arn:aws:iam::aws:policy/AmazonSSMFullAccess,arn:aws:iam::aws:policy/AmazonS3FullAccess,arn:aws:iam::aws:policy/AmazonEKSWorkerNodePolicy,arn:aws:iam::aws:policy/AmazonEKS_CNI_Policy,arn:aws:iam::aws:policy/AmazonEC2ContainerRegistryReadOnly,arn:aws:iam::aws:policy/CloudWatchAgentServerPolicy,arn:aws:iam::aws:policy/ElasticLoadBalancingFullAccess,arn:aws:iam::aws:policy/AmazonEKSFargatePodExecutionRolePolicy'
Description: EKS Managed Node Group managed policy ARNs
Resources:
Expand Down
2 changes: 1 addition & 1 deletion eks/ng/role.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ Parameters:
RoleManagedPolicyARNs:
Type: CommaDelimitedList
Default: 'arn:aws:iam::aws:policy/AmazonEKSServicePolicy,arn:aws:iam::aws:policy/AmazonEKSClusterPolicy,arn:aws:iam::aws:policy/AmazonSSMFullAccess,arn:aws:iam::aws:policy/AmazonS3FullAccess,arn:aws:iam::aws:policy/AmazonEKSWorkerNodePolicy,arn:aws:iam::aws:policy/AmazonEKS_CNI_Policy,arn:aws:iam::aws:policy/AmazonEC2ContainerRegistryReadOnly,arn:aws:iam::aws:policy/CloudWatchAgentServerPolicy,arn:aws:iam::aws:policy/ElasticLoadBalancingFullAccess,arn:aws:iam::aws:policy/AmazonEKSFargatePodExecutionRolePolicy'
Default: 'arn:aws:iam::aws:policy/AmazonEKSClusterPolicy,arn:aws:iam::aws:policy/AmazonSSMFullAccess,arn:aws:iam::aws:policy/AmazonS3FullAccess,arn:aws:iam::aws:policy/AmazonEKSWorkerNodePolicy,arn:aws:iam::aws:policy/AmazonEKS_CNI_Policy,arn:aws:iam::aws:policy/AmazonEC2ContainerRegistryReadOnly,arn:aws:iam::aws:policy/CloudWatchAgentServerPolicy,arn:aws:iam::aws:policy/ElasticLoadBalancingFullAccess,arn:aws:iam::aws:policy/AmazonEKSFargatePodExecutionRolePolicy'
Description: EKS Node Group managed policy ARNs
Resources:
Expand Down
4 changes: 2 additions & 2 deletions eksconfig/add-on-conformance.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,8 @@ type AddOnConformance struct {
SonobuoyRunMode string `json:"sonobuoy-run-mode"`
SonobuoyRunKubeConformanceImage string `json:"sonobuoy-run-kube-conformance-image"`

SonobuoyRunE2eFocus string `json:"sonobuoy-e2e-focus"`
SonobuoyRunE2eSkip string `json:"sonobuoy-e2e-skip"`
SonobuoyRunE2eFocus string `json:"sonobuoy-e2e-focus"`
SonobuoyRunE2eSkip string `json:"sonobuoy-e2e-skip"`

SonobuoyResultTarGzPath string `json:"sonobuoy-result-tar-gz-path" read-only:"true"`
SonobuoyResultTarGzS3Key string `json:"sonobuoy-result-tar-gz-s3-key" read-only:"true"`
Expand Down
3 changes: 1 addition & 2 deletions eksconfig/env_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ spec:
defer os.Unsetenv("AWS_K8S_TESTER_EKS_PARAMETERS_ROLE_ARN")
os.Setenv("AWS_K8S_TESTER_EKS_PARAMETERS_ROLE_SERVICE_PRINCIPALS", "eks.amazonaws.com,eks-beta-pdx.aws.internal,eks-dev.aws.internal")
defer os.Unsetenv("AWS_K8S_TESTER_EKS_PARAMETERS_ROLE_SERVICE_PRINCIPALS")
os.Setenv("AWS_K8S_TESTER_EKS_PARAMETERS_ROLE_MANAGED_POLICY_ARNS", "arn:aws:iam::aws:policy/AmazonEKSServicePolicy,arn:aws:iam::aws:policy/AmazonEKSClusterPolicy,arn:aws:iam::aws:policy/service-role/AmazonEC2RoleforSSM")
os.Setenv("AWS_K8S_TESTER_EKS_PARAMETERS_ROLE_MANAGED_POLICY_ARNS", "arn:aws:iam::aws:policy/AmazonEKSClusterPolicy,arn:aws:iam::aws:policy/service-role/AmazonEC2RoleforSSM")
defer os.Unsetenv("AWS_K8S_TESTER_EKS_PARAMETERS_ROLE_MANAGED_POLICY_ARNS")
os.Setenv("AWS_K8S_TESTER_EKS_PARAMETERS_VERSION", "1.18")
defer os.Unsetenv("AWS_K8S_TESTER_EKS_PARAMETERS_VERSION")
Expand Down Expand Up @@ -771,7 +771,6 @@ spec:
t.Fatalf("unexpected Parameters.RoleServicePrincipals %+v", cfg.Parameters.RoleServicePrincipals)
}
expectedRoleManagedPolicyARNs := []string{
"arn:aws:iam::aws:policy/AmazonEKSServicePolicy",
"arn:aws:iam::aws:policy/AmazonEKSClusterPolicy",
"arn:aws:iam::aws:policy/service-role/AmazonEC2RoleforSSM",
}
Expand Down

0 comments on commit 8fe9e9b

Please sign in to comment.