Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(eks): AMI changes in managed SSM store param causes rolling update of ASG #9746

Merged
merged 9 commits into from
Aug 17, 2020
9 changes: 6 additions & 3 deletions packages/@aws-cdk/aws-eks/lib/cluster.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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/).
*/
Expand All @@ -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,
});

Expand Down
4 changes: 0 additions & 4 deletions packages/@aws-cdk/aws-eks/lib/legacy-cluster.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 ) {
Expand Down
44 changes: 0 additions & 44 deletions packages/@aws-cdk/aws-eks/test/integ.eks-cluster.expected.json
Original file line number Diff line number Diff line change
Expand Up @@ -1551,17 +1551,6 @@
]
},
"UpdatePolicy": {
"AutoScalingRollingUpdate": {
"WaitOnResourceSignals": false,
"PauseTime": "PT0S",
"SuspendProcesses": [
"HealthCheck",
"ReplaceUnhealthy",
"AZRebalance",
"AlarmNotification",
"ScheduledActions"
]
},
"AutoScalingScheduledAction": {
"IgnoreUnmodifiedGroupSizeProperties": true
}
Expand Down Expand Up @@ -1853,17 +1842,6 @@
]
},
"UpdatePolicy": {
"AutoScalingRollingUpdate": {
"WaitOnResourceSignals": false,
"PauseTime": "PT0S",
"SuspendProcesses": [
"HealthCheck",
"ReplaceUnhealthy",
"AZRebalance",
"AlarmNotification",
"ScheduledActions"
]
},
"AutoScalingScheduledAction": {
"IgnoreUnmodifiedGroupSizeProperties": true
}
Expand Down Expand Up @@ -2142,17 +2120,6 @@
]
},
"UpdatePolicy": {
"AutoScalingRollingUpdate": {
"WaitOnResourceSignals": false,
"PauseTime": "PT0S",
"SuspendProcesses": [
"HealthCheck",
"ReplaceUnhealthy",
"AZRebalance",
"AlarmNotification",
"ScheduledActions"
]
},
"AutoScalingScheduledAction": {
"IgnoreUnmodifiedGroupSizeProperties": true
}
Expand Down Expand Up @@ -2462,17 +2429,6 @@
]
},
"UpdatePolicy": {
"AutoScalingRollingUpdate": {
"WaitOnResourceSignals": false,
"PauseTime": "PT0S",
"SuspendProcesses": [
"HealthCheck",
"ReplaceUnhealthy",
"AZRebalance",
"AlarmNotification",
"ScheduledActions"
]
},
"AutoScalingScheduledAction": {
"IgnoreUnmodifiedGroupSizeProperties": true
}
Expand Down
19 changes: 19 additions & 0 deletions packages/@aws-cdk/aws-eks/test/test.cluster.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down Expand Up @@ -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();
Expand Down