dcl-ops-lib 6.7.1 → 6.8.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.js +11 -8
- package/package.json +1 -1
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, } = options;
|
|
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;
|
|
119
119
|
if (undefined === essential) {
|
|
120
120
|
essential = true;
|
|
121
121
|
}
|
|
@@ -236,7 +236,8 @@ function createFargateTask(serviceName, dockerImage, dockerListeningPort, enviro
|
|
|
236
236
|
volumes,
|
|
237
237
|
team,
|
|
238
238
|
targetGroups,
|
|
239
|
-
runtimePlatform: options.runtimePlatform
|
|
239
|
+
runtimePlatform: options.runtimePlatform,
|
|
240
|
+
appAutoscaling
|
|
240
241
|
});
|
|
241
242
|
return {
|
|
242
243
|
service,
|
|
@@ -289,7 +290,8 @@ function createFargateTask(serviceName, dockerImage, dockerListeningPort, enviro
|
|
|
289
290
|
volumes,
|
|
290
291
|
team,
|
|
291
292
|
targetGroups,
|
|
292
|
-
runtimePlatform: options.runtimePlatform
|
|
293
|
+
runtimePlatform: options.runtimePlatform,
|
|
294
|
+
appAutoscaling
|
|
293
295
|
});
|
|
294
296
|
return { endpoint: `https://${hostname}/`, service, exposed };
|
|
295
297
|
});
|
|
@@ -297,7 +299,7 @@ function createFargateTask(serviceName, dockerImage, dockerListeningPort, enviro
|
|
|
297
299
|
function createInternalService(config) {
|
|
298
300
|
return __awaiter(this, void 0, void 0, function* () {
|
|
299
301
|
var _a, _b;
|
|
300
|
-
let { serviceName, cluster, securityGroups, ignoreServiceDiscovery, serviceDiscoveryPort, desiredCount, executionRole, taskRole, containerInfo, assignPublicIp, dependsOn, volumes, team, targetGroups, runtimePlatform, ephemeralStorageInGB } = config;
|
|
302
|
+
let { serviceName, cluster, securityGroups, ignoreServiceDiscovery, serviceDiscoveryPort, desiredCount, executionRole, taskRole, containerInfo, assignPublicIp, dependsOn, volumes, team, targetGroups, runtimePlatform, ephemeralStorageInGB, appAutoscaling } = config;
|
|
301
303
|
if (!desiredCount)
|
|
302
304
|
desiredCount = 1;
|
|
303
305
|
assignPublicIp = !!assignPublicIp;
|
|
@@ -361,8 +363,9 @@ function createInternalService(config) {
|
|
|
361
363
|
}))
|
|
362
364
|
]
|
|
363
365
|
}, Object.assign(Object.assign({}, extraOpts), { dependsOn }));
|
|
364
|
-
|
|
365
|
-
|
|
366
|
+
console.log('Should set-up autoscaling', { should: !!appAutoscaling });
|
|
367
|
+
if (!!appAutoscaling) {
|
|
368
|
+
setAutoscaling(service, Object.assign(Object.assign({}, appAutoscaling), { desiredCount }));
|
|
366
369
|
}
|
|
367
370
|
return service;
|
|
368
371
|
});
|
|
@@ -392,7 +395,7 @@ function setAutoscaling(service, config) {
|
|
|
392
395
|
if (config.metricName === "ApproximateNumberOfMessagesVisible") {
|
|
393
396
|
TTS_CustomizedMetricSpecification = CSM_ApproximateNumberOfMessagesVisible;
|
|
394
397
|
}
|
|
395
|
-
new aws.appautoscaling.Policy(`ecs-autoscaling-policy-${taskUniqueIdentifier}`, {
|
|
398
|
+
return new aws.appautoscaling.Policy(`ecs-autoscaling-policy-${taskUniqueIdentifier}`, {
|
|
396
399
|
policyType: "TargetTrackingScaling",
|
|
397
400
|
resourceId: ecsTarget.resourceId,
|
|
398
401
|
scalableDimension: ecsTarget.scalableDimension,
|
|
@@ -403,6 +406,6 @@ function setAutoscaling(service, config) {
|
|
|
403
406
|
scaleOutCooldown: config.scaleOutCooldown,
|
|
404
407
|
scaleInCooldown: config.scaleInCooldown,
|
|
405
408
|
},
|
|
406
|
-
});
|
|
409
|
+
}, { dependsOn: [ecsTarget] });
|
|
407
410
|
}
|
|
408
411
|
//# sourceMappingURL=createFargateTask.js.map
|