Repository navigation
feat: support reloading ephemeral AWS credentials via file - #26537
Merged
Merged
Conversation
waynr
force-pushed
the
feat/support-reloading-ephemeral-credentials-files
branch
from
June 18, 2025 06:56
7c20df9 to
48e4337
Compare
waynr
commented
Jun 18, 2025
| env = gen_name!($prefix, "AWS_CREDENTIALS_FILE"), | ||
| action | ||
| )] | ||
| pub aws_credentials_file: Option<String>, |
Contributor
Author
There was a problem hiding this comment.
Should this be documented in the verbose serve help text?
Contributor
There was a problem hiding this comment.
Seems like it would be useful?
waynr
force-pushed
the
feat/support-reloading-ephemeral-credentials-files
branch
from
June 18, 2025 07:16
48e4337 to
2ab7bde
Compare
stuartcarnie
approved these changes
Jun 18, 2025
stuartcarnie
left a comment
Contributor
There was a problem hiding this comment.
Looks good to me. 💯 for a comprehensive set of tests.
Comment on lines
+1215
to
+1227
| macro_rules! retry_if_unauthenticated { | ||
| ($self:ident, $expression:expr) => { | ||
| match $expression { | ||
| Ok(v) => Ok(v), | ||
| Err(object_store::Error::Unauthenticated { source, .. }) => { | ||
| warn!(error = ?source, "authentication with object store failed, attempting to reload from disk"); | ||
| let _ = $self.credential_reloader.check_and_update().await; | ||
| $expression | ||
| } | ||
| Err(e) => Err(e), | ||
| } | ||
| } | ||
| } |
| env = gen_name!($prefix, "AWS_CREDENTIALS_FILE"), | ||
| action | ||
| )] | ||
| pub aws_credentials_file: Option<String>, |
Contributor
There was a problem hiding this comment.
Seems like it would be useful?
| return None; | ||
| } | ||
| }; | ||
| let next_expiry = file_credentials.expiry; |
Contributor
There was a problem hiding this comment.
👍🏻 to using the expiry to trigger reloading the credentials.
This was referenced Jun 18, 2025
mgattozzi
pushed a commit
that referenced
this pull request
Sep 8, 2025
* feat: allow users to specify lookback duration for PersistedFiles buffer (#26528) * feat: support reloading ephemeral AWS credentials via file (#26537) * feat: introduce re-authenticating ObjectStore adapter for AWS file credentials * test: validate AwsCredentialReloader background update behavior * test: add tests and fixtures to validate ReauthingObjectStore behavior * docs: add --aws-credentials-file to manually-curated docstrings
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
This addresses #26497.
The implementation is accomplished by introducing a new
ObjectStoreadapter calledReauthingObjectStorethat wraps an existingArc<dyn ObjectStore>along with anArc<AwsCredentialReloader>in order to provide two forms of credential reloading:ObjectStorecall ifobject_store::Error::Unauthenticatedis detected in the first attempt then we attempt to reload credentials from disk before retrying.ObjectStoremethod call once since it's assumed that if reloading the credentials doesn't solve the problem then the right behavior should be to allow the error to return up the stack.This works by implementing a customer
object_store::CredentialProviderthat contains a shared reference to aAwsCredentialinstance synchronized by aRwLock.