aws / amazon-ecs-agent

Amazon Elastic Container Service Agent
http://aws.amazon.com/ecs/
Apache License 2.0
2.08k stars 616 forks source link

NewInstanceCredentialsCache returns *aws.CredentialsCache #4431

Closed tinnywang closed 1 week ago

tinnywang commented 2 weeks ago

Summary

Fix NewInstanceCredentialsCache so that it actually wraps the credentials provider in a credentials cache. This is a followup to https://github.com/aws/amazon-ecs-agent/pull/4424#discussion_r1844604109:

https://github.com/aws/amazon-ecs-agent/commit/a9b6e6de25541353ec5c7c6d640ed21374a08ca7 updates the constructor to wrap the provider in a cache and renames InstanceCredentialsProvider to InstanceCredentialsCache.

As you can see in the code snippets below, the returned provider is not wrapped in a cache. https://github.com/aws/amazon-ecs-agent/blob/c24cdaea3e30649fdfbde4906ca964bad49f3126/ecs-agent/credentials/providers/instance_credentials_provider_linux.go#L41-L46

https://github.com/aws/amazon-ecs-agent/blob/c24cdaea3e30649fdfbde4906ca964bad49f3126/ecs-agent/credentials/providers/instance_credentials_provider_windows.go#L76-L78

Implementation details

Testing

Github checks pass.

New tests cover the changes: no

Licensing

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.