quintilesims / layer0

Build, Manage, and Deploy Your Applications
Apache License 2.0
44 stars 20 forks source link

Scaler: 'Invalid characters' error when environment is scaled to `0:0:0` #449

Closed tlake closed 6 years ago

tlake commented 6 years ago

Expected behavior

The scaler should run through its logic and safely determine that although its desired scale may be 1, the max-scale is 0, and so no action should be taken.

Actual behavior

The scaler errors about invalid characters when trying to gather resource consumers, because a string like "ecs-svc/12345678901234567890" is being passed as the deployID in the input object for ECS.DescribeTaskDefinition().

The function chain goes like this:

The error returned looks like this:

[ERROR] [Worker] [2]: Failed to run job 1513309417745904574: ClientException: Family contains invalid characters.

Steps to reproduce the behavior

The most basic guestbook app in from guides/walkthrough-1 is a good candidate for creating this scenario. Deploy it as usual, then scale the environment to 0:0:0.

diemonster commented 6 years ago

On https://github.com/quintilesims/layer0/blob/env-scaler/api/provider/aws/environment_scaler.go#L328, we loop through service.Deployments and append to deployIDCopies, but what we're getting out of that isn’t actually layer0 deployIDs. Off the top of my head, the id may just be everything post the / in "ecs-svc/12345678901234567890", but I'll verify that...

tlake commented 6 years ago

The input to ECS.DescribeTaskDefinition() actually takes a task definition ARN as the ID, so I've reworked the code to use the ARN as deployID instead of the Deployment.ID. Seems to have done the trick!