Skip to content

Commit

Permalink
fix: revert timeout feature
Browse files Browse the repository at this point in the history
  • Loading branch information
tractorcow committed Oct 10, 2024
1 parent 1d0f22b commit e577684
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 51 deletions.
2 changes: 0 additions & 2 deletions dist/fargate.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
22 changes: 1 addition & 21 deletions dist/fargate.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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
Expand Down
28 changes: 0 additions & 28 deletions src/fargate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down Expand Up @@ -51,8 +50,6 @@ interface FargateServiceProps extends cdk.NestedStackProps {
repository?: ecr.IRepository
taskConfiguration: TaskConfiguration
image?: ecs.ContainerImage
createTimeout?: string
updateTimeout?: string
}

/**
Expand Down Expand Up @@ -80,8 +77,6 @@ export class FargateService extends cdk.NestedStack {
zone,
repository,
taskConfiguration,
createTimeout,
updateTimeout,
} = props

// Compile secrets into list of mapped ecs.Secrets
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit e577684

Please sign in to comment.