Skip to content

SDK | Upgrade AWS SDK to v3 - Block Store S3 #9067

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

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

naveenpaul1
Copy link
Contributor

@naveenpaul1 naveenpaul1 commented Jun 6, 2025

Describe the Problem

Upgrade AWS SDK to v3 - Block Store S3

Explain the Changes

  1. update SDK version to V3 for block_store_s3.js
  2. STS flow updated with new SDK v3.

Issues: Fixed #xxx / Gap #xxx

  1. remove deprecated SDK v2 from block store s3 flow.

Testing Instructions:

  1. Test bulk storage flow
  • Doc added/updated
  • Tests added

Summary by CodeRabbit

  • Chores
    • Updated AWS SDK dependencies to use the latest modular v3 packages.
  • Refactor
    • Migrated all AWS S3 and STS interactions from AWS SDK v2 to AWS SDK v3, updating configuration and instantiation patterns.
  • Tests
    • Updated unit tests to use AWS SDK v3 clients and adjusted stubbing and assertions accordingly.

Copy link

coderabbitai bot commented Jun 10, 2025

"""

Walkthrough

The changes migrate all AWS S3 and STS interactions from AWS SDK v2 to the modular AWS SDK v3. This includes updating client instantiations, configuration parameters, credential handling, and method calls across implementation, utility, and test files. The package.json is updated to include new AWS SDK v3 dependencies.

Changes

File(s) Change Summary
package.json Added @aws-sdk/credential-providers and @aws-sdk/s3-request-presigner dependencies at version 3.826.0.
src/agent/block_store_services/block_store_s3.js Refactored to use AWS SDK v3 S3 client, updating instantiation and configuration to new SDK interface including credentials and request handler.
src/util/cloud_utils.js Refactored STS credential and S3 client creation to use AWS SDK v3, updating method calls, commands, and configuration accordingly.
src/test/unit_tests/test_cloud_utils.js Updated tests to use AWS SDK v3 STS client, changed stubbing and assertions to match new async and modular API, extended test timeout.

Sequence Diagram(s)

sequenceDiagram
    participant Caller
    participant cloud_utils.js
    participant STSClient
    participant S3

    Caller->>cloud_utils.js: createSTSS3Client(params, additionalParams)
    cloud_utils.js->>STSClient: new STSClient(config)
    cloud_utils.js->>STSClient: send(AssumeRoleWithWebIdentityCommand)
    STSClient-->>cloud_utils.js: { Credentials }
    cloud_utils.js->>S3: new S3({ credentials, ... })
    cloud_utils.js-->>Caller: S3 client instance
Loading

Possibly related PRs

  • SDK | Upgrade AWS SDK to v3 - Unit tests #9042: Both PRs perform a comprehensive migration from AWS SDK v2 to AWS SDK v3 for S3 client usage, updating client instantiation, configuration options, and method calls to the new SDK interface in overlapping files such as src/util/cloud_utils.js and related S3 service code.

Suggested reviewers

  • dannyzaken
  • tangledbytes
  • liranmauda
    """

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 ESLint

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

npm error Exit handler never called!
npm error This is an error with npm itself. Please report this error at:
npm error https://github.com/npm/cli/issues
npm error A complete log of this run can be found in: /.npm/_logs/2025-06-25T08_26_17_392Z-debug-0.log


📜 Recent review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 139e101 and 80d4fc2.

⛔ Files ignored due to path filters (1)
  • package-lock.json is excluded by !**/package-lock.json
📒 Files selected for processing (4)
  • package.json (1 hunks)
  • src/agent/block_store_services/block_store_s3.js (14 hunks)
  • src/test/unit_tests/test_cloud_utils.js (3 hunks)
  • src/util/cloud_utils.js (2 hunks)
🚧 Files skipped from review as they are similar to previous changes (4)
  • package.json
  • src/test/unit_tests/test_cloud_utils.js
  • src/agent/block_store_services/block_store_s3.js
  • src/util/cloud_utils.js
⏰ Context from checks skipped due to timeout of 90000ms (4)
  • GitHub Check: Build Noobaa Image
  • GitHub Check: run-package-lock-validation
  • GitHub Check: run-jest-unit-tests
  • GitHub Check: Summary
✨ Finishing Touches
  • 📝 Generate Docstrings

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.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

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)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@naveenpaul1 naveenpaul1 force-pushed the block_store_ser_sdkv3 branch 5 times, most recently from e811dd7 to c9c3fde Compare June 17, 2025 13:32
@naveenpaul1 naveenpaul1 marked this pull request as ready for review June 23, 2025 05:54
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 46554f9 and c9c3fde.

⛔ Files ignored due to path filters (1)
  • package-lock.json is excluded by !**/package-lock.json
📒 Files selected for processing (4)
  • package.json (1 hunks)
  • src/agent/block_store_services/block_store_s3.js (14 hunks)
  • src/test/unit_tests/test_cloud_utils.js (3 hunks)
  • src/util/cloud_utils.js (2 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
`src/test/**/*.*`: Ensure that the PR includes tests for the changes.

src/test/**/*.*: Ensure that the PR includes tests for the changes.

  • src/test/unit_tests/test_cloud_utils.js
🔇 Additional comments (13)
package.json (1)

85-85: Verify if aws-sdk v2 is still needed.

The old AWS SDK v2 dependency is still present. If this upgrade is intended to remove v2 usage from the Block Store S3 component, verify if this dependency is still needed elsewhere in the codebase.

#!/bin/bash
# Description: Check if aws-sdk v2 is still used in the codebase
# Expect: If only used in files not related to this PR, it's safe to keep

echo "Checking aws-sdk v2 usage in the codebase:"
rg -A 3 "require\('aws-sdk'\)" --type js

echo -e "\nChecking AWS.S3 usage:"
rg -A 3 "AWS\.S3" --type js

echo -e "\nChecking new AWS SDK v3 usage:"
rg -A 3 "@aws-sdk/" --type js
src/test/unit_tests/test_cloud_utils.js (4)

7-7: LGTM: Import correctly updated for SDK v3.

The import has been properly updated to use the modular AWS SDK v3 client.


25-32: LGTM: Stubbing correctly updated for SDK v3.

The stubbing approach is correctly updated to mock the send method on STSClient.prototype, which is the proper way to stub SDK v3 client calls.


49-49: Verify the timeout extension rationale.

The timeout was extended from the default to 50 seconds. Ensure this is necessary for STS operations or if there are specific performance considerations.


59-63: LGTM: Correctly handles asynchronous credential access.

The test properly uses await to access credentials and region from the S3 client configuration, which is required for SDK v3.

src/agent/block_store_services/block_store_s3.js (5)

5-5: LGTM: Import correctly updated for SDK v3.

The import has been properly updated to use the modular AWS SDK v3 S3 client.


15-15: LGTM: Added proper HTTP handler import.

The NodeHttpHandler import is correctly added for SDK v3 HTTP configuration.


43-54: LGTM: S3 client instantiation correctly updated for SDK v3.

The S3 client configuration is properly updated with:

  • Credentials passed as an object
  • forcePathStyle instead of s3ForcePathStyle
  • Proper requestHandler configuration with NodeHttpHandler

61-72: LGTM: S3 compatible endpoint configuration updated correctly.

The configuration for S3-compatible endpoints is properly updated with:

  • applyChecksum replacing the deprecated s3DisableBodySigning
  • Proper HTTP agent configuration through requestHandler

82-85: LGTM: S3 method calls correctly updated for SDK v3.

All S3 method calls have been properly updated by removing the .promise() chaining, which is correct since SDK v3 methods return promises natively.

Also applies to: 109-112, 167-170, 194-199, 241-248, 265-268, 309-315, 325-328, 345-350, 353-358, 389-396, 424-427

src/util/cloud_utils.js (3)

13-14: LGTM: Imports correctly updated for SDK v3.

The imports have been properly updated to include the modular AWS SDK v3 STS client and commands, along with the NodeHttpHandler.


36-44: LGTM: S3 client creation correctly updated for SDK v3.

The createSTSS3Client function is properly updated with:

  • New S3 client from SDK v3
  • Proper requestHandler configuration
  • forcePathStyle instead of the deprecated s3ForcePathStyle

49-67: LGTM: STS credential generation correctly updated for SDK v3.

The generate_aws_sts_creds function is properly updated with:

  • STSClient instantiation with region configuration
  • AssumeRoleWithWebIdentityCommand usage
  • Proper credential extraction from the response
  • Maintained error handling and validation

@naveenpaul1 naveenpaul1 force-pushed the block_store_ser_sdkv3 branch 2 times, most recently from f256437 to 139e101 Compare June 23, 2025 12:04
Signed-off-by: naveenpaul1 <napaul@redhat.com>
@naveenpaul1 naveenpaul1 force-pushed the block_store_ser_sdkv3 branch from 139e101 to 80d4fc2 Compare June 25, 2025 08:23
@naveenpaul1 naveenpaul1 marked this pull request as draft June 25, 2025 12:12
@naveenpaul1
Copy link
Contributor Author

naveenpaul1 commented Jun 25, 2025

after this PR, STS request in namespace_s3 is failing, Will update the Namespce_s3 SDK version aslo.
Moving this PR to draft

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant