dcl-ops-lib 8.2.1 → 8.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/createFargateTask.d.ts +5 -1
- package/createFargateTask.js +9 -4
- package/package.json +1 -1
package/createFargateTask.d.ts
CHANGED
|
@@ -35,6 +35,7 @@ export type FargateTaskOptions = {
|
|
|
35
35
|
essential?: boolean;
|
|
36
36
|
command?: string[];
|
|
37
37
|
extraExposedServiceOptions?: ExtraExposedServiceOptions;
|
|
38
|
+
forceNewDeployment?: boolean;
|
|
38
39
|
extraPortMappings?: aws.ecs.PortMapping[];
|
|
39
40
|
extraALBMappings?: ALBMapping[];
|
|
40
41
|
executionRolePolicies?: Record<string, pulumi.Input<string> | aws.iam.Policy>;
|
|
@@ -56,6 +57,7 @@ export type FargateTaskOptions = {
|
|
|
56
57
|
runtimePlatform?: aws.types.input.ecs.TaskDefinitionRuntimePlatform;
|
|
57
58
|
appAutoscaling?: {
|
|
58
59
|
maxCapacity: number;
|
|
60
|
+
minCapacity?: number;
|
|
59
61
|
policy?: {
|
|
60
62
|
metricName: string;
|
|
61
63
|
targetValue: number;
|
|
@@ -73,7 +75,7 @@ export type FargateTaskOptions = {
|
|
|
73
75
|
* Rate expressions - "rate(value unit)"
|
|
74
76
|
* Cron expressions - "cron(fields)"
|
|
75
77
|
* @type {string}
|
|
76
|
-
|
|
78
|
+
*/
|
|
77
79
|
schedule: string;
|
|
78
80
|
}[];
|
|
79
81
|
};
|
|
@@ -122,6 +124,7 @@ export type InternalServiceOptions = {
|
|
|
122
124
|
taskRole?: aws.iam.Role;
|
|
123
125
|
containerInfo: aws.ecs.ContainerDefinition;
|
|
124
126
|
assignPublicIp?: boolean;
|
|
127
|
+
forceNewDeployment?: boolean;
|
|
125
128
|
dependsOn?: pulumi.Resource[];
|
|
126
129
|
volumes?: pulumi.Input<aws.types.input.ecs.TaskDefinitionVolume[]>;
|
|
127
130
|
team: string;
|
|
@@ -129,6 +132,7 @@ export type InternalServiceOptions = {
|
|
|
129
132
|
runtimePlatform?: aws.types.input.ecs.TaskDefinitionRuntimePlatform;
|
|
130
133
|
appAutoscaling?: {
|
|
131
134
|
maxCapacity: number;
|
|
135
|
+
minCapacity?: number;
|
|
132
136
|
policy?: {
|
|
133
137
|
metricName: string;
|
|
134
138
|
targetValue: number;
|
package/createFargateTask.js
CHANGED
|
@@ -115,7 +115,7 @@ function getFargateTaskRole(name, policyArnNamedMap) {
|
|
|
115
115
|
*/
|
|
116
116
|
function createFargateTask(serviceName, dockerImage, dockerListeningPort, environment, hostname, options) {
|
|
117
117
|
return __awaiter(this, void 0, void 0, function* () {
|
|
118
|
-
let { healthCheck, healthCheckContainer, essential, dontExpose, securityGroups, cluster, memoryReservation, command, version, ephemeralStorageInGB, desiredCount, cpuReservation, extraPortMappings, extraALBMappings, executionRolePolicies, taskRolePolicies, ignoreServiceDiscovery, secrets, metrics, dontAssignPublicIp, dependsOn, volumes, deregistrationDelay, mountPoints, repositoryCredentials, team, appAutoscaling, } = options;
|
|
118
|
+
let { healthCheck, healthCheckContainer, essential, dontExpose, securityGroups, cluster, memoryReservation, command, version, ephemeralStorageInGB, desiredCount, cpuReservation, extraPortMappings, extraALBMappings, executionRolePolicies, taskRolePolicies, ignoreServiceDiscovery, secrets, metrics, forceNewDeployment, dontAssignPublicIp, dependsOn, volumes, deregistrationDelay, mountPoints, repositoryCredentials, team, appAutoscaling, } = options;
|
|
119
119
|
if (undefined === essential) {
|
|
120
120
|
essential = true;
|
|
121
121
|
}
|
|
@@ -217,6 +217,7 @@ function createFargateTask(serviceName, dockerImage, dockerListeningPort, enviro
|
|
|
217
217
|
taskRole,
|
|
218
218
|
assignPublicIp: !dontAssignPublicIp,
|
|
219
219
|
serviceDiscoveryPort,
|
|
220
|
+
forceNewDeployment,
|
|
220
221
|
ignoreServiceDiscovery,
|
|
221
222
|
securityGroups: [taskSecurityGroup.id, ...securityGroups],
|
|
222
223
|
containerInfo: {
|
|
@@ -272,6 +273,7 @@ function createFargateTask(serviceName, dockerImage, dockerListeningPort, enviro
|
|
|
272
273
|
ephemeralStorageInGB,
|
|
273
274
|
executionRole,
|
|
274
275
|
taskRole,
|
|
276
|
+
forceNewDeployment,
|
|
275
277
|
assignPublicIp: !dontAssignPublicIp,
|
|
276
278
|
ignoreServiceDiscovery,
|
|
277
279
|
securityGroups: [taskSecurityGroup.id, ...securityGroups],
|
|
@@ -304,7 +306,7 @@ function createFargateTask(serviceName, dockerImage, dockerListeningPort, enviro
|
|
|
304
306
|
function createInternalService(config) {
|
|
305
307
|
return __awaiter(this, void 0, void 0, function* () {
|
|
306
308
|
var _a, _b;
|
|
307
|
-
let { serviceName, cluster, securityGroups, ignoreServiceDiscovery, serviceDiscoveryPort, desiredCount, executionRole, taskRole, containerInfo, assignPublicIp, dependsOn, volumes, team, targetGroups, runtimePlatform, ephemeralStorageInGB, appAutoscaling, } = config;
|
|
309
|
+
let { serviceName, cluster, securityGroups, ignoreServiceDiscovery, serviceDiscoveryPort, desiredCount, executionRole, taskRole, containerInfo, assignPublicIp, dependsOn, volumes, team, targetGroups, runtimePlatform, ephemeralStorageInGB, appAutoscaling, forceNewDeployment, } = config;
|
|
308
310
|
if (!desiredCount && desiredCount !== 0)
|
|
309
311
|
desiredCount = 1;
|
|
310
312
|
assignPublicIp = !!assignPublicIp;
|
|
@@ -362,6 +364,7 @@ function createInternalService(config) {
|
|
|
362
364
|
desiredCount,
|
|
363
365
|
launchType: "FARGATE",
|
|
364
366
|
enableEcsManagedTags: true,
|
|
367
|
+
forceNewDeployment,
|
|
365
368
|
waitForSteadyState: false,
|
|
366
369
|
taskDefinition: taskDefinition.arn,
|
|
367
370
|
loadBalancers: [
|
|
@@ -379,12 +382,14 @@ function createInternalService(config) {
|
|
|
379
382
|
});
|
|
380
383
|
}
|
|
381
384
|
function setAutoscaling(service, serviceName, config) {
|
|
382
|
-
|
|
385
|
+
var _a;
|
|
386
|
+
if ((!config.appAutoscaling.policy && !config.appAutoscaling.scheduleAction) ||
|
|
387
|
+
(config.appAutoscaling.policy && config.appAutoscaling.scheduleAction)) {
|
|
383
388
|
throw new Error("Invalid autoscaling configuration. You must provide either a policy OR a scheduleAction.");
|
|
384
389
|
}
|
|
385
390
|
const ecsTarget = new aws.appautoscaling.Target(`ecs-target-${(0, stack_1.getStackScopedName)(serviceName)}`, {
|
|
386
391
|
maxCapacity: config.appAutoscaling.maxCapacity,
|
|
387
|
-
minCapacity: config.desiredCount,
|
|
392
|
+
minCapacity: (_a = config.appAutoscaling.minCapacity) !== null && _a !== void 0 ? _a : config.desiredCount,
|
|
388
393
|
resourceId: service.id.apply((id) => {
|
|
389
394
|
return id.split(":").pop();
|
|
390
395
|
}),
|