mirror of
https://github.com/floci-io/floci.git
synced 2026-11-25 23:00:59 -05:00
feat(iam): seed standard EKS cluster and node group managed policies (#1216)
EKS cluster creation and managed node groups attach a set of AWS managed policies that floci did not seed, so GetPolicy / AttachRolePolicy failed with NoSuchEntity (e.g. AmazonEKSClusterPolicy, AmazonEKSVPCResourceController), breaking the terraform-aws-modules/eks module and the EKS console flow. Add the standard set to the seeded catalog (all path "/"): AmazonEKSClusterPolicy, AmazonEKSServicePolicy, AmazonEKSVPCResourceController, AmazonEKSWorkerNodePolicy, AmazonEKS_CNI_Policy. Documented in the IAM managed policy catalog (docs/services/iam.md). Closes #1092
This commit is contained in:
1 parent
ec8e1cf85e
commit
e3c19461db
3 files changed
+44
No files matched your search
@@ -51,6 +51,9 @@ Floci seeds a catalog of commonly-used AWS managed policies at startup. These ar
|
||||
**ECS / EKS execution roles**
|
||||
`AmazonECSTaskExecutionRolePolicy` · `AmazonEKSFargatePodExecutionRolePolicy`
|
||||
|
||||
**EKS cluster & node groups**
|
||||
`AmazonEKSClusterPolicy` · `AmazonEKSServicePolicy` · `AmazonEKSVPCResourceController` · `AmazonEKSWorkerNodePolicy` · `AmazonEKS_CNI_Policy`
|
||||
|
||||
**Other execution roles**
|
||||
`AmazonS3ObjectLambdaExecutionRolePolicy` · `CloudWatchLambdaInsightsExecutionRolePolicy` · `CloudWatchLambdaApplicationSignalsExecutionRolePolicy` · `AWSConfigRulesExecutionRole` · `AWSMSKReplicatorExecutionRole` · `AWS-SSM-DiagnosisAutomation-ExecutionRolePolicy` · `AWS-SSM-RemediationAutomation-ExecutionRolePolicy` · `AmazonSageMakerGeospatialExecutionRole` · `AmazonSageMakerCanvasEMRServerlessExecutionRolePolicy` · `SageMakerStudioBedrockFunctionExecutionRolePolicy` · `SageMakerStudioDomainExecutionRolePolicy` · `SageMakerStudioQueryExecutionRolePolicy` · `AmazonDataZoneDomainExecutionRolePolicy` · `AmazonBedrockAgentCoreMemoryBedrockModelInferenceExecutionRolePolicy` · `AWSPartnerCentralSellingResourceSnapshotJobExecutionRolePolicy`
|
||||
|
||||
|
||||
@@ -72,6 +72,19 @@ final class AwsManagedPolicies {
|
||||
new ManagedPolicyDef("AmazonEKSFargatePodExecutionRolePolicy", "/",
|
||||
"Provides access to other AWS service resources required to run Amazon EKS pods on AWS Fargate."),
|
||||
|
||||
// EKS cluster and node group policies (required by the EKS console/SDK and
|
||||
// the terraform-aws-modules/eks module — see #1092).
|
||||
new ManagedPolicyDef("AmazonEKSClusterPolicy", "/",
|
||||
"Provides Kubernetes the permissions it requires to manage resources on your behalf."),
|
||||
new ManagedPolicyDef("AmazonEKSServicePolicy", "/",
|
||||
"This policy allows Amazon Elastic Container Service for Kubernetes to create and manage the necessary resources to operate EKS Clusters."),
|
||||
new ManagedPolicyDef("AmazonEKSVPCResourceController", "/",
|
||||
"Policy used by VPC Resource Controller to manage ENI and IPs for worker nodes."),
|
||||
new ManagedPolicyDef("AmazonEKSWorkerNodePolicy", "/",
|
||||
"This policy allows Amazon EKS worker nodes to connect to Amazon EKS Clusters."),
|
||||
new ManagedPolicyDef("AmazonEKS_CNI_Policy", "/",
|
||||
"Provides the Amazon VPC CNI Plugin the permissions it requires to modify the IP address configuration on your EKS worker nodes."),
|
||||
|
||||
// S3 Object Lambda execution role policy
|
||||
new ManagedPolicyDef("AmazonS3ObjectLambdaExecutionRolePolicy", "/service-role/",
|
||||
"Provides write permissions to CloudWatch Logs for S3 Object Lambda access points."),
|
||||
|
||||
@@ -6,6 +6,8 @@ import org.junit.jupiter.api.MethodOrderer;
|
||||
import org.junit.jupiter.api.Order;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.junit.jupiter.api.TestMethodOrder;
|
||||
import org.junit.jupiter.params.ParameterizedTest;
|
||||
import org.junit.jupiter.params.provider.ValueSource;
|
||||
|
||||
import static io.restassured.RestAssured.given;
|
||||
import static org.hamcrest.Matchers.*;
|
||||
@@ -149,6 +151,32 @@ class IamIntegrationTest {
|
||||
equalTo("arn:aws:iam::aws:policy/service-role/AWSLambdaBasicExecutionRole"));
|
||||
}
|
||||
|
||||
// The standard EKS managed policies the EKS console/SDK and the
|
||||
// terraform-aws-modules/eks module attach to cluster and node roles (#1092).
|
||||
@ParameterizedTest
|
||||
@Order(6)
|
||||
@ValueSource(strings = {
|
||||
"arn:aws:iam::aws:policy/AmazonEKSClusterPolicy",
|
||||
"arn:aws:iam::aws:policy/AmazonEKSServicePolicy",
|
||||
"arn:aws:iam::aws:policy/AmazonEKSVPCResourceController",
|
||||
"arn:aws:iam::aws:policy/AmazonEKSWorkerNodePolicy",
|
||||
"arn:aws:iam::aws:policy/AmazonEKS_CNI_Policy",
|
||||
})
|
||||
void getEksManagedPolicy(String arn) {
|
||||
String expectedName = arn.substring(arn.lastIndexOf('/') + 1);
|
||||
given()
|
||||
.formParam("Action", "GetPolicy")
|
||||
.formParam("PolicyArn", arn)
|
||||
.header("Authorization",
|
||||
"AWS4-HMAC-SHA256 Credential=test/20260227/us-east-1/iam/aws4_request")
|
||||
.when()
|
||||
.post("/")
|
||||
.then()
|
||||
.statusCode(200)
|
||||
.body("GetPolicyResponse.GetPolicyResult.Policy.PolicyName", equalTo(expectedName))
|
||||
.body("GetPolicyResponse.GetPolicyResult.Policy.Arn", equalTo(arn));
|
||||
}
|
||||
|
||||
@Test
|
||||
@Order(35)
|
||||
void attachManagedPolicyToRole() {
|
||||
|
||||
Reference in new issue
Block a user