-
Notifications
You must be signed in to change notification settings - Fork 75
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(clp-package): Add support for other AWS authentication methods #743
base: main
Are you sure you want to change the base?
Conversation
Important Review skippedDraft detected. Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
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.
In general, I think your apporach makes sense. we need to agree on where to put the .aws directory config in the config file.
Please also have a table where each row as a authentication method supported by boto3, with the following columns, so we can see the big picture
- Whether supported by clp package or not
- How should user specify such credentials in boto3 (and maybe they don't need to do anything)
- How should user specify such authentication info in clp package
- How CLP supports the method (i.e. via env, or mount)
- Any extra note(for example, webui viewer support)
It's also worthwhile to think about:
On failure, which component will run into the error and what user will see
components/job-orchestration/job_orchestration/executor/query/fs_search_task.py
Outdated
Show resolved
Hide resolved
components/job-orchestration/job_orchestration/executor/query/extract_stream_task.py
Outdated
Show resolved
Hide resolved
@@ -99,3 +99,6 @@ | |||
# | |||
## Location where logs are stored. It will be created if it doesn't exist. | |||
#logs_directory: "var/log" | |||
# | |||
## Location where the `.aws` directory should be read from |
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.
quick question: are we going to support aws credentials that specified in Environmental variable in the same way as boto3?
I think you should prepare a table to indicate what we will support and how they will supported.
from clp_py_utils.compression import FileMetadata | ||
|
||
# Constants | ||
AWS_ENDPOINT = "amazonaws.com" | ||
|
||
|
||
def get_session_credentials(aws_profile: str = "default") -> Optional[S3Credentials]: |
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's move the default to config instead.
return S3Credentials( | ||
access_key_id=credentials.access_key, | ||
secret_access_key=credentials.secret_key, | ||
session_token=credentials.token, |
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.
In the case when aws is not configured, i.e. user doesn't configure any profile via aws cli, but instead manually creates a .aws/credentials. do we get back the long term key and a token==null?
A further question is what if user specifies a token in the .aws/credentials under the default profile.
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.
The user could technically manually create any profile with any (at least of what we support) authentication method and provided it's done correctly, it will work. If the profile is just long-term credentials, the credentials.token field would be None. If the use chooses to use a profile containing short-term credentials, boto3 would treat it like any other credentials and try to use it, and fail if it can't authenticate.
In short, it's on the user to configure the credentials properly, with or without the aws cli.
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.
If the use chooses to use a profile containing short-term credentials, boto3 would treat it like any other credentials and try to use it, and fail if it can't authenticate.
In that case, will the returned credentials.token be the same as the one specified in the .aws, or will boto3 generate a new temporary token?
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.
I believe it would be the same as specified
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.
Would you please test the behavior?
Ideally, we should prevent user from using temporary credentials in the profile to start clp package, since eventually it will expire.. so maybe we should return an error in this case.
However, i believe if user just configures their profile through sso, we will always get a temporary credentials (which will be updated whenever we query the credentials from the session)?
} | ||
env_vars: Dict[str, str] = None | ||
|
||
if s3_config.credentials is not None: |
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.
if it's not in your todo yet, let's factor this into a helper method if possible
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.
yeah, I was thinking it would be a good idea
Ignore latest commit doesn't work atm |
Description
Todo: Mount .aws only if S3 is enabled, pass temporary credentials to webui correctly
Checklist
breaking change.
Validation performed