Skip to content

Commit aa6ad47

Browse files
committed
feat(aws-cdk): Set all storage types to S3 and wire IRSA annotation to service account
1 parent 61d1ad0 commit aa6ad47

File tree

3 files changed

+43
-6
lines changed

3 files changed

+43
-6
lines changed

tools/deployment/aws-cdk/lib/clp-stack.ts

Lines changed: 22 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,15 @@ export class ClpStack extends cdk.Stack {
5858
})
5959
);
6060

61+
// S3 config shared by archive_output, stream_output, and logs_input
62+
const s3AuthConfig = {
63+
aws_authentication: {
64+
type: "default", // Uses the SDK credential chain (picks up IRSA)
65+
},
66+
region_code: this.region,
67+
bucket: archiveBucket.bucketName,
68+
};
69+
6170
// Deploy CLP Helm chart
6271
new eks.HelmChart(this, "ClpHelmChart", {
6372
cluster,
@@ -70,13 +79,23 @@ export class ClpStack extends cdk.Stack {
7079
storage: {
7180
storageClassName: "gp3",
7281
},
82+
serviceAccount: {
83+
annotations: {
84+
"eks.amazonaws.com/role-arn": s3AccessRole.roleArn,
85+
},
86+
},
7387
clpConfig: {
88+
logs_input: {
89+
type: "s3",
90+
aws_authentication: {
91+
type: "default",
92+
},
93+
},
7494
archive_output: {
7595
storage: {
7696
type: "s3",
7797
s3_config: {
78-
region: this.region,
79-
bucket: archiveBucket.bucketName,
98+
...s3AuthConfig,
8099
key_prefix: "archives/",
81100
},
82101
},
@@ -85,8 +104,7 @@ export class ClpStack extends cdk.Stack {
85104
storage: {
86105
type: "s3",
87106
s3_config: {
88-
region: this.region,
89-
bucket: archiveBucket.bucketName,
107+
...s3AuthConfig,
90108
key_prefix: "streams/",
91109
},
92110
},

tools/deployment/aws-cdk/scripts/push-images-to-ecr.sh

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ AWS_REGION="${2:-$(aws configure get region || echo us-east-2)}"
1212
ECR_REGISTRY="${AWS_ACCOUNT_ID}.dkr.ecr.${AWS_REGION}.amazonaws.com"
1313

1414
# CLP package image -- uses the tag from Chart.yaml appVersion
15-
CLP_TAG="${CLP_TAG:-0.9.1-dev}"
15+
CLP_TAG="${CLP_TAG:-0.9.0}"
1616
CLP_SOURCE="${CLP_SOURCE:-ghcr.io/y-scope/clp/clp-package:${CLP_TAG}}"
1717

1818
# Third-party images used by the Helm chart (hardcoded in templates today)
@@ -22,7 +22,9 @@ declare -A IMAGES=(
2222
["clp/mongo:7.0.1"]="mongo:7.0.1"
2323
["clp/rabbitmq:3.9.8"]="rabbitmq:3.9.8"
2424
["clp/redis:7.2.4"]="redis:7.2.4"
25-
["clp/kubectl:1.32.0"]="bitnami/kubectl:1.32.0"
25+
# bitnami/kubectl only publishes "latest" on Docker Hub; we pin the ECR tag
26+
# to the K8s version used by EKS so our reference is fixed.
27+
["clp/kubectl:1.32"]="bitnami/kubectl:latest"
2628
)
2729

2830
echo "==> Authenticating Docker to ECR (${ECR_REGISTRY})"

tools/deployment/aws-cdk/test/clp-stack.test.ts

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,11 +92,28 @@ describe("ClpStack", () => {
9292
expect(values).toHaveProperty("storage.storageClassName", "gp3");
9393
});
9494

95+
test("Helm values set logs_input type to s3", () => {
96+
const values = getHelmValues(template);
97+
expect(values).toHaveProperty("clpConfig.logs_input.type", "s3");
98+
});
99+
95100
test("Helm values reference S3 bucket for archive output", () => {
96101
const values = getHelmValues(template);
97102
expect(values).toHaveProperty("clpConfig.archive_output.storage.type", "s3");
98103
});
99104

105+
test("Helm values reference S3 bucket for stream output", () => {
106+
const values = getHelmValues(template);
107+
expect(values).toHaveProperty("clpConfig.stream_output.storage.type", "s3");
108+
});
109+
110+
test("Helm values set IRSA annotation on service account", () => {
111+
const values = getHelmValues(template);
112+
const sa = (values as any).serviceAccount;
113+
expect(sa).toBeDefined();
114+
expect(sa.annotations).toHaveProperty("eks.amazonaws.com/role-arn");
115+
});
116+
100117
test("IRSA role for S3 access is created", () => {
101118
template.hasResourceProperties("AWS::IAM::Role", {
102119
AssumeRolePolicyDocument: Match.objectLike({

0 commit comments

Comments
 (0)