Skip to content

Commit ae7bfa0

Browse files
authored
Merge branch 'main' into merge-back/2.48.0
2 parents 41015c7 + 0cbdf58 commit ae7bfa0

File tree

376 files changed

+1947
-9835
lines changed

Some content is hidden

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

376 files changed

+1947
-9835
lines changed

package.json

+2
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,8 @@
9191
"@aws-cdk/aws-cognito/punycode/**",
9292
"@aws-cdk/aws-ecr-assets/minimatch",
9393
"@aws-cdk/aws-ecr-assets/minimatch/**",
94+
"@aws-cdk/aws-eks/semver",
95+
"@aws-cdk/aws-eks/semver/**",
9496
"@aws-cdk/aws-eks/yaml",
9597
"@aws-cdk/aws-eks/yaml/**",
9698
"@aws-cdk/aws-events-targets/aws-sdk",

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

+5-2
Original file line numberDiff line numberDiff line change
@@ -676,7 +676,11 @@ The kubectl handler uses `kubectl`, `helm` and the `aws` CLI in order to
676676
interact with the cluster. These are bundled into AWS Lambda layers included in
677677
the `@aws-cdk/lambda-layer-awscli` and `@aws-cdk/lambda-layer-kubectl` modules.
678678

679-
The version of kubectl used must be compatible wtih the Kubernetes version of the cluster. kubectl is supported within one minor version (older or newer) of Kubernetes (see [Kubernetes version skew policy](https://kubernetes.io/releases/version-skew-policy/#kubectl)). Only version 1.20 of kubectl is available in `aws-cdk-lib`. If you need a different version, you will need to use one of the `@aws-cdk/lambda-layer-kubectlvXY` packages.
679+
The version of kubectl used must be compatible with the Kubernetes version of the
680+
cluster. kubectl is supported within one minor version (older or newer) of Kubernetes
681+
(see [Kubernetes version skew policy](https://kubernetes.io/releases/version-skew-policy/#kubectl)).
682+
Only version 1.20 of kubectl is available in `aws-cdk-lib`. If you need a different
683+
version, you will need to use one of the `@aws-cdk/lambda-layer-kubectlvXY` packages.
680684

681685
```ts
682686
import { KubectlV22Layer } from '@aws-cdk/lambda-layer-kubectl-v22';
@@ -685,7 +689,6 @@ const cluster = new eks.Cluster(this, 'hello-eks', {
685689
version: eks.KubernetesVersion.V1_22,
686690
kubectlLayer: new KubectlV22Layer(this, 'kubectl'),
687691
});
688-
689692
```
690693

691694
You can also specify a custom `lambda.LayerVersion` if you wish to use a

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

+16-5
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import * as lambda from '@aws-cdk/aws-lambda';
88
import * as ssm from '@aws-cdk/aws-ssm';
99
import { Annotations, CfnOutput, CfnResource, IResource, Resource, Stack, Tags, Token, Duration, Size } from '@aws-cdk/core';
1010
import { Construct, Node } from 'constructs';
11+
import * as semver from 'semver';
1112
import * as YAML from 'yaml';
1213
import { AlbController, AlbControllerOptions } from './alb-controller';
1314
import { AwsAuth } from './aws-auth';
@@ -853,6 +854,15 @@ export class KubernetesVersion {
853854
*/
854855
public static readonly V1_22 = KubernetesVersion.of('1.22');
855856

857+
/**
858+
* Kubernetes version 1.23
859+
*
860+
* When creating a `Cluster` with this version, you need to also specify the
861+
* `kubectlLayer` property with a `KubectlV23Layer` from
862+
* `@aws-cdk/lambda-layer-kubectl-v23`.
863+
*/
864+
public static readonly V1_23 = KubernetesVersion.of('1.23');
865+
856866
/**
857867
* Custom cluster version
858868
* @param version custom version number
@@ -1372,8 +1382,9 @@ export class Cluster extends ClusterBase {
13721382
this.prune = props.prune ?? true;
13731383
this.vpc = props.vpc || new ec2.Vpc(this, 'DefaultVpc');
13741384

1375-
if (props.version === KubernetesVersion.V1_22 && !props.kubectlLayer) {
1376-
Annotations.of(this).addWarning(`You created a cluster with Kubernetes Version ${props.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-v22.`);
1385+
const kubectlVersion = new semver.SemVer(`${props.version.version}.0`);
1386+
if (semver.gte(kubectlVersion, '1.22.0') && !props.kubectlLayer) {
1387+
Annotations.of(this).addWarning(`You created a cluster with Kubernetes Version ${props.version.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${kubectlVersion.minor}.`);
13771388
};
13781389
this.version = props.version;
13791390
this.kubectlLambdaRole = props.kubectlLambdaRole ? props.kubectlLambdaRole : undefined;
@@ -2300,7 +2311,7 @@ export enum CoreDnsComputeType {
23002311
/**
23012312
* Deploy CoreDNS on Fargate-managed instances.
23022313
*/
2303-
FARGATE = 'fargate'
2314+
FARGATE = 'fargate',
23042315
}
23052316

23062317
/**
@@ -2314,7 +2325,7 @@ export enum DefaultCapacityType {
23142325
/**
23152326
* EC2 autoscaling group
23162327
*/
2317-
EC2
2328+
EC2,
23182329
}
23192330

23202331
/**
@@ -2328,7 +2339,7 @@ export enum MachineImageType {
23282339
/**
23292340
* Bottlerocket AMI
23302341
*/
2331-
BOTTLEROCKET
2342+
BOTTLEROCKET,
23322343
}
23332344

23342345
function nodeTypeForInstanceType(instanceType: ec2.InstanceType) {

packages/@aws-cdk/aws-eks/lib/kubectl-handler/get/__init__.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -75,9 +75,9 @@ def kubectl(args):
7575
while retry > 0:
7676
try:
7777
cmd = [ 'kubectl', '--kubeconfig', kubeconfig ] + args
78-
output = subprocess.check_output(cmd, stderr=subprocess.STDOUT)
78+
output = subprocess.check_output(cmd, stderr=subprocess.PIPE)
7979
except subprocess.CalledProcessError as exc:
80-
output = exc.output
80+
output = exc.output + exc.stderr
8181
if b'i/o timeout' in output and retry > 0:
8282
logger.info("kubectl timed out, retries left: %s" % retry)
8383
retry = retry - 1

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

+5-2
Original file line numberDiff line numberDiff line change
@@ -80,8 +80,8 @@
8080
},
8181
"license": "Apache-2.0",
8282
"devDependencies": {
83-
"@aws-cdk/lambda-layer-kubectl-v22": "2.0.0",
84-
"aws-cdk-lib": "2.47.0",
83+
"@aws-cdk/lambda-layer-kubectl-v23": "^2.0.0",
84+
"aws-cdk-lib": "^2.47.0",
8585
"@aws-cdk/assertions": "0.0.0",
8686
"@aws-cdk/cdk-build-tools": "0.0.0",
8787
"@aws-cdk/integ-runner": "0.0.0",
@@ -95,6 +95,7 @@
9595
"aws-sdk": "^2.1211.0",
9696
"cdk8s": "^2.5.28",
9797
"cdk8s-plus-21": "^2.0.0-beta.12",
98+
"cdk8s-plus-23": "2.0.2",
9899
"jest": "^27.5.1",
99100
"sinon": "^9.2.4"
100101
},
@@ -112,9 +113,11 @@
112113
"@aws-cdk/lambda-layer-kubectl": "0.0.0",
113114
"@aws-cdk/lambda-layer-node-proxy-agent": "0.0.0",
114115
"constructs": "^10.0.0",
116+
"semver": "^7.3.8",
115117
"yaml": "1.10.2"
116118
},
117119
"bundledDependencies": [
120+
"semver",
118121
"yaml"
119122
],
120123
"homepage": "https://github.com/aws/aws-cdk",
Original file line numberDiff line numberDiff line change
@@ -75,9 +75,9 @@ def kubectl(args):
7575
while retry > 0:
7676
try:
7777
cmd = [ 'kubectl', '--kubeconfig', kubeconfig ] + args
78-
output = subprocess.check_output(cmd, stderr=subprocess.STDOUT)
78+
output = subprocess.check_output(cmd, stderr=subprocess.PIPE)
7979
except subprocess.CalledProcessError as exc:
80-
output = exc.output
80+
output = exc.output + exc.stderr
8181
if b'i/o timeout' in output and retry > 0:
8282
logger.info("kubectl timed out, retries left: %s" % retry)
8383
retry = retry - 1

packages/@aws-cdk/aws-eks/test/alb-controller.integ.snapshot/asset.2c98a634e36e3f2a1c1a78958953ed173e2c6cf8446c15dabbef67d4e30b33d6/index.js

-58
This file was deleted.

0 commit comments

Comments
 (0)