feat(services/s3): add container credentials support for ECS and EKS #6525
+128
−0
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.
Summary
This PR adds comprehensive support for AWS container credentials used in ECS tasks and EKS pods, enabling OpenDAL to seamlessly work in containerized AWS environments. The implementation leverages reqsign's
ECSCredentialProviderto provide robust credential handling.Background
Container credentials are essential for AWS workloads running in ECS and EKS:
This feature addresses issue #6456 and replaces the previous placeholder implementation with a complete solution based on reqsign's proven credential provider.
Implementation
Integration with reqsign's ECSCredentialProvider
The implementation directly uses reqsign's
ECSCredentialProvider, which provides:New Configuration Fields
container_credentials_relative_uriaws_container_credentials_relative_uricontainer_credentials_endpointaws_container_credentials_full_uri,container_credentials_full_uricontainer_authorization_tokenaws_container_authorization_tokencontainer_authorization_token_fileaws_container_authorization_token_filecontainer_metadata_uri_overrideaws_container_metadata_uri_overrideBuilder Methods
Added corresponding builder methods for programmatic configuration:
container_credentials_relative_uri(uri: &str)container_credentials_endpoint(endpoint: &str)container_authorization_token(token: &str)container_authorization_token_file(file: &str)container_metadata_uri_override(uri: &str)Example Usage
JSON Configuration
{ "bucket": "my-bucket", "aws_container_credentials_relative_uri": "/v2/credentials/task-role" }Implementation Details
Architecture Changes
ECSCredentialProviderin the build process usingcustomized_credential_load()Key Features
ECSCredentialProviderDesign Decisions
Testing
Dependencies
This implementation depends on reqsign's
ECSCredentialProviderwhich is currently under review in Xuanwo/reqsign#598. The code is ready and will work once that dependency is merged.Compatibility
This change is fully backward compatible. Existing configurations continue to work unchanged, with new fields providing additional flexibility for containerized environments.
Fixes #6456