Skip to content

Commit

Permalink
Merge branch 'master' into corymhall/fix-integ-nodejs10
Browse files Browse the repository at this point in the history
  • Loading branch information
mergify[bot] authored Apr 5, 2022
2 parents b10a7bf + 9a518c5 commit d275b7c
Show file tree
Hide file tree
Showing 124 changed files with 7,461 additions and 194 deletions.
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -79,17 +79,17 @@ For a detailed walkthrough, see the [tutorial](https://docs.aws.amazon.com/cdk/l
Install or update the [AWS CDK CLI] from npm (requires [Node.js ≥ 14.15.0](https://nodejs.org/download/release/latest-v14.x/)). We recommend using a version in [Active LTS](https://nodejs.org/en/about/releases/)

```console
$ npm i -g aws-cdk
npm i -g aws-cdk
```

(See [Manual Installation](./MANUAL_INSTALLATION.md) for installing the CDK from a signed .zip file).

Initialize a project:

```console
$ mkdir hello-cdk
$ cd hello-cdk
$ cdk init sample-app --language=typescript
mkdir hello-cdk
cd hello-cdk
cdk init sample-app --language=typescript
```

This creates a sample project looking like this:
Expand All @@ -113,7 +113,7 @@ export class HelloCdkStack extends cdk.Stack {
Deploy this to your account:

```console
$ cdk deploy
cdk deploy
```

Use the `cdk` command-line toolkit to interact with your project:
Expand Down
2 changes: 1 addition & 1 deletion packages/@aws-cdk/aws-appsync/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@ import * as opensearch from '@aws-cdk/aws-opensearchservice';

const user = new iam.User(this, 'User');
const domain = new opensearch.Domain(this, 'Domain', {
version: opensearch.EngineVersion.OPENSEARCH_1_1,
version: opensearch.EngineVersion.OPENSEARCH_1_2,
removalPolicy: RemovalPolicy.DESTROY,
fineGrainedAccessControl: { masterUserArn: user.userArn },
encryptionAtRest: { enabled: true },
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
"EncryptionAtRestOptions": {
"Enabled": true
},
"EngineVersion": "OpenSearch_1.1",
"EngineVersion": "OpenSearch_1.2",
"LogPublishingOptions": {},
"NodeToNodeEncryptionOptions": {
"Enabled": true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ const app = new cdk.App();
const stack = new cdk.Stack(app, 'appsync-opensearch');
const user = new User(stack, 'User');
const domain = new opensearch.Domain(stack, 'Domain', {
version: opensearch.EngineVersion.OPENSEARCH_1_1,
version: opensearch.EngineVersion.OPENSEARCH_1_2,
removalPolicy: cdk.RemovalPolicy.DESTROY,
fineGrainedAccessControl: {
masterUserArn: user.userArn,
Expand Down
2 changes: 1 addition & 1 deletion packages/@aws-cdk/aws-dynamodb/lib/table.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1183,7 +1183,7 @@ export class Table extends TableBase {
attributeDefinitions: this.attributeDefinitions,
globalSecondaryIndexes: Lazy.any({ produce: () => this.globalSecondaryIndexes }, { omitEmptyArray: true }),
localSecondaryIndexes: Lazy.any({ produce: () => this.localSecondaryIndexes }, { omitEmptyArray: true }),
pointInTimeRecoverySpecification: props.pointInTimeRecovery ? { pointInTimeRecoveryEnabled: props.pointInTimeRecovery } : undefined,
pointInTimeRecoverySpecification: props.pointInTimeRecovery != null ? { pointInTimeRecoveryEnabled: props.pointInTimeRecovery } : undefined,
billingMode: this.billingMode === BillingMode.PAY_PER_REQUEST ? this.billingMode : undefined,
provisionedThroughput: this.billingMode === BillingMode.PAY_PER_REQUEST ? undefined : {
readCapacityUnits: props.readCapacity || 5,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -413,7 +413,7 @@ export abstract class ApplicationLoadBalancedServiceBase extends CoreConstruct {
}
this.cluster = props.cluster || this.getDefaultCluster(this, props.vpc);

if (props.desiredCount !== undefined && props.desiredCount < 1) {
if (props.desiredCount !== undefined && !cdk.Token.isUnresolved(props.desiredCount) && props.desiredCount < 1) {
throw new Error('You must specify a desiredCount greater than 0');
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1047,3 +1047,29 @@ test('test Network load balanced service with docker labels defined', () => {
],
});
});

test('Passing in token for desiredCount will not throw error', () => {
// GIVEN
const stack = new cdk.Stack();
const vpc = new ec2.Vpc(stack, 'VPC');
const cluster = new ecs.Cluster(stack, 'Cluster', { vpc });
const param = new cdk.CfnParameter(stack, 'prammm', {
type: 'Number',
default: 1,
});

// WHEN
const service = new ecsPatterns.ApplicationLoadBalancedFargateService(stack, 'Service', {
cluster,
taskImageOptions: {
image: ecs.ContainerImage.fromRegistry('/aws/aws-example-app'),
dockerLabels: { label1: 'labelValue1', label2: 'labelValue2' },
},
desiredCount: param.valueAsNumber,
});

// THEN
expect(() => {
service.internalDesiredCount;
}).toBeTruthy;
});
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Tokenization } from '@aws-cdk/core';
import { Tokenization, Token } from '@aws-cdk/core';
import { Construct } from 'constructs';
import { ImportedTaskDefinition } from '../base/_imported-task-definition';
import {
Expand Down Expand Up @@ -140,7 +140,8 @@ export class FargateTaskDefinition extends TaskDefinition implements IFargateTas
networkMode: NetworkMode.AWS_VPC,
});

if (props.ephemeralStorageGiB && (props.ephemeralStorageGiB < 21 || props.ephemeralStorageGiB > 200)) {
// eslint-disable-next-line max-len
if (props.ephemeralStorageGiB && !Token.isUnresolved(props.ephemeralStorageGiB) && (props.ephemeralStorageGiB < 21 || props.ephemeralStorageGiB > 200)) {
throw new Error('Ephemeral storage size must be between 21GiB and 200GiB');
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,25 @@ describe('fargate task definition', () => {
'Add the \'taskRole\' in ImportedTaskDefinitionProps to instantiate ImportedTaskDefinition');
});

test('Passing in token for ephemeral storage will not throw error', () => {
// GIVEN
const stack = new cdk.Stack();

// WHEN
const param = new cdk.CfnParameter(stack, 'prammm', {
type: 'Number',
default: 1,
});

const taskDefinition = new ecs.FargateTaskDefinition(stack, 'FargateTaskDef', {
ephemeralStorageGiB: param.valueAsNumber,
});

// THEN
expect(() => {
taskDefinition.ephemeralStorageGiB;
}).toBeTruthy;
});

test('runtime testing for windows container', () => {
// GIVEN
Expand Down
38 changes: 19 additions & 19 deletions packages/@aws-cdk/aws-eks/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ This example defines an Amazon EKS cluster with the following configuration:
```ts
// provisiong a cluster
const cluster = new eks.Cluster(this, 'hello-eks', {
version: eks.KubernetesVersion.V1_21,
version: eks.KubernetesVersion.V1_22,
});

// apply a kubernetes manifest to the cluster
Expand Down Expand Up @@ -143,15 +143,15 @@ Creating a new cluster is done using the `Cluster` or `FargateCluster` construct

```ts
new eks.Cluster(this, 'HelloEKS', {
version: eks.KubernetesVersion.V1_21,
version: eks.KubernetesVersion.V1_22,
});
```

You can also use `FargateCluster` to provision a cluster that uses only fargate workers.

```ts
new eks.FargateCluster(this, 'HelloEKS', {
version: eks.KubernetesVersion.V1_21,
version: eks.KubernetesVersion.V1_22,
});
```

Expand All @@ -175,7 +175,7 @@ At cluster instantiation time, you can customize the number of instances and the

```ts
new eks.Cluster(this, 'HelloEKS', {
version: eks.KubernetesVersion.V1_21,
version: eks.KubernetesVersion.V1_22,
defaultCapacity: 5,
defaultCapacityInstance: ec2.InstanceType.of(ec2.InstanceClass.M5, ec2.InstanceSize.SMALL),
});
Expand All @@ -187,7 +187,7 @@ Additional customizations are available post instantiation. To apply them, set t

```ts
const cluster = new eks.Cluster(this, 'HelloEKS', {
version: eks.KubernetesVersion.V1_21,
version: eks.KubernetesVersion.V1_22,
defaultCapacity: 0,
});

Expand Down Expand Up @@ -345,7 +345,7 @@ The following code defines an Amazon EKS cluster with a default Fargate Profile

```ts
const cluster = new eks.FargateCluster(this, 'MyCluster', {
version: eks.KubernetesVersion.V1_21,
version: eks.KubernetesVersion.V1_22,
});
```

Expand Down Expand Up @@ -422,7 +422,7 @@ You can also configure the cluster to use an auto-scaling group as the default c

```ts
const cluster = new eks.Cluster(this, 'HelloEKS', {
version: eks.KubernetesVersion.V1_21,
version: eks.KubernetesVersion.V1_22,
defaultCapacityType: eks.DefaultCapacityType.EC2,
});
```
Expand Down Expand Up @@ -515,7 +515,7 @@ You can configure the [cluster endpoint access](https://docs.aws.amazon.com/eks/

```ts
const cluster = new eks.Cluster(this, 'hello-eks', {
version: eks.KubernetesVersion.V1_21,
version: eks.KubernetesVersion.V1_22,
endpointAccess: eks.EndpointAccess.PRIVATE, // No access outside of your VPC.
});
```
Expand All @@ -537,7 +537,7 @@ To deploy the controller on your EKS cluster, configure the `albController` prop

```ts
new eks.Cluster(this, 'HelloEKS', {
version: eks.KubernetesVersion.V1_21,
version: eks.KubernetesVersion.V1_22,
albController: {
version: eks.AlbControllerVersion.V2_4_1,
},
Expand Down Expand Up @@ -577,7 +577,7 @@ You can specify the VPC of the cluster using the `vpc` and `vpcSubnets` properti
declare const vpc: ec2.Vpc;

new eks.Cluster(this, 'HelloEKS', {
version: eks.KubernetesVersion.V1_21,
version: eks.KubernetesVersion.V1_22,
vpc,
vpcSubnets: [{ subnetType: ec2.SubnetType.PRIVATE }],
});
Expand Down Expand Up @@ -624,7 +624,7 @@ You can configure the environment of the Cluster Handler functions by specifying
```ts
declare const proxyInstanceSecurityGroup: ec2.SecurityGroup;
const cluster = new eks.Cluster(this, 'hello-eks', {
version: eks.KubernetesVersion.V1_21,
version: eks.KubernetesVersion.V1_22,
clusterHandlerEnvironment: {
https_proxy: 'http://proxy.myproxy.com',
},
Expand Down Expand Up @@ -662,7 +662,7 @@ You can configure the environment of this function by specifying it at cluster i

```ts
const cluster = new eks.Cluster(this, 'hello-eks', {
version: eks.KubernetesVersion.V1_21,
version: eks.KubernetesVersion.V1_22,
kubectlEnvironment: {
'http_proxy': 'http://proxy.myproxy.com',
},
Expand Down Expand Up @@ -706,7 +706,7 @@ const cluster1 = new eks.Cluster(this, 'MyCluster', {
kubectlLayer: layer,
vpc,
clusterName: 'cluster-name',
version: eks.KubernetesVersion.V1_21,
version: eks.KubernetesVersion.V1_22,
});

// or
Expand All @@ -724,7 +724,7 @@ By default, the kubectl provider is configured with 1024MiB of memory. You can u
```ts
new eks.Cluster(this, 'MyCluster', {
kubectlMemory: Size.gibibytes(4),
version: eks.KubernetesVersion.V1_21,
version: eks.KubernetesVersion.V1_22,
});

// or
Expand Down Expand Up @@ -763,7 +763,7 @@ When you create a cluster, you can specify a `mastersRole`. The `Cluster` constr
```ts
declare const role: iam.Role;
new eks.Cluster(this, 'HelloEKS', {
version: eks.KubernetesVersion.V1_21,
version: eks.KubernetesVersion.V1_22,
mastersRole: role,
});
```
Expand Down Expand Up @@ -791,7 +791,7 @@ You can use the `secretsEncryptionKey` to configure which key the cluster will u
const secretsKey = new kms.Key(this, 'SecretsKey');
const cluster = new eks.Cluster(this, 'MyCluster', {
secretsEncryptionKey: secretsKey,
version: eks.KubernetesVersion.V1_21,
version: eks.KubernetesVersion.V1_22,
});
```

Expand All @@ -801,7 +801,7 @@ You can also use a similar configuration for running a cluster built using the F
const secretsKey = new kms.Key(this, 'SecretsKey');
const cluster = new eks.FargateCluster(this, 'MyFargateCluster', {
secretsEncryptionKey: secretsKey,
version: eks.KubernetesVersion.V1_21,
version: eks.KubernetesVersion.V1_22,
});
```

Expand Down Expand Up @@ -1076,7 +1076,7 @@ when a cluster is defined:

```ts
new eks.Cluster(this, 'MyCluster', {
version: eks.KubernetesVersion.V1_21,
version: eks.KubernetesVersion.V1_22,
prune: false,
});
```
Expand Down Expand Up @@ -1431,7 +1431,7 @@ property. For example:
```ts
const cluster = new eks.Cluster(this, 'Cluster', {
// ...
version: eks.KubernetesVersion.V1_21,
version: eks.KubernetesVersion.V1_22,
clusterLogging: [
eks.ClusterLoggingTypes.API,
eks.ClusterLoggingTypes.AUTHENTICATOR,
Expand Down
6 changes: 6 additions & 0 deletions packages/@aws-cdk/aws-eks/lib/cluster.ts
Original file line number Diff line number Diff line change
Expand Up @@ -796,6 +796,7 @@ export class KubernetesVersion {

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

Expand All @@ -814,6 +815,11 @@ export class KubernetesVersion {
*/
public static readonly V1_21 = KubernetesVersion.of('1.21');

/**
* Kubernetes version 1.22
*/
public static readonly V1_22 = KubernetesVersion.of('1.22');

/**
* Custom cluster version
* @param version custom version number
Expand Down
Loading

0 comments on commit d275b7c

Please sign in to comment.