-
Notifications
You must be signed in to change notification settings - Fork 5.1k
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
Handle empty ECS Clusters properly #2170
Conversation
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.
LGTM 👍
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.
LGTM
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.
LGTM
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.
LGTM
This PR fixes a bug in the ECS provider.
When the ECS Provider is configured to poll multiple clusters, it'll show unexpected behavior when one of the clusters has 'zero' tasks running.
If the first cluster Traefik encounters has no running tasks the listInstances function is ended immediately by returning an empty slice of ecsInstances. Successive clusters are simply ignored.
If the 2nd or up cluster has no tasks running the listInstances function will continue trying to fetch data for these non-existing-tasks. The 'early return' condition will not detect this due to counting the length of taskArns slice. This slice var is used by each cluster discovery without being emptied, so it'll be filled with taskArns from the previous cluster. This eventually results in incomplete API calls to AWS ECS.
In the 2nd case Traefik (lookupEc2Instances) sends a 'DescribeContainerInstances' request to AWS with an 'empty' list of containerArns. AWS returns a 4xx.
Fix:
len(taskArns) == 0
. Justcontinue
to the next iteration of the loop.Fixes #2168