-
Notifications
You must be signed in to change notification settings - Fork 302
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Attribute checker feature #444
Conversation
Adding @PettitWesley @allisaurus @SoManyHs |
@nithu0115 Can you change the command and output to look like this:
The https://github.com/aws/amazon-ecs-cli/blob/master/ecs-cli/modules/cli/compose/container/container.go#L123 |
Output as a table:
|
ecs-cli/modules/cli/attributechecker/attribute_checker_app_test.go
Outdated
Show resolved
Hide resolved
ecs-cli/modules/cli/attributechecker/attribute_checker_app_test.go
Outdated
Show resolved
Hide resolved
ecs-cli/modules/commands/attributechecker/attribute_checker_command.go
Outdated
Show resolved
Hide resolved
@PettitWesley, please take a look at the latest commit. |
"By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license." |
7993054
to
6053543
Compare
930944a
to
1a8f128
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Did some final testing (all results are what I expect):
$ ecs-cli check-attributes --container-instances 28c5abd2-360e-41a0-81d8-0afca2d08d9b,45510138-f24f-47c6-a418-71c46dd51f88,ae66e18e-1d46-47ff-81c5-647f0f1426ce,dffe7f91-8faa-4e00-983b-c58fd279cf6d --cluster practice-cluster --region us-east-2 --task-def fluentd-kinesis
Container Instance Missing Attributes
dffe7f91-8faa-4e00-983b-c58fd279cf6d None
28c5abd2-360e-41a0-81d8-0afca2d08d9b com.amazonaws.ecs.capability.logging-driver.fluentd
45510138-f24f-47c6-a418-71c46dd51f88 None
ae66e18e-1d46-47ff-81c5-647f0f1426ce com.amazonaws.ecs.capability.logging-driver.fluentd
$ ecs-cli check-attributes --container-instances 28c5abd2-360e-41a0-81d8-0afca2d08d9b,45510138-f24f-47c6-a418-71c46dd51f88,ae66e18e-1d46-47ff-81c5-647f0f1426ce,dffe7f91-8faa-4e00-983b-c58fd279cf6d --cluster practice-cluster --region us-east-2 --task-def fluentdrouter:3
FATA[0000] Error executing 'Attribute Checker': Failed to Describe TaskDefinition, please check the region/taskDefinition values: ClientException: Unable to describe task definition.
status code: 400, request id: 3f57aa92-2ffa-11e9-9e15-01d8bc5164b8
$ ecs-cli check-attributes --container-instances 92254393-63a1-4a22-9603-3c9e12167aa1 --cluster mu-environment-acceptance --region us-west-2 --task-def fluentdrouter:3
Container Instance Missing Attributes
92254393-63a1-4a22-9603-3c9e12167aa1 com.amazonaws.ecs.capability.logging-driver.aws-fluentd-router
$ ecs-cli check-attributes --container-instances f9084017-b207-4a0f-a14e-4ccc737266d5 --cluster blogpost --region us-west-2 --task-def fluentdrouter:3
Container Instance Missing Attributes
f9084017-b207-4a0f-a14e-4ccc737266d5 None
$ ecs-cli check-attributes --container-instances f9084017-b207-4a0f-a14e-4ccc737266d5 --region us-west-2 --task-def fluentdrouter:3
FATA[0000] Error executing 'Attribute Checker': Failed to Describe Container Instances, please check region/containerInstance/cluster values: Failures [{
Arn: "arn:aws:ecs:us-west-2:144718711470:container-instance/f9084017-b207-4a0f-a14e-4ccc737266d5",
Reason: "MISSING"
}]
… the attributes required to run a given task definition
Currently, our console or AWS CLI will throw a random error when RunTask API is called if a Container Instance has a missing Attribute and will not give enough reason on what is missing - "Reason":"Attribute"
This feature will check an compare if a Container Instance(s) has all required attributes to Run a Task and returns missing Attribute.
$ ./ecs-cli attribute-checker --task-def awsvpc-nginx:14 --container-instances "c998e09d-164e-447f-9d29-642ed6cc66a4,6f10952d-7133-4031-aa6b-8035eb449c09" --cluster Prod --region us-east-1
Done, parsing Container Instance "arn:aws:ecs:us-east-1:364336798170:container-instance/c998e09d-164e-447f-9d29-642ed6cc66a4" Attributes
Missing "ecs.capability.execution-role-awslogs" attribute on Container Instance "arn:aws:ecs:us-east-1:364336798170:container-instance/6f10952d-7133-4031-aa6b-8035eb449c09"
Done, parsing Container Instance "arn:aws:ecs:us-east-1:364336798170:container-instance/6f10952d-7133-4031-aa6b-8035eb449c09" Attributes
Error if all required parameters are passed:
$ ./ecs-cli attribute-checker --container-instances "c998e09d-164e-447f-9d29-642ed6cc66a4,6f10952d-7133-4031-aa6b-8035eb449c09" --cluster Prod --region us-east-1
FATA[0000] Error executing 'Attribute Checker': TaskDefinition must be specified with the --task-def flag
$./ecs-cli attribute-checker --task-def awsvpc-nginx:14 --cluster Prod --region us-east-1
FATA[0000] Error executing 'Attribute Checker': ContainerInstance(s) must be specified with the --container-instances flag