Skip to content

Commit b11f663

Browse files
authored
feat(eks): make kubectlLayer property required from optional (#32930)
### Issue #33261 ### Reason for this change `aws-cdk-lib` has a very outdated version of kubectl layer as dependency https://github.com/aws/aws-cdk/blob/main/packages/aws-cdk-lib/package.json#L123. It uses an outdated helm version which is involved in a CVE. The dependency was added because if users do not provide a kubectl layer version for EKS cluster, it will use v20 as the default. CDK itself shouldn't use a specific version of kubectl layer as dependency. To remove the dependency, `kubectlLayer` will become a required property instead of optional. The default version v20 is too old to work with current EKS supported version v24+. However, if you're not using the property, you will see an error saying it's a required property. Please uses a kubectl layer version that's compatible with your cluster. ### Description of changes - Make the property required from options - Update unit tests and integration tests - Remove the dependency of `"@aws-cdk/asset-kubectl-v20": "^2.1.3"` ### Describe any new or updated permissions being added ### Description of how you validated changes unit tests/integration tests ### Checklist - [ ] My code adheres to the [CONTRIBUTING GUIDE](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) and [DESIGN GUIDELINES](https://github.com/aws/aws-cdk/blob/main/docs/DESIGN_GUIDELINES.md) BREAKING CHANGE: `kubectlLayer` property is now required in EKS `Cluster` and `FargateCluster` constructs. The default value for `kubectlLayer` is outdated and hence being removed. You can specify your own kubectlLayer version based on your Kubernetes version. ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
1 parent b481b1c commit b11f663

File tree

95 files changed

+1467
-10880
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

95 files changed

+1467
-10880
lines changed

allowed-breaking-changes.txt

+5
Original file line numberDiff line numberDiff line change
@@ -951,3 +951,8 @@ changed-type:aws-cdk-lib.cx_api.CloudFormationStackArtifact.notificationArns
951951
# See: https://github.com/cdklabs/cloud-assembly-schema/pull/121
952952
weakened:aws-cdk-lib.cloud_assembly_schema.MetadataEntry
953953
weakened:aws-cdk-lib.cx_api.MetadataEntryResult
954+
955+
# Making kubectlLayer prop required from optional so we can remove the outdated kubectl layer dependency
956+
strengthened:aws-cdk-lib.aws_eks.ClusterProps
957+
strengthened:aws-cdk-lib.aws_eks.FargateClusterProps
958+
removed:aws-cdk-lib.lambda_layer_kubectl.KubectlLayer
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/eks/integ.call.js.snapshot/asset.818f9976c0b6e85dd2696d24402c2a177fb2c520d779e1925160a62523c4f20a/index.js

-57
This file was deleted.

packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/eks/integ.call.js.snapshot/asset.aea9e78c19375cc11788e490fdd0d8d90a99fc5509f3ade872bff74980f89265/index.js

+63
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/eks/integ.call.js.snapshot/asset.e35d06c04a5f086530cad7876451b9fbd93ded1d4940950bb104fb78dd322310.zip

-3
This file was deleted.

packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/eks/integ.call.js.snapshot/aws-stepfunctions-tasks-eks-call-integ-test.assets.json

+25-25
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/eks/integ.call.js.snapshot/aws-stepfunctions-tasks-eks-call-integ-test.template.json

+18-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,18 @@
11
{
22
"Resources": {
3+
"KubectlLayer600207B5": {
4+
"Type": "AWS::Lambda::LayerVersion",
5+
"Properties": {
6+
"Content": {
7+
"S3Bucket": {
8+
"Fn::Sub": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}"
9+
},
10+
"S3Key": "f3c812b299b0759c937b41e39d3451f5cc61279c2ec9ee791fac08ba1e56508b.zip"
11+
},
12+
"Description": "/opt/kubectl/kubectl 1.31.0; /opt/helm/helm 3.16.1",
13+
"LicenseInfo": "Apache-2.0"
14+
}
15+
},
316
"EksClusterDefaultVpcB24550B2": {
417
"Type": "AWS::EC2::VPC",
518
"Properties": {
@@ -1069,7 +1082,7 @@
10691082
{
10701083
"Fn::Sub": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}"
10711084
},
1072-
"/a54913636fe5b4da7d6688df19d4289671bfa613357330c6d2763bdc348bff70.json"
1085+
"/9872b5bbc2472c123eca8992b3a909e809b086ffec9316c0e03569748114e0e2.json"
10731086
]
10741087
]
10751088
}
@@ -1081,6 +1094,9 @@
10811094
"Type": "AWS::CloudFormation::Stack",
10821095
"Properties": {
10831096
"Parameters": {
1097+
"referencetoawsstepfunctionstasksekscallintegtestKubectlLayer0B270356Ref": {
1098+
"Ref": "KubectlLayer600207B5"
1099+
},
10841100
"referencetoawsstepfunctionstasksekscallintegtestEksClusterKubectlHandlerRole61616EA6Arn": {
10851101
"Fn::GetAtt": [
10861102
"EksClusterKubectlHandlerRole4A986A70",
@@ -1116,7 +1132,7 @@
11161132
{
11171133
"Fn::Sub": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}"
11181134
},
1119-
"/6d51c8786511521af8e6837a57a53ed89e15e44471b6c7807fb35b537f5cd77e.json"
1135+
"/09fe4c7b9e1c434bd66530aea32cf40f7d4055de2ddbcd0273c5e1300b22a277.json"
11201136
]
11211137
]
11221138
}

packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/eks/integ.call.js.snapshot/awsstepfunctionstasksekscallintegtestawscdkawseksClusterResourceProvider412BC189.nested.template.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@
5050
"S3Bucket": {
5151
"Fn::Sub": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}"
5252
},
53-
"S3Key": "818f9976c0b6e85dd2696d24402c2a177fb2c520d779e1925160a62523c4f20a.zip"
53+
"S3Key": "aea9e78c19375cc11788e490fdd0d8d90a99fc5509f3ade872bff74980f89265.zip"
5454
},
5555
"Description": "onEvent handler for EKS cluster resource provider",
5656
"Environment": {
@@ -123,7 +123,7 @@
123123
"S3Bucket": {
124124
"Fn::Sub": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}"
125125
},
126-
"S3Key": "818f9976c0b6e85dd2696d24402c2a177fb2c520d779e1925160a62523c4f20a.zip"
126+
"S3Key": "aea9e78c19375cc11788e490fdd0d8d90a99fc5509f3ade872bff74980f89265.zip"
127127
},
128128
"Description": "isComplete handler for EKS cluster resource provider",
129129
"Environment": {

packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/eks/integ.call.js.snapshot/awsstepfunctionstasksekscallintegtestawscdkawseksKubectlProvider65D285A0.nested.template.json

+5-14
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
"S3Bucket": {
88
"Fn::Sub": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}"
99
},
10-
"S3Key": "fba306965da4b2680dd8b4e6916610efe237162f913f22b10146f647b3f6bce4.zip"
10+
"S3Key": "024d0b8c5d7cf69ece484efe22f1647e273f484175ef3b79df543b7538da9c81.zip"
1111
},
1212
"Description": "onEvent handler for EKS kubectl resource provider",
1313
"Environment": {
@@ -21,7 +21,7 @@
2121
"Ref": "AwsCliLayerF44AAF94"
2222
},
2323
{
24-
"Ref": "KubectlLayer600207B5"
24+
"Ref": "referencetoawsstepfunctionstasksekscallintegtestKubectlLayer0B270356Ref"
2525
}
2626
],
2727
"MemorySize": 1024,
@@ -59,18 +59,6 @@
5959
"Description": "/opt/awscli/aws"
6060
}
6161
},
62-
"KubectlLayer600207B5": {
63-
"Type": "AWS::Lambda::LayerVersion",
64-
"Properties": {
65-
"Content": {
66-
"S3Bucket": {
67-
"Fn::Sub": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}"
68-
},
69-
"S3Key": "e35d06c04a5f086530cad7876451b9fbd93ded1d4940950bb104fb78dd322310.zip"
70-
},
71-
"Description": "/opt/kubectl/kubectl and /opt/helm/helm"
72-
}
73-
},
7462
"ProviderframeworkonEventServiceRole9FF04296": {
7563
"Type": "AWS::IAM::Role",
7664
"Properties": {
@@ -360,6 +348,9 @@
360348
}
361349
},
362350
"Parameters": {
351+
"referencetoawsstepfunctionstasksekscallintegtestKubectlLayer0B270356Ref": {
352+
"Type": "String"
353+
},
363354
"referencetoawsstepfunctionstasksekscallintegtestEksClusterKubectlHandlerRole61616EA6Arn": {
364355
"Type": "String"
365356
},

0 commit comments

Comments
 (0)