Skip to content

Commit b89a84c

Browse files
authored
Merge branch 'master' into fix_6599
2 parents 6d75350 + 86ea80a commit b89a84c

File tree

45 files changed

+1769
-2381
lines changed

Some content is hidden

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

45 files changed

+1769
-2381
lines changed

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

+2-2
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
"devDependencies": {
3232
"@types/jest": "^25.2.1",
3333
"cdk-build-tools": "0.0.0",
34-
"jest": "^24.9.0",
34+
"jest": "^25.3.0",
3535
"pkglint": "0.0.0",
3636
"ts-jest": "^25.3.1"
3737
},
@@ -44,7 +44,7 @@
4444
},
4545
"peerDependencies": {
4646
"@aws-cdk/core": "0.0.0",
47-
"jest": "^24.9.0",
47+
"jest": "^25.3.0",
4848
"constructs": "^2.0.0"
4949
},
5050
"repository": {

packages/@aws-cdk/aws-autoscaling-hooktargets/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@
8181
"cdk-build-tools": "0.0.0",
8282
"cdk-integ-tools": "0.0.0",
8383
"cfn2ts": "0.0.0",
84-
"jest": "^24.9.0",
84+
"jest": "^25.3.0",
8585
"pkglint": "0.0.0"
8686
},
8787
"dependencies": {

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@
8383
"cdk-build-tools": "0.0.0",
8484
"cdk-integ-tools": "0.0.0",
8585
"cfn2ts": "0.0.0",
86-
"jest": "^24.9.0",
86+
"jest": "^25.3.0",
8787
"pkglint": "0.0.0"
8888
},
8989
"dependencies": {

packages/@aws-cdk/aws-cloudwatch-actions/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@
8181
"cdk-build-tools": "0.0.0",
8282
"cdk-integ-tools": "0.0.0",
8383
"cfn2ts": "0.0.0",
84-
"jest": "^24.9.0",
84+
"jest": "^25.3.0",
8585
"pkglint": "0.0.0"
8686
},
8787
"dependencies": {

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

+4-4
Original file line numberDiff line numberDiff line change
@@ -156,9 +156,9 @@ With local caching, the cache is stored on the codebuild instance itself. This i
156156
cheap and fast, but CodeBuild cannot guarantee a reuse of instance and hence cannot
157157
guarantee cache hits. For example, when a build starts and caches files locally, if two subsequent builds start at the same time afterwards only one of those builds would get the cache. Three different cache modes are supported, which can be turned on individually.
158158

159-
* `LocalCacheMode.Source` caches Git metadata for primary and secondary sources.
160-
* `LocalCacheMode.DockerLayer` caches existing Docker layers.
161-
* `LocalCacheMode.Custom` caches directories you specify in the buildspec file.
159+
* `LocalCacheMode.SOURCE` caches Git metadata for primary and secondary sources.
160+
* `LocalCacheMode.DOCKER_LAYER` caches existing Docker layers.
161+
* `LocalCacheMode.CUSTOM` caches directories you specify in the buildspec file.
162162

163163
```typescript
164164
new codebuild.Project(this, 'Project', {
@@ -167,7 +167,7 @@ new codebuild.Project(this, 'Project', {
167167
}),
168168

169169
// Enable Docker AND custom caching
170-
cache: codebuild.Cache.local(LocalCacheMode.DockerLayer, LocalCacheMode.Custom)
170+
cache: codebuild.Cache.local(LocalCacheMode.DOCKER_LAYER, LocalCacheMode.CUSTOM)
171171
});
172172
```
173173

packages/@aws-cdk/aws-cognito/lib/user-pool.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -446,7 +446,7 @@ export interface UserPoolProps {
446446
* Attributes which Cognito will look to verify automatically upon user sign up.
447447
* EMAIL and PHONE are the only available options.
448448
*
449-
* @default - If `signIn` include email and/or phone, they will be included in `autoVerifiedAttributes` by default.
449+
* @default - If `signInAlias` includes email and/or phone, they will be included in `autoVerifiedAttributes` by default.
450450
* If absent, no attributes will be auto-verified.
451451
*/
452452
readonly autoVerify?: AutoVerifiedAttrs;
@@ -903,4 +903,4 @@ const enum StandardAttribute {
903903
function undefinedIfNoKeys(struct: object): object | undefined {
904904
const allUndefined = Object.values(struct).reduce((acc, v) => acc && (v === undefined), true);
905905
return allUndefined ? undefined : struct;
906-
}
906+
}

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@
6767
"cdk-build-tools": "0.0.0",
6868
"cdk-integ-tools": "0.0.0",
6969
"cfn2ts": "0.0.0",
70-
"jest": "^24.9.0",
70+
"jest": "^25.3.0",
7171
"nodeunit": "^0.11.3",
7272
"pkglint": "0.0.0"
7373
},

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@
6969
"cdk-build-tools": "0.0.0",
7070
"cdk-integ-tools": "0.0.0",
7171
"cfn2ts": "0.0.0",
72-
"jest": "^25.2.4",
72+
"jest": "^25.3.0",
7373
"pkglint": "0.0.0",
7474
"sinon": "^9.0.2",
7575
"ts-jest": "^25.3.1"

packages/@aws-cdk/aws-ecs-patterns/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@
6565
"cdk-build-tools": "0.0.0",
6666
"cdk-integ-tools": "0.0.0",
6767
"cfn2ts": "0.0.0",
68-
"jest": "^24.9.0",
68+
"jest": "^25.3.0",
6969
"nodeunit": "^0.11.3",
7070
"pkglint": "0.0.0"
7171
},

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

+14
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import { FargateProfile, FargateProfileOptions } from './fargate-profile';
1010
import { HelmChart, HelmChartOptions } from './helm-chart';
1111
import { KubernetesPatch } from './k8s-patch';
1212
import { KubernetesResource } from './k8s-resource';
13+
import { KubectlProvider } from './kubectl-provider';
1314
import { Nodegroup, NodegroupOptions } from './managed-nodegroup';
1415
import { LifecycleLabel, renderAmazonLinuxUserData, renderBottlerocketUserData } from './user-data';
1516

@@ -679,6 +680,19 @@ export class Cluster extends Resource implements ICluster {
679680
return this._clusterResource.getCreationRoleArn(assumedBy);
680681
}
681682

683+
/**
684+
* Returns the custom resource provider for kubectl-related resources.
685+
* @internal
686+
*/
687+
public get _kubectlProvider(): KubectlProvider {
688+
if (!this._clusterResource) {
689+
throw new Error('Unable to perform this operation since kubectl is not enabled for this cluster');
690+
}
691+
692+
const uid = '@aws-cdk/aws-eks.KubectlProvider';
693+
return this.stack.node.tryFindChild(uid) as KubectlProvider || new KubectlProvider(this.stack, uid);
694+
}
695+
682696
/**
683697
* Opportunistically tag subnets with the required tags.
684698
*

packages/@aws-cdk/aws-eks/lib/helm-chart.ts

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import { CustomResource } from '@aws-cdk/aws-cloudformation';
22
import { Construct, Stack } from '@aws-cdk/core';
33
import { Cluster } from './cluster';
4-
import { KubectlProvider } from './kubectl-provider';
54

65
/**
76
* Helm Chart options.
@@ -79,7 +78,7 @@ export class HelmChart extends Construct {
7978

8079
const stack = Stack.of(this);
8180

82-
const provider = KubectlProvider.getOrCreate(this);
81+
const provider = props.cluster._kubectlProvider;
8382

8483
new CustomResource(this, 'Resource', {
8584
provider: provider.provider,

packages/@aws-cdk/aws-eks/lib/k8s-patch.ts

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import { CustomResource } from '@aws-cdk/aws-cloudformation';
22
import { Construct, Stack } from '@aws-cdk/core';
33
import { Cluster } from './cluster';
4-
import { KubectlProvider } from './kubectl-provider';
54

65
/**
76
* Properties for KubernetesPatch
@@ -72,7 +71,7 @@ export class KubernetesPatch extends Construct {
7271
super(scope, id);
7372

7473
const stack = Stack.of(this);
75-
const provider = KubectlProvider.getOrCreate(stack);
74+
const provider = props.cluster._kubectlProvider;
7675

7776
new CustomResource(this, 'Resource', {
7877
provider: provider.provider,

packages/@aws-cdk/aws-eks/lib/k8s-resource.ts

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import { CustomResource } from '@aws-cdk/aws-cloudformation';
22
import { Construct, Stack } from '@aws-cdk/core';
33
import { Cluster } from './cluster';
4-
import { KubectlProvider } from './kubectl-provider';
54

65
/**
76
* Properties for KubernetesResources
@@ -56,7 +55,7 @@ export class KubernetesResource extends Construct {
5655
super(scope, id);
5756

5857
const stack = Stack.of(this);
59-
const provider = KubectlProvider.getOrCreate(this);
58+
const provider = props.cluster._kubectlProvider;
6059

6160
new CustomResource(this, 'Resource', {
6261
provider: provider.provider,

packages/@aws-cdk/aws-eks/lib/kubectl-provider.ts

+2-11
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,12 @@
11
import { NestedStack } from '@aws-cdk/aws-cloudformation';
22
import * as iam from '@aws-cdk/aws-iam';
33
import * as lambda from '@aws-cdk/aws-lambda';
4-
import { Construct, Duration, Stack } from '@aws-cdk/core';
4+
import { Construct, Duration } from '@aws-cdk/core';
55
import * as cr from '@aws-cdk/custom-resources';
66
import * as path from 'path';
77
import { KubectlLayer } from './kubectl-layer';
88

99
export class KubectlProvider extends NestedStack {
10-
/**
11-
* Creates a stack-singleton resource provider nested stack.
12-
*/
13-
public static getOrCreate(scope: Construct) {
14-
const stack = Stack.of(scope);
15-
const uid = '@aws-cdk/aws-eks.KubectlProvider';
16-
return stack.node.tryFindChild(uid) as KubectlProvider || new KubectlProvider(stack, uid);
17-
}
18-
1910
/**
2011
* The custom resource provider.
2112
*/
@@ -26,7 +17,7 @@ export class KubectlProvider extends NestedStack {
2617
*/
2718
public readonly role: iam.IRole;
2819

29-
private constructor(scope: Construct, id: string) {
20+
public constructor(scope: Construct, id: string) {
3021
super(scope, id);
3122

3223
const handler = new lambda.Function(this, 'Handler', {

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

+37
Original file line numberDiff line numberDiff line change
@@ -395,6 +395,43 @@ export = {
395395
test.done();
396396
},
397397

398+
'kubectl resources can be created in a separate stack'(test: Test) {
399+
// GIVEN
400+
const { stack, app } = testFixture();
401+
const cluster = new eks.Cluster(stack, 'cluster'); // cluster is under stack2
402+
403+
// WHEN resource is under stack2
404+
const stack2 = new cdk.Stack(app, 'stack2', { env: { account: stack.account, region: stack.region } });
405+
new eks.KubernetesResource(stack2, 'myresource', {
406+
cluster,
407+
manifest: [ { foo: 'bar' } ]
408+
});
409+
410+
// THEN
411+
app.synth(); // no cyclic dependency (see https://github.com/aws/aws-cdk/issues/7231)
412+
413+
// expect a single resource in the 2nd stack
414+
expect(stack2).toMatch({
415+
Resources: {
416+
myresource49C6D325: {
417+
Type: 'Custom::AWSCDK-EKS-KubernetesResource',
418+
Properties: {
419+
ServiceToken: {
420+
'Fn::ImportValue': 'Stack:ExportsOutputFnGetAttawscdkawseksKubectlProviderNestedStackawscdkawseksKubectlProviderNestedStackResourceA7AEBA6BOutputsStackawscdkawseksKubectlProviderframeworkonEvent8897FD9BArn49BEF20C'
421+
},
422+
Manifest: '[{\"foo\":\"bar\"}]',
423+
ClusterName: { 'Fn::ImportValue': 'Stack:ExportsOutputRefclusterC5B25D0D98D553F5' },
424+
RoleArn: { 'Fn::ImportValue': 'Stack:ExportsOutputFnGetAttclusterCreationRole2B3B5002ArnF05122FC' }
425+
},
426+
UpdateReplacePolicy: 'Delete',
427+
DeletionPolicy: 'Delete'
428+
}
429+
}
430+
});
431+
432+
test.done();
433+
},
434+
398435
'when kubectl is enabled (default) adding capacity will automatically map its IAM role'(test: Test) {
399436
// GIVEN
400437
const { stack, vpc } = testFixture();

packages/@aws-cdk/aws-elasticloadbalancingv2-targets/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@
8080
"@aws-cdk/assert": "0.0.0",
8181
"cdk-build-tools": "0.0.0",
8282
"cdk-integ-tools": "0.0.0",
83-
"jest": "^24.9.0",
83+
"jest": "^25.3.0",
8484
"pkglint": "0.0.0"
8585
},
8686
"dependencies": {

packages/@aws-cdk/aws-events-targets/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@
9090
"aws-sdk-mock": "^5.1.0",
9191
"cdk-build-tools": "0.0.0",
9292
"cdk-integ-tools": "0.0.0",
93-
"jest": "^24.9.0",
93+
"jest": "^25.3.0",
9494
"pkglint": "0.0.0"
9595
},
9696
"dependencies": {

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@
6868
"cdk-build-tools": "0.0.0",
6969
"cdk-integ-tools": "0.0.0",
7070
"cfn2ts": "0.0.0",
71-
"jest": "^24.9.0",
71+
"jest": "^25.3.0",
7272
"pkglint": "0.0.0"
7373
},
7474
"dependencies": {

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

+1-5
Original file line numberDiff line numberDiff line change
@@ -60,14 +60,13 @@
6060
"url": "https://aws.amazon.com",
6161
"organization": true
6262
},
63+
"jest": {},
6364
"license": "Apache-2.0",
6465
"devDependencies": {
6566
"@aws-cdk/assert": "0.0.0",
66-
"@types/nodeunit": "^0.0.30",
6767
"cdk-build-tools": "0.0.0",
6868
"cdk-integ-tools": "0.0.0",
6969
"cfn2ts": "0.0.0",
70-
"nodeunit": "^0.11.3",
7170
"pkglint": "0.0.0"
7271
},
7372
"dependencies": {
@@ -89,9 +88,6 @@
8988
"node": ">= 10.12.0"
9089
},
9190
"stability": "experimental",
92-
"awslint": {
93-
"exclude": []
94-
},
9591
"awscdkio": {
9692
"announce": false
9793
}

0 commit comments

Comments
 (0)