From e577684cb6e3f472639918c304d8826d9242fbba Mon Sep 17 00:00:00 2001 From: Damian Mooyman Date: Thu, 10 Oct 2024 14:33:57 +1300 Subject: [PATCH] fix: revert timeout feature --- dist/fargate.d.ts | 2 -- dist/fargate.js | 22 +--------------------- src/fargate.ts | 28 ---------------------------- 3 files changed, 1 insertion(+), 51 deletions(-) diff --git a/dist/fargate.d.ts b/dist/fargate.d.ts index f8da2c9..3700814 100644 --- a/dist/fargate.d.ts +++ b/dist/fargate.d.ts @@ -35,8 +35,6 @@ interface FargateServiceProps extends cdk.NestedStackProps { repository?: ecr.IRepository; taskConfiguration: TaskConfiguration; image?: ecs.ContainerImage; - createTimeout?: string; - updateTimeout?: string; } /** * Generate a fargate service that can be attached to a cluster. This service will include its own diff --git a/dist/fargate.js b/dist/fargate.js index 89390cb..c028626 100644 --- a/dist/fargate.js +++ b/dist/fargate.js @@ -47,7 +47,7 @@ const DEFAULT_IMAGE = 'nginxdemos/hello:latest'; class FargateService extends cdk.NestedStack { constructor(scope, id, props) { super(scope, id, props); - const { healthCheckPath = '/health-check', imageVersion = 'latest', subDomainIncludingDot = '', stack, cluster, certificate, zone, repository, taskConfiguration, createTimeout, updateTimeout, } = props; + const { healthCheckPath = '/health-check', imageVersion = 'latest', subDomainIncludingDot = '', stack, cluster, certificate, zone, repository, taskConfiguration, } = props; // Compile secrets into list of mapped ecs.Secrets const secrets = {}; const secretValues = taskConfiguration.secrets; @@ -86,26 +86,6 @@ class FargateService extends cdk.NestedStack { onePerAz: true, }, }); - // Extract the low-level CloudFormation resource for the Fargate Service - const cfnService = this.service.service.node.defaultChild; - // Add wait timeout for creation - if (createTimeout) { - cfnService.addPropertyOverride('CreationPolicy', { - ResourceSignal: { - Timeout: createTimeout, // Timeout after 15 minutes - }, - }); - } - // Add wait timeout for updates - if (updateTimeout) { - cfnService.addPropertyOverride('UpdatePolicy', { - AutoScalingRollingUpdate: { - MinInstancesInService: '1', - MaxBatchSize: '1', - PauseTime: updateTimeout, - }, - }); - } // Setup AutoScaling policy if (taskConfiguration.autoScalingCpuTarget) { // Default max capacity to double desired unless specified diff --git a/src/fargate.ts b/src/fargate.ts index 59e019a..44ee479 100644 --- a/src/fargate.ts +++ b/src/fargate.ts @@ -12,7 +12,6 @@ import * as targets from 'aws-cdk-lib/aws-route53-targets' import { StackConfig } from './configuration' import { ARecord } from './route53' import * as elb from 'aws-cdk-lib/aws-elasticloadbalancingv2' -import { CfnService } from 'aws-cdk-lib/aws-ecs' // Default docker image to use const DEFAULT_IMAGE = 'nginxdemos/hello:latest' @@ -51,8 +50,6 @@ interface FargateServiceProps extends cdk.NestedStackProps { repository?: ecr.IRepository taskConfiguration: TaskConfiguration image?: ecs.ContainerImage - createTimeout?: string - updateTimeout?: string } /** @@ -80,8 +77,6 @@ export class FargateService extends cdk.NestedStack { zone, repository, taskConfiguration, - createTimeout, - updateTimeout, } = props // Compile secrets into list of mapped ecs.Secrets @@ -135,29 +130,6 @@ export class FargateService extends cdk.NestedStack { }, ) - // Extract the low-level CloudFormation resource for the Fargate Service - const cfnService = this.service.service.node.defaultChild as CfnService - - // Add wait timeout for creation - if (createTimeout) { - cfnService.addPropertyOverride('CreationPolicy', { - ResourceSignal: { - Timeout: createTimeout, // Timeout after 15 minutes - }, - }) - } - - // Add wait timeout for updates - if (updateTimeout) { - cfnService.addPropertyOverride('UpdatePolicy', { - AutoScalingRollingUpdate: { - MinInstancesInService: '1', - MaxBatchSize: '1', - PauseTime: updateTimeout, - }, - }) - } - // Setup AutoScaling policy if (taskConfiguration.autoScalingCpuTarget) { // Default max capacity to double desired unless specified