From e34f8d2279d11197936ddcfc6a500b00488eaf51 Mon Sep 17 00:00:00 2001 From: Pahud Hsieh Date: Thu, 21 May 2020 07:11:37 +0000 Subject: [PATCH 1/3] fix #7993 --- packages/@aws-cdk/aws-eks/lib/cluster.ts | 2 -- packages/@aws-cdk/aws-eks/test/test.nodegroup.ts | 14 +++++++++++++- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/packages/@aws-cdk/aws-eks/lib/cluster.ts b/packages/@aws-cdk/aws-eks/lib/cluster.ts index 296e7beb07fe4..cee7953a66916 100644 --- a/packages/@aws-cdk/aws-eks/lib/cluster.ts +++ b/packages/@aws-cdk/aws-eks/lib/cluster.ts @@ -510,8 +510,6 @@ export class Cluster extends Resource implements ICluster { * @param options options for creating a new nodegroup */ public addNodegroup(id: string, options?: NodegroupOptions): Nodegroup { - // initialize the awsAuth for this cluster - this._awsAuth = this._awsAuth ?? this.awsAuth; return new Nodegroup(this, `Nodegroup${id}`, { cluster: this, ...options, diff --git a/packages/@aws-cdk/aws-eks/test/test.nodegroup.ts b/packages/@aws-cdk/aws-eks/test/test.nodegroup.ts index b22918dd1b306..caf0b4ce090d6 100644 --- a/packages/@aws-cdk/aws-eks/test/test.nodegroup.ts +++ b/packages/@aws-cdk/aws-eks/test/test.nodegroup.ts @@ -1,4 +1,4 @@ -import { expect, haveResource, haveResourceLike } from '@aws-cdk/assert'; +import { expect, haveResource, haveResourceLike, countResources } from '@aws-cdk/assert'; import * as ec2 from '@aws-cdk/aws-ec2'; import * as cdk from '@aws-cdk/core'; import { Test } from 'nodeunit'; @@ -90,6 +90,18 @@ export = { )); test.done(); }, + 'create nodegroups with kubectlEnabled is false'(test: Test) { + // GIVEN + const { stack, vpc } = testFixture(); + + // WHEN + const cluster = new eks.Cluster(stack, 'Cluster', { vpc, kubectlEnabled: false, defaultCapacity: 2 }); + // add a extra nodegroup + cluster.addNodegroup('extra-ng'); + // THEN + expect(stack).to(countResources('AWS::EKS::Nodegroup',2)); + test.done(); + }, 'create nodegroup with instanceType provided'(test: Test) { // GIVEN const { stack, vpc } = testFixture(); From f6f0e285d58e361ec48a3dffa98dc55bacb7e7ab Mon Sep 17 00:00:00 2001 From: Pahud Date: Thu, 21 May 2020 15:46:19 +0800 Subject: [PATCH 2/3] minor --- packages/@aws-cdk/aws-eks/test/test.nodegroup.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/@aws-cdk/aws-eks/test/test.nodegroup.ts b/packages/@aws-cdk/aws-eks/test/test.nodegroup.ts index caf0b4ce090d6..acd5871c6cb6b 100644 --- a/packages/@aws-cdk/aws-eks/test/test.nodegroup.ts +++ b/packages/@aws-cdk/aws-eks/test/test.nodegroup.ts @@ -1,4 +1,4 @@ -import { expect, haveResource, haveResourceLike, countResources } from '@aws-cdk/assert'; +import { countResources, expect, haveResource, haveResourceLike } from '@aws-cdk/assert'; import * as ec2 from '@aws-cdk/aws-ec2'; import * as cdk from '@aws-cdk/core'; import { Test } from 'nodeunit'; @@ -99,7 +99,7 @@ export = { // add a extra nodegroup cluster.addNodegroup('extra-ng'); // THEN - expect(stack).to(countResources('AWS::EKS::Nodegroup',2)); + expect(stack).to(countResources('AWS::EKS::Nodegroup', 2)); test.done(); }, 'create nodegroup with instanceType provided'(test: Test) { From 030049f3883e183a0b1fd21973afe6e58ea458aa Mon Sep 17 00:00:00 2001 From: Pahud Hsieh Date: Thu, 21 May 2020 19:54:07 +0000 Subject: [PATCH 3/3] fix test --- packages/@aws-cdk/aws-eks/test/test.cluster.ts | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/packages/@aws-cdk/aws-eks/test/test.cluster.ts b/packages/@aws-cdk/aws-eks/test/test.cluster.ts index c99324b0a8ea1..daeded7e80743 100644 --- a/packages/@aws-cdk/aws-eks/test/test.cluster.ts +++ b/packages/@aws-cdk/aws-eks/test/test.cluster.ts @@ -856,18 +856,6 @@ export = { ], }, }, - { - Action: 'sts:AssumeRole', - Effect: 'Allow', - Principal: { - AWS: { - 'Fn::GetAtt': [ - 'awscdkawseksKubectlProviderNestedStackawscdkawseksKubectlProviderNestedStackResourceA7AEBA6B', - 'Outputs.StackawscdkawseksKubectlProviderHandlerServiceRole2C52B3ECArn', - ], - }, - }, - }, ], Version: '2012-10-17', },