From 6b763b7de5b175088a31cb15e72caa1a6cab319d Mon Sep 17 00:00:00 2001 From: Romain Marcadier-Muller Date: Thu, 25 Jul 2019 17:59:05 +0200 Subject: [PATCH] Revert "feat(autoscaling): health check configuration (#3390)" (#3435) The PR #3390 added AddCapacityOptions properties that return `@aws-cdk/aws-autoscaling.HealthCheck`, and `@aws-cdk/aws-ecs.HealthCheck` also exists. This caused the .NET code generation to emit ambiguous code that does not compile. Reverting as to enable a release. Related: aws/jsii#650 --- CHANGELOG.md | 1 - .../aws-autoscaling/lib/auto-scaling-group.ts | 66 +------------------ .../test/test.auto-scaling-group.ts | 43 ------------ 3 files changed, 1 insertion(+), 109 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 74e12b9d820a6..62f6154f792ea 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,7 +15,6 @@ All notable changes to this project will be documented in this file. See [standa ### Features -* **autoscaling:** health check configuration ([#3390](https://github.com/aws/aws-cdk/issues/3390)) ([c9a2c21](https://github.com/aws/aws-cdk/commit/c9a2c21)), closes [#3381](https://github.com/aws/aws-cdk/issues/3381) * **cli:** VPC context provider looks up RouteTable IDs ([#3171](https://github.com/aws/aws-cdk/issues/3171)) ([6d762f9](https://github.com/aws/aws-cdk/commit/6d762f9)) * **cloudformation:** update to Resource Specification v4.2.0 ([#3351](https://github.com/aws/aws-cdk/issues/3351)) ([9ec57af](https://github.com/aws/aws-cdk/commit/9ec57af)) * **cloudwatch:** dashboardName validation ([#3382](https://github.com/aws/aws-cdk/issues/3382)) ([f53f845](https://github.com/aws/aws-cdk/commit/f53f845)), closes [#2976](https://github.com/aws/aws-cdk/issues/2976) diff --git a/packages/@aws-cdk/aws-autoscaling/lib/auto-scaling-group.ts b/packages/@aws-cdk/aws-autoscaling/lib/auto-scaling-group.ts index 2782bb1905d89..6594dc67249e5 100644 --- a/packages/@aws-cdk/aws-autoscaling/lib/auto-scaling-group.ts +++ b/packages/@aws-cdk/aws-autoscaling/lib/auto-scaling-group.ts @@ -156,13 +156,6 @@ export interface CommonAutoScalingGroupProps { * @default none */ readonly spotPrice?: string; - - /** - * Configuration for health checks - * - * @default - HealthCheck.ec2 with no grace period - */ - readonly healthCheck?: HealthCheck; } /** @@ -451,9 +444,7 @@ export class AutoScalingGroup extends AutoScalingGroupBase implements ], } ], - vpcZoneIdentifier: subnetIds, - healthCheckType: props.healthCheck && props.healthCheck.type, - healthCheckGracePeriod: props.healthCheck && props.healthCheck.gracePeriod && props.healthCheck.gracePeriod.toSeconds(), + vpcZoneIdentifier: subnetIds }; if (!hasPublic && props.associatePublicIpAddress) { @@ -682,61 +673,6 @@ export enum ScalingProcess { ADD_TO_LOAD_BALANCER = 'AddToLoadBalancer' } -/** - * EC2 Heath check options - */ -export interface Ec2HealthCheckOptions { - /** - * Specified the time Auto Scaling waits before checking the health status of an EC2 instance that has come into service - * - * @default Duration.seconds(0) - */ - readonly grace?: Duration; -} - -/** - * ELB Heath check options - */ -export interface ElbHealthCheckOptions { - /** - * Specified the time Auto Scaling waits before checking the health status of an EC2 instance that has come into service - * - * This option is required for ELB health checks. - */ - readonly grace: Duration; -} - -/** - * Health check settings - */ -export class HealthCheck { - /** - * Use EC2 for health checks - * - * @param options EC2 health check options - */ - public static ec2(options: Ec2HealthCheckOptions = {}): HealthCheck { - return new HealthCheck(HealthCheckType.EC2, options.grace); - } - - /** - * Use ELB for health checks. - * It considers the instance unhealthy if it fails either the EC2 status checks or the load balancer health checks. - * - * @param options ELB health check options - */ - public static elb(options: ElbHealthCheckOptions): HealthCheck { - return new HealthCheck(HealthCheckType.ELB, options.grace); - } - - private constructor(public readonly type: string, public readonly gracePeriod?: Duration) { } -} - -enum HealthCheckType { - EC2 = 'EC2', - ELB = 'ELB', -} - /** * Render the rolling update configuration into the appropriate object */ diff --git a/packages/@aws-cdk/aws-autoscaling/test/test.auto-scaling-group.ts b/packages/@aws-cdk/aws-autoscaling/test/test.auto-scaling-group.ts index 722c368ccc2a4..89a456e40fe51 100644 --- a/packages/@aws-cdk/aws-autoscaling/test/test.auto-scaling-group.ts +++ b/packages/@aws-cdk/aws-autoscaling/test/test.auto-scaling-group.ts @@ -397,49 +397,6 @@ export = { test.done(); }, - 'can configure EC2 health check'(test: Test) { - // GIVEN - const stack = new cdk.Stack(undefined, 'MyStack', { env: { region: 'us-east-1', account: '1234' } }); - const vpc = mockVpc(stack); - - // WHEN - new autoscaling.AutoScalingGroup(stack, 'MyFleet', { - instanceType: ec2.InstanceType.of(ec2.InstanceClass.M4, ec2.InstanceSize.MICRO), - machineImage: new ec2.AmazonLinuxImage(), - vpc, - healthCheck: autoscaling.HealthCheck.ec2() - }); - - // THEN - expect(stack).to(haveResourceLike("AWS::AutoScaling::AutoScalingGroup", { - HealthCheckType: 'EC2', - })); - - test.done(); - }, - - 'can configure EBS health check'(test: Test) { - // GIVEN - const stack = new cdk.Stack(undefined, 'MyStack', { env: { region: 'us-east-1', account: '1234' } }); - const vpc = mockVpc(stack); - - // WHEN - new autoscaling.AutoScalingGroup(stack, 'MyFleet', { - instanceType: ec2.InstanceType.of(ec2.InstanceClass.M4, ec2.InstanceSize.MICRO), - machineImage: new ec2.AmazonLinuxImage(), - vpc, - healthCheck: autoscaling.HealthCheck.elb({grace: cdk.Duration.minutes(15)}) - }); - - // THEN - expect(stack).to(haveResourceLike("AWS::AutoScaling::AutoScalingGroup", { - HealthCheckType: 'ELB', - HealthCheckGracePeriod: 900 - })); - - test.done(); - }, - 'can add Security Group to Fleet'(test: Test) { // GIVEN const stack = new cdk.Stack(undefined, 'MyStack', { env: { region: 'us-east-1', account: '1234' } });