Skip to content

Commit

Permalink
updated changes
Browse files Browse the repository at this point in the history
  • Loading branch information
homakk committed Apr 24, 2023
1 parent ee59ea9 commit e957372
Show file tree
Hide file tree
Showing 10 changed files with 29 additions and 62 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ export interface ApplicationLoadBalancedServiceBaseProps {
*
* @default none
*/
readonly taskImageOptions?: ApplicationLoadBalancedFargateTaskImageOptions;
readonly taskImageOptions?: ApplicationLoadBalancedTaskImageOptions;

/**
* Determines whether the Load Balancer will be internet-facing.
Expand Down Expand Up @@ -279,17 +279,6 @@ export interface ApplicationLoadBalancedServiceBaseProps {
readonly idleTimeout?: Duration;
}

export interface ApplicationLoadBalancedFargateTaskImageOptions extends ApplicationLoadBalancedTaskImageOptions {
/**
* The amount (in GiB) of ephemeral storage to be allocated to the task. The maximum supported value is 200GiB.
*
* NOTE: This parameter is only supported for tasks hosted on AWS Fargate using platform version 1.4.0 or later.
*
* @default - Undefined, in which case, the task will receive 20GiB ephemeral storage.
*/
readonly ephemeralStorageGiB?: number;
}

export interface ApplicationLoadBalancedTaskImageOptions {
/**
* The image used to start a container. Image or taskDefinition must be specified, not both.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ export interface ApplicationMultipleTargetGroupsServiceBaseProps {
*
* @default none
*/
readonly taskImageOptions?: ApplicationLoadBalancedFargateTaskImageProps;
readonly taskImageOptions?: ApplicationLoadBalancedTaskImageProps;

/**
* The desired number of instantiations of the task definition to keep running on the service.
Expand Down Expand Up @@ -116,17 +116,6 @@ export interface ApplicationMultipleTargetGroupsServiceBaseProps {
readonly enableExecuteCommand?: boolean;
}

export interface ApplicationLoadBalancedFargateTaskImageProps extends ApplicationLoadBalancedTaskImageProps {
/**
* The amount (in GiB) of ephemeral storage to be allocated to the task. The maximum supported value is 200GiB.
*
* NOTE: This parameter is only supported for tasks hosted on AWS Fargate using platform version 1.4.0 or later.
*
* @default - Undefined, in which case, the task will receive 20GiB ephemeral storage.
*/
readonly ephemeralStorageGiB?: number;
}

/**
* Options for configuring a new container.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,3 +80,14 @@ export interface FargateServiceBaseProps {
*/
readonly runtimePlatform?: RuntimePlatform;
}

export interface FargateTaskImageOptions {
/**
* The amount (in GiB) of ephemeral storage to be allocated to the task. The maximum supported value is 200GiB.
*
* NOTE: This parameter is only supported for tasks hosted on AWS Fargate using platform version 1.4.0 or later.
*
* @default - Undefined, in which case, the task will receive 20GiB ephemeral storage.
*/
readonly ephemeralStorageGiB?: number;
}
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ export interface NetworkLoadBalancedServiceBaseProps {
*
* @default - none
*/
readonly taskImageOptions?: NetworkLoadBalancedFargateTaskImageOptions;
readonly taskImageOptions?: NetworkLoadBalancedTaskImageOptions;

/**
* Determines whether the Load Balancer will be internet-facing.
Expand Down Expand Up @@ -287,17 +287,6 @@ export interface NetworkLoadBalancedTaskImageOptions {
readonly dockerLabels?: { [key: string]: string };
}

export interface NetworkLoadBalancedFargateTaskImageOptions extends NetworkLoadBalancedTaskImageOptions {
/**
* The amount (in GiB) of ephemeral storage to be allocated to the task. The maximum supported value is 200GiB.
*
* NOTE: This parameter is only supported for tasks hosted on AWS Fargate using platform version 1.4.0 or later.
*
* @default - Undefined, in which case, the task will receive 20GiB ephemeral storage.
*/
readonly ephemeralStorageGiB?: number;
}

/**
* The base class for NetworkLoadBalancedEc2Service and NetworkLoadBalancedFargateService services.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ export interface NetworkMultipleTargetGroupsServiceBaseProps {
*
* @default - none
*/
readonly taskImageOptions?: NetworkLoadBalancedFargateTaskImageProps;
readonly taskImageOptions?: NetworkLoadBalancedTaskImageProps;

/**
* The desired number of instantiations of the task definition to keep running on the service.
Expand Down Expand Up @@ -198,17 +198,6 @@ export interface NetworkLoadBalancedTaskImageProps {
readonly dockerLabels?: { [key: string]: string };
}

export interface NetworkLoadBalancedFargateTaskImageProps extends NetworkLoadBalancedTaskImageProps {
/**
* The amount (in GiB) of ephemeral storage to be allocated to the task. The maximum supported value is 200GiB.
*
* NOTE: This parameter is only supported for tasks hosted on AWS Fargate using platform version 1.4.0 or later.
*
* @default - Undefined, in which case, the task will receive 20GiB ephemeral storage.
*/
readonly ephemeralStorageGiB?: number;
}

/**
* Properties to define an network load balancer.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ import { FeatureFlags } from '../../../core';
import * as cxapi from '../../../cx-api';
import { Construct } from 'constructs';
import { ApplicationLoadBalancedServiceBase, ApplicationLoadBalancedServiceBaseProps } from '../base/application-load-balanced-service-base';
import { FargateServiceBaseProps } from '../base/fargate-service-base';
import { FargateServiceBaseProps, FargateTaskImageOptions } from '../base/fargate-service-base';
/**
* The properties for the ApplicationLoadBalancedFargateService service.
*/
export interface ApplicationLoadBalancedFargateServiceProps extends ApplicationLoadBalancedServiceBaseProps, FargateServiceBaseProps {
export interface ApplicationLoadBalancedFargateServiceProps extends ApplicationLoadBalancedServiceBaseProps, FargateServiceBaseProps, FargateTaskImageOptions {
/**
* Determines whether the service will be assigned a public IP address.
*
Expand Down Expand Up @@ -71,7 +71,7 @@ export class ApplicationLoadBalancedFargateService extends ApplicationLoadBalanc
taskRole: taskImageOptions.taskRole,
family: taskImageOptions.family,
runtimePlatform: props.runtimePlatform,
ephemeralStorageGiB: taskImageOptions.ephemeralStorageGiB,
ephemeralStorageGiB: props.ephemeralStorageGiB,
});

// Create log driver if logging is enabled
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@ import {
ApplicationMultipleTargetGroupsServiceBase,
ApplicationMultipleTargetGroupsServiceBaseProps,
} from '../base/application-multiple-target-groups-service-base';
import { FargateServiceBaseProps } from '../base/fargate-service-base';
import { FargateServiceBaseProps, FargateTaskImageOptions } from '../base/fargate-service-base';

/**
* The properties for the ApplicationMultipleTargetGroupsFargateService service.
*/
export interface ApplicationMultipleTargetGroupsFargateServiceProps extends ApplicationMultipleTargetGroupsServiceBaseProps, FargateServiceBaseProps {
export interface ApplicationMultipleTargetGroupsFargateServiceProps extends ApplicationMultipleTargetGroupsServiceBaseProps, FargateServiceBaseProps, FargateTaskImageOptions {

/**
* Determines whether the service will be assigned a public IP address.
Expand Down Expand Up @@ -69,7 +69,7 @@ export class ApplicationMultipleTargetGroupsFargateService extends ApplicationMu
taskRole: taskImageOptions.taskRole,
family: taskImageOptions.family,
runtimePlatform: props.runtimePlatform,
ephemeralStorageGiB: taskImageOptions.ephemeralStorageGiB,
ephemeralStorageGiB: props.ephemeralStorageGiB,
});

const containerName = taskImageOptions.containerName ?? 'web';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@ import { FargateService, FargateTaskDefinition } from '../../../aws-ecs';
import { FeatureFlags } from '../../../core';
import * as cxapi from '../../../cx-api';
import { Construct } from 'constructs';
import { FargateServiceBaseProps } from '../base/fargate-service-base';
import { FargateServiceBaseProps, FargateTaskImageOptions } from '../base/fargate-service-base';
import { NetworkLoadBalancedServiceBase, NetworkLoadBalancedServiceBaseProps } from '../base/network-load-balanced-service-base';

/**
* The properties for the NetworkLoadBalancedFargateService service.
*/
export interface NetworkLoadBalancedFargateServiceProps extends NetworkLoadBalancedServiceBaseProps, FargateServiceBaseProps {
export interface NetworkLoadBalancedFargateServiceProps extends NetworkLoadBalancedServiceBaseProps, FargateServiceBaseProps, FargateTaskImageOptions {

/**
* Determines whether the service will be assigned a public IP address.
Expand Down Expand Up @@ -62,7 +62,7 @@ export class NetworkLoadBalancedFargateService extends NetworkLoadBalancedServic
taskRole: taskImageOptions.taskRole,
family: taskImageOptions.family,
runtimePlatform: props.runtimePlatform,
ephemeralStorageGiB: taskImageOptions.ephemeralStorageGiB,
ephemeralStorageGiB: props.ephemeralStorageGiB,
});

// Create log driver if logging is enabled
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { NetworkTargetGroup } from '../../../aws-elasticloadbalancingv2';
import { FeatureFlags } from '../../../core';
import * as cxapi from '../../../cx-api';
import { Construct } from 'constructs';
import { FargateServiceBaseProps } from '../base/fargate-service-base';
import { FargateServiceBaseProps, FargateTaskImageOptions } from '../base/fargate-service-base';
import {
NetworkMultipleTargetGroupsServiceBase,
NetworkMultipleTargetGroupsServiceBaseProps,
Expand All @@ -12,7 +12,7 @@ import {
/**
* The properties for the NetworkMultipleTargetGroupsFargateService service.
*/
export interface NetworkMultipleTargetGroupsFargateServiceProps extends NetworkMultipleTargetGroupsServiceBaseProps, FargateServiceBaseProps {
export interface NetworkMultipleTargetGroupsFargateServiceProps extends NetworkMultipleTargetGroupsServiceBaseProps, FargateServiceBaseProps, FargateTaskImageOptions {

/**
* Determines whether the service will be assigned a public IP address.
Expand Down Expand Up @@ -69,7 +69,7 @@ export class NetworkMultipleTargetGroupsFargateService extends NetworkMultipleTa
taskRole: taskImageOptions.taskRole,
family: taskImageOptions.family,
runtimePlatform: props.runtimePlatform,
ephemeralStorageGiB: taskImageOptions.ephemeralStorageGiB,
ephemeralStorageGiB: props.ephemeralStorageGiB,
});

const containerName = taskImageOptions.containerName ?? 'web';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ test('setting loadBalancerType to Network creates an NLB Public', () => {
cluster,
taskImageOptions: {
image: ecs.ContainerImage.fromRegistry('/aws/aws-example-app'),
ephemeralStorageGiB: 100,
},
ephemeralStorageGiB: 100,
});

// THEN
Expand Down Expand Up @@ -225,8 +225,8 @@ test('setting healthCheckGracePeriod works', () => {
new ecsPatterns.ApplicationLoadBalancedFargateService(stack, 'Service', {
taskImageOptions: {
image: ecs.ContainerImage.fromRegistry('/aws/aws-example-app'),
ephemeralStorageGiB: 100,
},
ephemeralStorageGiB: 100,
healthCheckGracePeriod: cdk.Duration.seconds(600),
});
// THEN
Expand Down

0 comments on commit e957372

Please sign in to comment.