-
Notifications
You must be signed in to change notification settings - Fork 1.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(cubestore): Support IAM role authentication for S3 #8589
base: master
Are you sure you want to change the base?
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎ 8 Skipped Deployments
|
@igorlukanin it is not clear why the Vercel test is failing. I am interested in this feature and could work on the tests to make it acceptable and suitable for merging. |
I've rebased this PR on top of the latest and it looks like we have more build steps failing now. Could anyone please take a look? |
I can have a look. I think I can fix the error for the failing checks. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These suggestions fixes the formatting and build error happening currently in the checks
@@ -101,6 +101,7 @@ humansize = "2.1.3" | |||
deepsize = "0.2.0" | |||
anyhow = "1.0" | |||
arc-swap = "1.7.1" | |||
aws_sdk_sts = "1.38.0" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
aws_sdk_sts = "1.38.0" | |
aws-sdk-sts = "1.38.0" |
Some(role_name) => { | ||
assume_role(&role_name, ®ion.to_string()).await | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some(role_name) => { | |
assume_role(&role_name, ®ion.to_string()).await | |
} | |
Some(role_name) => assume_role(&role_name, ®ion.to_string()).await, |
.assume_role(AssumeRoleRequest::builder() | ||
.role_arn(format!("arn:aws:iam::{}:role/{}", account_id, role_or_access_key)) | ||
.duration_seconds(28800) | ||
.build()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
.assume_role(AssumeRoleRequest::builder() | |
.role_arn(format!("arn:aws:iam::{}:role/{}", account_id, role_or_access_key)) | |
.duration_seconds(28800) | |
.build()) | |
.assume_role( | |
AssumeRoleRequest::builder() | |
.role_arn(format!( | |
"arn:aws:iam::{}:role/{}", | |
account_id, role_or_access_key | |
)) | |
.duration_seconds(28800) | |
.build(), | |
) |
let access_key = assume_role_output.access_key_id.ok_or_else(|| CubeError::internal("Failed to get access key".to_string()))?; | ||
let secret_key = assume_role_output.secret_access_key.ok_or_else(|| CubeError::internal("Failed to get secret key".to_string()))?; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
let access_key = assume_role_output.access_key_id.ok_or_else(|| CubeError::internal("Failed to get access key".to_string()))?; | |
let secret_key = assume_role_output.secret_access_key.ok_or_else(|| CubeError::internal("Failed to get secret key".to_string()))?; | |
let access_key = assume_role_output | |
.access_key_id | |
.ok_or_else(|| CubeError::internal("Failed to get access key".to_string()))?; | |
let secret_key = assume_role_output | |
.secret_access_key | |
.ok_or_else(|| CubeError::internal("Failed to get secret key".to_string()))?; |
let fs = match fs.upgrade() { | ||
None => { | ||
log::debug!("Stopping S3 credentials refresh loop"); | ||
return; | ||
} | ||
Some(fs) => fs, | ||
}; | ||
|
||
let (access_key, secret_key) = if is_role { | ||
let (access_key, secret_key) = assume_role(&role_or_access_key.as_ref().unwrap(), ®ion.to_string()).await; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
let (access_key, secret_key) = assume_role(&role_or_access_key.as_ref().unwrap(), ®ion.to_string()).await; | |
let (access_key, secret_key) = | |
assume_role(&role_or_access_key.as_ref().unwrap(), ®ion.to_string()).await; |
I need IAM role authentication, similar to this issue #6795.
Check List
Issue Reference this PR resolves
Add IAM role authentication.
Description of Changes Made (if issue reference is not provided)
Introduce
CUBESTORE_AWS_IAM_ROLE
andCUBESTORE_AWS_IAM_REFRESH_EVERY_MINS
.If there is
CUBESTORE_AWS_IAM_ROLE
in the env, we would generate ID and secret on the flight.Since this ID is short-lived (15 mins by default), we would need a shorten refresh loop.