erickguan commented on code in PR #7166:
URL: https://github.com/apache/opendal/pull/7166#discussion_r3447941209
##########
core/services/s3/src/backend.rs:
##########
@@ -412,6 +413,69 @@ impl S3Builder {
self
}
+ /// Set container credentials relative URI for ECS Task IAM roles.
+ ///
+ /// Used in ECS environments where the base metadata endpoint is known.
+ /// The relative URI is appended to the default ECS endpoint
(169.254.170.2).
+ ///
+ /// Example: "/v2/credentials/my-role-name"
+ pub fn container_credentials_relative_uri(mut self, uri: &str) -> Self {
+ if !uri.is_empty() {
+ self.config.container_credentials_relative_uri =
Some(uri.to_string());
+ }
+ self
+ }
+
+ /// Set container credentials endpoint for EKS Pod Identity, Fargate, or
custom setups.
+ ///
+ /// Complete URL for fetching credentials. Used in:
+ /// - EKS Pod Identity environments
+ /// - AWS Fargate environments
+ /// - Custom container credential endpoints
+ ///
+ /// Example: "http://169.254.170.2/v2/credentials/my-role"
Review Comment:
Can we link AWS documentations too?
e.g.:
```
read EKS documentation http://xxx
```
##########
core/services/s3/src/backend.rs:
##########
@@ -830,6 +903,33 @@ impl Builder for S3Builder {
provider = provider.push_front(static_provider);
}
+ // Insert ECS credential provider if container credentials are
configured.
+ if Self::has_ecs_config(&config) {
+ let mut ecs_provider = ECSCredentialProvider::new();
+
+ if let Some(ref endpoint) = config.container_credentials_endpoint {
+ ecs_provider = ecs_provider.with_endpoint(endpoint);
+ }
+
+ if let Some(ref relative_uri) =
config.container_credentials_relative_uri {
+ ecs_provider = ecs_provider.with_relative_uri(relative_uri);
+ }
Review Comment:
I think we should check endpoint as documentation says.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]