Update controller to cleanup tokens from auth method #82
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Changes proposed in this PR:
This updates the ACL controller to cleanup tokens created by the auth method. The controller's reconcile operation now tracks tasks by task id. It parses the JSON formatted metadata from each ACL token description to determine the task id which created the token. Tokens for which there is no longer an ECS task running are deleted.
This PR also removes the controller's "old" behavior of managing tokens based on service names. The controller no longer creates any tokens, and is only responsible for cleaning up tokens created from a
consul login
command.In order for the controller to cleanup a token, the token must have been created with metadata when running the
consul login
command, which indicates the task id and cluster:When the token is created, the metadata is placed in the token description as a JSON string:
This updates the controller to consistently use the full cluster ARN. The task metadata has a
Cluster
field, which is the cluster ARN on Fargate but is only the cluster name on EC2.How I've tested this PR:
How I expect reviewers to test this PR:
Checklist: