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(eks): support for Kubernetes version 1.24 #22945

Merged
merged 5 commits into from
Nov 23, 2022
Merged
Show file tree
Hide file tree
Changes from all 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
6 changes: 3 additions & 3 deletions packages/@aws-cdk/aws-eks/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -683,11 +683,11 @@ Only version 1.20 of kubectl is available in `aws-cdk-lib`. If you need a differ
version, you will need to use one of the `@aws-cdk/lambda-layer-kubectl-vXY` packages.

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

const cluster = new eks.Cluster(this, 'hello-eks', {
version: eks.KubernetesVersion.V1_23,
kubectlLayer: new KubectlV23Layer(this, 'kubectl'),
version: eks.KubernetesVersion.V1_24,
kubectlLayer: new KubectlV24Layer(this, 'kubectl'),
});
```

Expand Down
12 changes: 12 additions & 0 deletions packages/@aws-cdk/aws-eks/lib/cluster.ts
Original file line number Diff line number Diff line change
Expand Up @@ -827,16 +827,19 @@ export class KubernetesVersion {

/**
* Kubernetes version 1.18
* @deprecated Use newer version of EKS
*/
public static readonly V1_18 = KubernetesVersion.of('1.18');

/**
* Kubernetes version 1.19
* @deprecated Use newer version of EKS
*/
public static readonly V1_19 = KubernetesVersion.of('1.19');

/**
* Kubernetes version 1.20
* @deprecated Use newer version of EKS
*/
public static readonly V1_20 = KubernetesVersion.of('1.20');

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

/**
* Kubernetes version 1.24
*
* When creating a `Cluster` with this version, you need to also specify the
* `kubectlLayer` property with a `KubectlV24Layer` from
* `@aws-cdk/lambda-layer-kubectl-v24`.
*/
public static readonly V1_24 = KubernetesVersion.of('1.24');

/**
* Custom cluster version
* @param version custom version number
Expand Down
5 changes: 2 additions & 3 deletions packages/@aws-cdk/aws-eks/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@
},
"license": "Apache-2.0",
"devDependencies": {
"@aws-cdk/lambda-layer-kubectl-v23": "^2.0.1",
"@aws-cdk/lambda-layer-kubectl-v24": "^2.0.27",
"aws-cdk-lib": "2.47.0",
"@aws-cdk/assertions": "0.0.0",
"@aws-cdk/cdk-build-tools": "0.0.0",
Expand All @@ -94,8 +94,7 @@
"@types/yaml": "1.9.6",
"aws-sdk": "^2.1211.0",
"cdk8s": "^2.5.46",
"cdk8s-plus-21": "^2.0.0-beta.12",
"cdk8s-plus-23": "2.0.28",
"cdk8s-plus-24": "2.0.28",
"jest": "^27.5.1",
"sinon": "^9.2.4"
},
Expand Down
6 changes: 3 additions & 3 deletions packages/@aws-cdk/aws-eks/test/cluster.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3030,7 +3030,7 @@ describe('cluster', () => {
describe('kubectlLayer annotation', () => {
function message(version: string) {
return [
'You created a cluster with Kubernetes Version 1.23 without specifying the kubectlLayer property.',
`You created a cluster with Kubernetes Version 1.${version} without specifying the kubectlLayer property.`,
'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.',
`Please provide a kubectlLayer from @aws-cdk/lambda-layer-kubectl-v${version}.`,
].join(' ');
Expand All @@ -3056,12 +3056,12 @@ describe('cluster', () => {

// WHEN
new eks.Cluster(stack, 'Cluster1', {
version: eks.KubernetesVersion.V1_23,
version: eks.KubernetesVersion.V1_24,
prune: false,
});

// THEN
Annotations.fromStack(stack).hasWarning('/Stack/Cluster1', message('23'));
Annotations.fromStack(stack).hasWarning('/Stack/Cluster1', message('24'));
});
});

Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import * as lambda from '@aws-cdk/aws-lambda';
import { KubectlV23Layer } from '@aws-cdk/lambda-layer-kubectl-v23';
import { KubectlV24Layer } from '@aws-cdk/lambda-layer-kubectl-v24';
import { Construct } from 'constructs';
import * as eks from '../lib';

export function getClusterVersionConfig(scope: Construct) {
return {
version: eks.KubernetesVersion.V1_23,
version: eks.KubernetesVersion.V1_24,
// Crazy type-casting is required because KubectlLayer peer depends on
// types from aws-cdk-lib, but we run integration tests in the @aws-cdk/
// v1-style directory, not in the aws-cdk-lib v2-style directory.
kubectlLayer: new KubectlV23Layer(scope, 'KubectlLayer') as unknown as lambda.ILayerVersion,
kubectlLayer: new KubectlV24Layer(scope, 'KubectlLayer') as unknown as lambda.ILayerVersion,
};
};

Large diffs are not rendered by default.

Binary file not shown.
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
{
"version": "21.0.0",
"files": {
"dd8086b05eeea461708bd66ad140d8965ddf70c0e144af871d078fdbddf0a67d": {
"c475180f5b1bbabac165414da13a9b843b111cd3b6d5fae9c954c006640c4064": {
"source": {
"path": "asset.dd8086b05eeea461708bd66ad140d8965ddf70c0e144af871d078fdbddf0a67d.zip",
"path": "asset.c475180f5b1bbabac165414da13a9b843b111cd3b6d5fae9c954c006640c4064.zip",
"packaging": "file"
},
"destinations": {
"current_account-current_region": {
"bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}",
"objectKey": "dd8086b05eeea461708bd66ad140d8965ddf70c0e144af871d078fdbddf0a67d.zip",
"objectKey": "c475180f5b1bbabac165414da13a9b843b111cd3b6d5fae9c954c006640c4064.zip",
"assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}"
}
}
Expand Down Expand Up @@ -79,15 +79,15 @@
}
}
},
"56b85a7bb756e34ab12549549eb40d34151db41531599e8f2be6c04e8ae66057": {
"2df5a59d801a1efa337d7f2787d401cc48d736faa94d1f42eccad2d88f3ce2e3": {
"source": {
"path": "asset.56b85a7bb756e34ab12549549eb40d34151db41531599e8f2be6c04e8ae66057",
"path": "asset.2df5a59d801a1efa337d7f2787d401cc48d736faa94d1f42eccad2d88f3ce2e3",
"packaging": "zip"
},
"destinations": {
"current_account-current_region": {
"bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}",
"objectKey": "56b85a7bb756e34ab12549549eb40d34151db41531599e8f2be6c04e8ae66057.zip",
"objectKey": "2df5a59d801a1efa337d7f2787d401cc48d736faa94d1f42eccad2d88f3ce2e3.zip",
"assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}"
}
}
Expand Down Expand Up @@ -144,15 +144,15 @@
}
}
},
"b34518d0799bdecb83d5bfce58b4d697f8e84c71c661d07c5ada561cf577a933": {
"292c4b7414bf1bcfda3b17644a81a5d3696375b3964f62a8c7ddcc77265825fe": {
"source": {
"path": "aws-cdk-eks-cluster-alb-controller-test.template.json",
"packaging": "file"
},
"destinations": {
"current_account-current_region": {
"bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}",
"objectKey": "b34518d0799bdecb83d5bfce58b4d697f8e84c71c661d07c5ada561cf577a933.json",
"objectKey": "292c4b7414bf1bcfda3b17644a81a5d3696375b3964f62a8c7ddcc77265825fe.json",
"assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}"
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -402,9 +402,9 @@
"S3Bucket": {
"Fn::Sub": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}"
},
"S3Key": "dd8086b05eeea461708bd66ad140d8965ddf70c0e144af871d078fdbddf0a67d.zip"
"S3Key": "c475180f5b1bbabac165414da13a9b843b111cd3b6d5fae9c954c006640c4064.zip"
},
"Description": "/opt/kubectl/kubectl 1.23; /opt/helm/helm 3.9",
"Description": "/opt/kubectl/kubectl 1.24; /opt/helm/helm 3.9",
"LicenseInfo": "Apache-2.0"
}
},
Expand Down Expand Up @@ -608,7 +608,7 @@
]
},
"Config": {
"version": "1.23",
"version": "1.24",
"roleArn": {
"Fn::GetAtt": [
"ClusterRoleFA261979",
Expand Down Expand Up @@ -796,7 +796,7 @@
"OpenIdConnectIssuerUrl"
]
},
"CodeHash": "56b85a7bb756e34ab12549549eb40d34151db41531599e8f2be6c04e8ae66057"
"CodeHash": "2df5a59d801a1efa337d7f2787d401cc48d736faa94d1f42eccad2d88f3ce2e3"
},
"UpdateReplacePolicy": "Delete",
"DeletionPolicy": "Delete"
Expand Down Expand Up @@ -1488,7 +1488,7 @@
"S3Bucket": {
"Fn::Sub": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}"
},
"S3Key": "56b85a7bb756e34ab12549549eb40d34151db41531599e8f2be6c04e8ae66057.zip"
"S3Key": "2df5a59d801a1efa337d7f2787d401cc48d736faa94d1f42eccad2d88f3ce2e3.zip"
},
"Timeout": 900,
"MemorySize": 128,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"validateOnSynth": false,
"assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-deploy-role-${AWS::AccountId}-${AWS::Region}",
"cloudFormationExecutionRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-cfn-exec-role-${AWS::AccountId}-${AWS::Region}",
"stackTemplateAssetObjectUrl": "s3://cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}/b34518d0799bdecb83d5bfce58b4d697f8e84c71c661d07c5ada561cf577a933.json",
"stackTemplateAssetObjectUrl": "s3://cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}/292c4b7414bf1bcfda3b17644a81a5d3696375b3964f62a8c7ddcc77265825fe.json",
"requiresBootstrapStackVersion": 6,
"bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version",
"additionalDependencies": [
Expand Down Expand Up @@ -162,7 +162,10 @@
"/aws-cdk-eks-cluster-alb-controller-test/KubectlLayer/Resource": [
{
"type": "aws:cdk:logicalId",
"data": "KubectlLayer600207B5"
"data": "KubectlLayer600207B5",
"trace": [
"!!DESTRUCTIVE_CHANGES: WILL_REPLACE"
]
}
],
"/aws-cdk-eks-cluster-alb-controller-test/Cluster/Role/Resource": [
Expand Down
Loading