Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(msk): add Kafka versions 3.1.1, 3.2.0, and and 3.3.1 #23918

Merged
merged 14 commits into from
Feb 22, 2023
Merged
Show file tree
Hide file tree
Changes from 8 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions packages/@aws-cdk/aws-msk/lib/cluster-version.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,21 @@ export class KafkaVersion {
*/
public static readonly V2_8_1 = KafkaVersion.of('2.8.1');

/**
* Kafka version 3.1.1
*/
public static readonly V3_1_1 = KafkaVersion.of('3.1.1');

/**
* Kafka version 3.2.0
*/
public static readonly V3_2_0 = KafkaVersion.of('3.2.0');

/**
* Kafka version 3.3.1
*/
public static readonly V3_3_1 = KafkaVersion.of('3.3.1');

/**
* Custom cluster version
* @param version custom version number
Expand Down
34 changes: 34 additions & 0 deletions packages/@aws-cdk/aws-msk/test/cluster.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,40 @@ describe('MSK Cluster', () => {
vpc = new ec2.Vpc(stack, 'Vpc');
});

test.each([
[msk.KafkaVersion.V1_1_1, '1.1.1'],
[msk.KafkaVersion.V2_2_1, '2.2.1'],
[msk.KafkaVersion.V2_3_1, '2.3.1'],
[msk.KafkaVersion.V2_4_1_1, '2.4.1.1'],
[msk.KafkaVersion.V2_5_1, '2.5.1'],
[msk.KafkaVersion.V2_6_0, '2.6.0'],
[msk.KafkaVersion.V2_6_1, '2.6.1'],
[msk.KafkaVersion.V2_6_2, '2.6.2'],
[msk.KafkaVersion.V2_6_3, '2.6.3'],
[msk.KafkaVersion.V2_7_0, '2.7.0'],
[msk.KafkaVersion.V2_7_1, '2.7.1'],
[msk.KafkaVersion.V2_7_2, '2.7.2'],
[msk.KafkaVersion.V2_8_0, '2.8.0'],
[msk.KafkaVersion.V2_8_1, '2.8.1'],
[msk.KafkaVersion.V3_1_1, '3.1.1'],
[msk.KafkaVersion.V3_2_0, '3.2.0'],
[msk.KafkaVersion.V3_3_1, '3.3.1'],
],
)('created with expected Kafka version %j', (parameter, result) => {
new msk.Cluster(stack, 'Cluster', {
clusterName: 'cluster',
kafkaVersion: parameter,
vpc,
});

Template.fromStack(stack).hasResource(
'AWS::MSK::Cluster', {},
);
Template.fromStack(stack).hasResourceProperties('AWS::MSK::Cluster', {
KafkaVersion: result,
});
});

test('created with default properties', () => {
new msk.Cluster(stack, 'Cluster', {
clusterName: 'cluster',
Expand Down
13 changes: 13 additions & 0 deletions packages/@aws-cdk/aws-msk/test/integ.cluster.ts
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,19 @@ class FeatureFlagStack extends cdk.Stack {
// Test lazy instance of the AwsCustomResource
new cdk.CfnOutput(this, 'BootstrapBrokers4', { value: cluster3.bootstrapBrokersTls });
new cdk.CfnOutput(this, 'BootstrapBrokers5', { value: cluster3.bootstrapBrokersSaslIam });

const cluster4 = new msk.Cluster(this, 'Cluster_V3_1_1', {
clusterName: 'integ-test-v3_1_1',
kafkaVersion: msk.KafkaVersion.V3_3_1,
vpc,
logging: {
s3: {
bucket: this.bucket,
},
},
removalPolicy: cdk.RemovalPolicy.DESTROY,
});
new cdk.CfnOutput(this, 'BootstrapBrokers6', { value: cluster4.bootstrapBrokersTls });
}
}

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
{
"version": "29.0.0",
"files": {
"1f3c2cfb18e102edc713fe4c4b4d87572f4297ee4a5e80a5960adf526ee9ea28": {
"source": {
"path": "asset.1f3c2cfb18e102edc713fe4c4b4d87572f4297ee4a5e80a5960adf526ee9ea28.bundle",
"packaging": "zip"
},
"destinations": {
"current_account-current_region": {
"bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}",
"objectKey": "1f3c2cfb18e102edc713fe4c4b4d87572f4297ee4a5e80a5960adf526ee9ea28.zip",
"assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}"
}
}
},
"590a48e60582a848d497da5d11a76229c47a402f1783e32eafe9b08e69ca2c50": {
"source": {
"path": "MskLoggingDefaultTestDeployAssertC2F074AF.template.json",
"packaging": "file"
},
"destinations": {
"current_account-current_region": {
"bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}",
"objectKey": "590a48e60582a848d497da5d11a76229c47a402f1783e32eafe9b08e69ca2c50.json",
"assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}"
}
}
}
},
"dockerImages": {}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,175 @@
{
"Resources": {
"AwsApiCallS3listObjectsV2": {
"Type": "Custom::DeployAssert@SdkCallS3listObjectsV2",
"Properties": {
"ServiceToken": {
"Fn::GetAtt": [
"SingletonFunction1488541a7b23466481b69b4408076b81HandlerCD40AE9F",
"Arn"
]
},
"service": "S3",
"api": "listObjectsV2",
"expected": "{\"$ObjectLike\":{\"KeyCount\":1}}",
"parameters": {
"Bucket": {
"Fn::ImportValue": "aws-cdk-msk-integ:ExportsOutputRefLoggingBucket1E5A6F3B2AAAD6ED"
},
"MaxKeys": 1,
"Prefix": {
"Fn::Join": [
"",
[
"AWSLogs/",
{
"Ref": "AWS::AccountId"
},
"/KafkaBrokerLogs"
]
]
}
},
"flattenResponse": "false",
"salt": "1676187604269"
},
"UpdateReplacePolicy": "Delete",
"DeletionPolicy": "Delete"
},
"SingletonFunction1488541a7b23466481b69b4408076b81Role37ABCE73": {
"Type": "AWS::IAM::Role",
"Properties": {
"AssumeRolePolicyDocument": {
"Version": "2012-10-17",
"Statement": [
{
"Action": "sts:AssumeRole",
"Effect": "Allow",
"Principal": {
"Service": "lambda.amazonaws.com"
}
}
]
},
"ManagedPolicyArns": [
{
"Fn::Sub": "arn:${AWS::Partition}:iam::aws:policy/service-role/AWSLambdaBasicExecutionRole"
}
],
"Policies": [
{
"PolicyName": "Inline",
"PolicyDocument": {
"Version": "2012-10-17",
"Statement": [
{
"Action": [
"s3:ListObjectsV2"
],
"Effect": "Allow",
"Resource": [
"*"
]
},
{
"Action": [
"s3:ListBucket"
],
"Effect": "Allow",
"Resource": [
{
"Fn::ImportValue": "aws-cdk-msk-integ:ExportsOutputFnGetAttLoggingBucket1E5A6F3BArn248EC7EA"
}
]
},
{
"Action": [
"s3:GetObject"
],
"Effect": "Allow",
"Resource": [
{
"Fn::Join": [
"",
[
{
"Fn::ImportValue": "aws-cdk-msk-integ:ExportsOutputFnGetAttLoggingBucket1E5A6F3BArn248EC7EA"
},
"/*"
]
]
}
]
}
]
}
}
]
}
},
"SingletonFunction1488541a7b23466481b69b4408076b81HandlerCD40AE9F": {
"Type": "AWS::Lambda::Function",
"Properties": {
"Runtime": "nodejs14.x",
"Code": {
"S3Bucket": {
"Fn::Sub": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}"
},
"S3Key": "1f3c2cfb18e102edc713fe4c4b4d87572f4297ee4a5e80a5960adf526ee9ea28.zip"
},
"Timeout": 120,
"Handler": "index.handler",
"Role": {
"Fn::GetAtt": [
"SingletonFunction1488541a7b23466481b69b4408076b81Role37ABCE73",
"Arn"
]
}
}
}
},
"Outputs": {
"AssertionResultsAwsApiCallS3listObjectsV2": {
"Value": {
"Fn::GetAtt": [
"AwsApiCallS3listObjectsV2",
"assertion"
]
}
}
},
"Parameters": {
"BootstrapVersion": {
"Type": "AWS::SSM::Parameter::Value<String>",
"Default": "/cdk-bootstrap/hnb659fds/version",
"Description": "Version of the CDK Bootstrap resources in this environment, automatically retrieved from SSM Parameter Store. [cdk:skip]"
}
},
"Rules": {
"CheckBootstrapVersion": {
"Assertions": [
{
"Assert": {
"Fn::Not": [
{
"Fn::Contains": [
[
"1",
"2",
"3",
"4",
"5"
],
{
"Ref": "BootstrapVersion"
}
]
}
]
},
"AssertDescription": "CDK bootstrap stack version 6 required. Please run 'cdk bootstrap' with a recent version of the CDK CLI."
}
]
}
}
}
Loading