Skip to content

Commit cc957d6

Browse files
authored
feat(eks): support for Kubernetes version 1.24 (#22945)
https://aws.amazon.com/blogs/containers/amazon-eks-now-supports-kubernetes-version-1-24/ <img width="1316" alt="image" src="https://user-images.githubusercontent.com/31543/202288808-8a9693f8-b953-4bd2-9692-f6b8f75355e9.png"> <img width="909" alt="Screen Shot 2022-11-16 at 1 39 22 PM" src="https://user-images.githubusercontent.com/31543/202289586-95bcddf8-6cf5-43b7-82db-b376f231594a.png"> Right in time just before the ReInvent 😄 ✌️ 🚀 ---- ### All Submissions: * [x] Have you followed the guidelines in our [Contributing guide?](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) ### Adding new Unconventional Dependencies: * [ ] This PR adds new unconventional dependencies following the process described [here](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md/#adding-new-unconventional-dependencies) ### New Features * [x] Have you added the new feature to an [integration test](https://github.com/aws/aws-cdk/blob/main/INTEGRATION_TESTS.md)? * [x] Did you use `yarn integ` to deploy the infrastructure and generate the snapshot (i.e. `yarn integ` without `--dry-run`)? *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
1 parent 6224b6d commit cc957d6

File tree

92 files changed

+1366
-288
lines changed

Some content is hidden

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

92 files changed

+1366
-288
lines changed

packages/@aws-cdk/aws-eks/README.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -683,11 +683,11 @@ Only version 1.20 of kubectl is available in `aws-cdk-lib`. If you need a differ
683683
version, you will need to use one of the `@aws-cdk/lambda-layer-kubectl-vXY` packages.
684684

685685
```ts
686-
import { KubectlV23Layer } from '@aws-cdk/lambda-layer-kubectl-v23';
686+
import { KubectlV24Layer } from '@aws-cdk/lambda-layer-kubectl-v24';
687687

688688
const cluster = new eks.Cluster(this, 'hello-eks', {
689-
version: eks.KubernetesVersion.V1_23,
690-
kubectlLayer: new KubectlV23Layer(this, 'kubectl'),
689+
version: eks.KubernetesVersion.V1_24,
690+
kubectlLayer: new KubectlV24Layer(this, 'kubectl'),
691691
});
692692
```
693693

packages/@aws-cdk/aws-eks/lib/cluster.ts

+12
Original file line numberDiff line numberDiff line change
@@ -827,16 +827,19 @@ export class KubernetesVersion {
827827

828828
/**
829829
* Kubernetes version 1.18
830+
* @deprecated Use newer version of EKS
830831
*/
831832
public static readonly V1_18 = KubernetesVersion.of('1.18');
832833

833834
/**
834835
* Kubernetes version 1.19
836+
* @deprecated Use newer version of EKS
835837
*/
836838
public static readonly V1_19 = KubernetesVersion.of('1.19');
837839

838840
/**
839841
* Kubernetes version 1.20
842+
* @deprecated Use newer version of EKS
840843
*/
841844
public static readonly V1_20 = KubernetesVersion.of('1.20');
842845

@@ -863,6 +866,15 @@ export class KubernetesVersion {
863866
*/
864867
public static readonly V1_23 = KubernetesVersion.of('1.23');
865868

869+
/**
870+
* Kubernetes version 1.24
871+
*
872+
* When creating a `Cluster` with this version, you need to also specify the
873+
* `kubectlLayer` property with a `KubectlV24Layer` from
874+
* `@aws-cdk/lambda-layer-kubectl-v24`.
875+
*/
876+
public static readonly V1_24 = KubernetesVersion.of('1.24');
877+
866878
/**
867879
* Custom cluster version
868880
* @param version custom version number

packages/@aws-cdk/aws-eks/package.json

+2-3
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@
8080
},
8181
"license": "Apache-2.0",
8282
"devDependencies": {
83-
"@aws-cdk/lambda-layer-kubectl-v23": "^2.0.1",
83+
"@aws-cdk/lambda-layer-kubectl-v24": "^2.0.27",
8484
"aws-cdk-lib": "2.47.0",
8585
"@aws-cdk/assertions": "0.0.0",
8686
"@aws-cdk/cdk-build-tools": "0.0.0",
@@ -94,8 +94,7 @@
9494
"@types/yaml": "1.9.6",
9595
"aws-sdk": "^2.1211.0",
9696
"cdk8s": "^2.5.46",
97-
"cdk8s-plus-21": "^2.0.0-beta.12",
98-
"cdk8s-plus-23": "2.0.28",
97+
"cdk8s-plus-24": "2.0.28",
9998
"jest": "^27.5.1",
10099
"sinon": "^9.2.4"
101100
},

packages/@aws-cdk/aws-eks/test/cluster.test.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -3030,7 +3030,7 @@ describe('cluster', () => {
30303030
describe('kubectlLayer annotation', () => {
30313031
function message(version: string) {
30323032
return [
3033-
'You created a cluster with Kubernetes Version 1.23 without specifying the kubectlLayer property.',
3033+
`You created a cluster with Kubernetes Version 1.${version} without specifying the kubectlLayer property.`,
30343034
'This may cause failures as the kubectl version provided with aws-cdk-lib is 1.20, which is only guaranteed to be compatible with Kubernetes versions 1.19-1.21.',
30353035
`Please provide a kubectlLayer from @aws-cdk/lambda-layer-kubectl-v${version}.`,
30363036
].join(' ');
@@ -3056,12 +3056,12 @@ describe('cluster', () => {
30563056

30573057
// WHEN
30583058
new eks.Cluster(stack, 'Cluster1', {
3059-
version: eks.KubernetesVersion.V1_23,
3059+
version: eks.KubernetesVersion.V1_24,
30603060
prune: false,
30613061
});
30623062

30633063
// THEN
3064-
Annotations.fromStack(stack).hasWarning('/Stack/Cluster1', message('23'));
3064+
Annotations.fromStack(stack).hasWarning('/Stack/Cluster1', message('24'));
30653065
});
30663066
});
30673067

Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
import * as lambda from '@aws-cdk/aws-lambda';
2-
import { KubectlV23Layer } from '@aws-cdk/lambda-layer-kubectl-v23';
2+
import { KubectlV24Layer } from '@aws-cdk/lambda-layer-kubectl-v24';
33
import { Construct } from 'constructs';
44
import * as eks from '../lib';
55

66
export function getClusterVersionConfig(scope: Construct) {
77
return {
8-
version: eks.KubernetesVersion.V1_23,
8+
version: eks.KubernetesVersion.V1_24,
99
// Crazy type-casting is required because KubectlLayer peer depends on
1010
// types from aws-cdk-lib, but we run integration tests in the @aws-cdk/
1111
// v1-style directory, not in the aws-cdk-lib v2-style directory.
12-
kubectlLayer: new KubectlV23Layer(scope, 'KubectlLayer') as unknown as lambda.ILayerVersion,
12+
kubectlLayer: new KubectlV24Layer(scope, 'KubectlLayer') as unknown as lambda.ILayerVersion,
1313
};
1414
};
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/@aws-cdk/aws-eks/test/integ.alb-controller.js.snapshot/aws-cdk-eks-cluster-alb-controller-test.assets.json

+8-8
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
{
22
"version": "21.0.0",
33
"files": {
4-
"dd8086b05eeea461708bd66ad140d8965ddf70c0e144af871d078fdbddf0a67d": {
4+
"c475180f5b1bbabac165414da13a9b843b111cd3b6d5fae9c954c006640c4064": {
55
"source": {
6-
"path": "asset.dd8086b05eeea461708bd66ad140d8965ddf70c0e144af871d078fdbddf0a67d.zip",
6+
"path": "asset.c475180f5b1bbabac165414da13a9b843b111cd3b6d5fae9c954c006640c4064.zip",
77
"packaging": "file"
88
},
99
"destinations": {
1010
"current_account-current_region": {
1111
"bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}",
12-
"objectKey": "dd8086b05eeea461708bd66ad140d8965ddf70c0e144af871d078fdbddf0a67d.zip",
12+
"objectKey": "c475180f5b1bbabac165414da13a9b843b111cd3b6d5fae9c954c006640c4064.zip",
1313
"assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}"
1414
}
1515
}
@@ -79,15 +79,15 @@
7979
}
8080
}
8181
},
82-
"56b85a7bb756e34ab12549549eb40d34151db41531599e8f2be6c04e8ae66057": {
82+
"2df5a59d801a1efa337d7f2787d401cc48d736faa94d1f42eccad2d88f3ce2e3": {
8383
"source": {
84-
"path": "asset.56b85a7bb756e34ab12549549eb40d34151db41531599e8f2be6c04e8ae66057",
84+
"path": "asset.2df5a59d801a1efa337d7f2787d401cc48d736faa94d1f42eccad2d88f3ce2e3",
8585
"packaging": "zip"
8686
},
8787
"destinations": {
8888
"current_account-current_region": {
8989
"bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}",
90-
"objectKey": "56b85a7bb756e34ab12549549eb40d34151db41531599e8f2be6c04e8ae66057.zip",
90+
"objectKey": "2df5a59d801a1efa337d7f2787d401cc48d736faa94d1f42eccad2d88f3ce2e3.zip",
9191
"assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}"
9292
}
9393
}
@@ -144,15 +144,15 @@
144144
}
145145
}
146146
},
147-
"b34518d0799bdecb83d5bfce58b4d697f8e84c71c661d07c5ada561cf577a933": {
147+
"292c4b7414bf1bcfda3b17644a81a5d3696375b3964f62a8c7ddcc77265825fe": {
148148
"source": {
149149
"path": "aws-cdk-eks-cluster-alb-controller-test.template.json",
150150
"packaging": "file"
151151
},
152152
"destinations": {
153153
"current_account-current_region": {
154154
"bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}",
155-
"objectKey": "b34518d0799bdecb83d5bfce58b4d697f8e84c71c661d07c5ada561cf577a933.json",
155+
"objectKey": "292c4b7414bf1bcfda3b17644a81a5d3696375b3964f62a8c7ddcc77265825fe.json",
156156
"assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}"
157157
}
158158
}

packages/@aws-cdk/aws-eks/test/integ.alb-controller.js.snapshot/aws-cdk-eks-cluster-alb-controller-test.template.json

+5-5
Original file line numberDiff line numberDiff line change
@@ -402,9 +402,9 @@
402402
"S3Bucket": {
403403
"Fn::Sub": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}"
404404
},
405-
"S3Key": "dd8086b05eeea461708bd66ad140d8965ddf70c0e144af871d078fdbddf0a67d.zip"
405+
"S3Key": "c475180f5b1bbabac165414da13a9b843b111cd3b6d5fae9c954c006640c4064.zip"
406406
},
407-
"Description": "/opt/kubectl/kubectl 1.23; /opt/helm/helm 3.9",
407+
"Description": "/opt/kubectl/kubectl 1.24; /opt/helm/helm 3.9",
408408
"LicenseInfo": "Apache-2.0"
409409
}
410410
},
@@ -608,7 +608,7 @@
608608
]
609609
},
610610
"Config": {
611-
"version": "1.23",
611+
"version": "1.24",
612612
"roleArn": {
613613
"Fn::GetAtt": [
614614
"ClusterRoleFA261979",
@@ -796,7 +796,7 @@
796796
"OpenIdConnectIssuerUrl"
797797
]
798798
},
799-
"CodeHash": "56b85a7bb756e34ab12549549eb40d34151db41531599e8f2be6c04e8ae66057"
799+
"CodeHash": "2df5a59d801a1efa337d7f2787d401cc48d736faa94d1f42eccad2d88f3ce2e3"
800800
},
801801
"UpdateReplacePolicy": "Delete",
802802
"DeletionPolicy": "Delete"
@@ -1488,7 +1488,7 @@
14881488
"S3Bucket": {
14891489
"Fn::Sub": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}"
14901490
},
1491-
"S3Key": "56b85a7bb756e34ab12549549eb40d34151db41531599e8f2be6c04e8ae66057.zip"
1491+
"S3Key": "2df5a59d801a1efa337d7f2787d401cc48d736faa94d1f42eccad2d88f3ce2e3.zip"
14921492
},
14931493
"Timeout": 900,
14941494
"MemorySize": 128,

packages/@aws-cdk/aws-eks/test/integ.alb-controller.js.snapshot/manifest.json

+5-2
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
"validateOnSynth": false,
1818
"assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-deploy-role-${AWS::AccountId}-${AWS::Region}",
1919
"cloudFormationExecutionRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-cfn-exec-role-${AWS::AccountId}-${AWS::Region}",
20-
"stackTemplateAssetObjectUrl": "s3://cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}/b34518d0799bdecb83d5bfce58b4d697f8e84c71c661d07c5ada561cf577a933.json",
20+
"stackTemplateAssetObjectUrl": "s3://cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}/292c4b7414bf1bcfda3b17644a81a5d3696375b3964f62a8c7ddcc77265825fe.json",
2121
"requiresBootstrapStackVersion": 6,
2222
"bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version",
2323
"additionalDependencies": [
@@ -162,7 +162,10 @@
162162
"/aws-cdk-eks-cluster-alb-controller-test/KubectlLayer/Resource": [
163163
{
164164
"type": "aws:cdk:logicalId",
165-
"data": "KubectlLayer600207B5"
165+
"data": "KubectlLayer600207B5",
166+
"trace": [
167+
"!!DESTRUCTIVE_CHANGES: WILL_REPLACE"
168+
]
166169
}
167170
],
168171
"/aws-cdk-eks-cluster-alb-controller-test/Cluster/Role/Resource": [

0 commit comments

Comments
 (0)