diff --git a/packages/@aws-cdk/aws-eks/lib/cluster.ts b/packages/@aws-cdk/aws-eks/lib/cluster.ts index 9bbc71ca73f5a..c7cd8d9719c67 100644 --- a/packages/@aws-cdk/aws-eks/lib/cluster.ts +++ b/packages/@aws-cdk/aws-eks/lib/cluster.ts @@ -763,9 +763,12 @@ export class Cluster extends Resource implements ICluster { * The nodes will automatically be configured with the right VPC and AMI * for the instance type and Kubernetes version. * + * Note that if you specify `updateType: RollingUpdate` or `updateType: ReplacingUpdate`, your nodes might be replaced at deploy + * time without notice in case the recommended AMI for your machine image type has been updated by AWS. + * The default behavior for `updateType` is `None`, which means only new instances will be launched using the new AMI. + * * Spot instances will be labeled `lifecycle=Ec2Spot` and tainted with `PreferNoSchedule`. - * If kubectl is enabled, the - * [spot interrupt handler](https://github.com/awslabs/ec2-spot-labs/tree/master/ec2-spot-eks-solution/spot-termination-handler) + * In addition, the [spot interrupt handler](https://github.com/awslabs/ec2-spot-labs/tree/master/ec2-spot-eks-solution/spot-termination-handler) * daemon will be installed on all spot instances to handle * [EC2 Spot Instance Termination Notices](https://aws.amazon.com/blogs/aws/new-ec2-spot-instance-termination-notices/). */ @@ -782,7 +785,7 @@ export class Cluster extends Resource implements ICluster { nodeType: nodeTypeForInstanceType(options.instanceType), kubernetesVersion: this.version.version, }), - updateType: options.updateType || autoscaling.UpdateType.ROLLING_UPDATE, + updateType: options.updateType, instanceType: options.instanceType, }); diff --git a/packages/@aws-cdk/aws-eks/lib/legacy-cluster.ts b/packages/@aws-cdk/aws-eks/lib/legacy-cluster.ts index 3e2ba0feb9abd..f8766e8ce3929 100644 --- a/packages/@aws-cdk/aws-eks/lib/legacy-cluster.ts +++ b/packages/@aws-cdk/aws-eks/lib/legacy-cluster.ts @@ -230,10 +230,6 @@ export class LegacyCluster extends Resource implements ICluster { * for the instance type and Kubernetes version. * * Spot instances will be labeled `lifecycle=Ec2Spot` and tainted with `PreferNoSchedule`. - * If kubectl is enabled, the - * [spot interrupt handler](https://github.com/awslabs/ec2-spot-labs/tree/master/ec2-spot-eks-solution/spot-termination-handler) - * daemon will be installed on all spot instances to handle - * [EC2 Spot Instance Termination Notices](https://aws.amazon.com/blogs/aws/new-ec2-spot-instance-termination-notices/). */ public addCapacity(id: string, options: CapacityOptions): autoscaling.AutoScalingGroup { if (options.machineImageType === MachineImageType.BOTTLEROCKET && options.bootstrapOptions !== undefined ) { diff --git a/packages/@aws-cdk/aws-eks/test/integ.eks-cluster.expected.json b/packages/@aws-cdk/aws-eks/test/integ.eks-cluster.expected.json index 471201d249202..62e1e78b850c1 100644 --- a/packages/@aws-cdk/aws-eks/test/integ.eks-cluster.expected.json +++ b/packages/@aws-cdk/aws-eks/test/integ.eks-cluster.expected.json @@ -1551,17 +1551,6 @@ ] }, "UpdatePolicy": { - "AutoScalingRollingUpdate": { - "WaitOnResourceSignals": false, - "PauseTime": "PT0S", - "SuspendProcesses": [ - "HealthCheck", - "ReplaceUnhealthy", - "AZRebalance", - "AlarmNotification", - "ScheduledActions" - ] - }, "AutoScalingScheduledAction": { "IgnoreUnmodifiedGroupSizeProperties": true } @@ -1853,17 +1842,6 @@ ] }, "UpdatePolicy": { - "AutoScalingRollingUpdate": { - "WaitOnResourceSignals": false, - "PauseTime": "PT0S", - "SuspendProcesses": [ - "HealthCheck", - "ReplaceUnhealthy", - "AZRebalance", - "AlarmNotification", - "ScheduledActions" - ] - }, "AutoScalingScheduledAction": { "IgnoreUnmodifiedGroupSizeProperties": true } @@ -2142,17 +2120,6 @@ ] }, "UpdatePolicy": { - "AutoScalingRollingUpdate": { - "WaitOnResourceSignals": false, - "PauseTime": "PT0S", - "SuspendProcesses": [ - "HealthCheck", - "ReplaceUnhealthy", - "AZRebalance", - "AlarmNotification", - "ScheduledActions" - ] - }, "AutoScalingScheduledAction": { "IgnoreUnmodifiedGroupSizeProperties": true } @@ -2462,17 +2429,6 @@ ] }, "UpdatePolicy": { - "AutoScalingRollingUpdate": { - "WaitOnResourceSignals": false, - "PauseTime": "PT0S", - "SuspendProcesses": [ - "HealthCheck", - "ReplaceUnhealthy", - "AZRebalance", - "AlarmNotification", - "ScheduledActions" - ] - }, "AutoScalingScheduledAction": { "IgnoreUnmodifiedGroupSizeProperties": true } diff --git a/packages/@aws-cdk/aws-eks/test/test.cluster.ts b/packages/@aws-cdk/aws-eks/test/test.cluster.ts index 6c1d01a1f02ba..0ae01003d7e14 100644 --- a/packages/@aws-cdk/aws-eks/test/test.cluster.ts +++ b/packages/@aws-cdk/aws-eks/test/test.cluster.ts @@ -15,6 +15,7 @@ import { testFixture, testFixtureNoVpc } from './util'; const CLUSTER_VERSION = eks.KubernetesVersion.V1_16; export = { + 'a default cluster spans all subnets'(test: Test) { // GIVEN const { stack, vpc } = testFixture(); @@ -201,6 +202,24 @@ export = { test.done(); }, + 'adding capacity creates an ASG without a rolling update policy'(test: Test) { + // GIVEN + const { stack, vpc } = testFixture(); + const cluster = new eks.Cluster(stack, 'Cluster', { + vpc, + defaultCapacity: 0, + version: CLUSTER_VERSION, + }); + + // WHEN + cluster.addCapacity('Default', { + instanceType: new ec2.InstanceType('t2.medium'), + }); + + test.deepEqual(expect(stack).value.Resources.ClusterASG0E4BA723.UpdatePolicy, { AutoScalingScheduledAction: { IgnoreUnmodifiedGroupSizeProperties: true } }); + test.done(); + }, + 'adding capacity creates an ASG with tags'(test: Test) { // GIVEN const { stack, vpc } = testFixture();