vald icon indicating copy to clipboard operation
vald copied to clipboard

[Pending] Add AWS v2 package for the agent sidecar

Open hlts2 opened this issue 2 years ago • 7 comments

Description:

I implemented the AWS v2 package for the agent sidecar. As discussed previously, The logic for uploading and downloading data from s3 is implemented in a file-based way.

NOTE: This PR contains the following new dependencies.

go get github.com/aws/aws-sdk-go-v2/aws
go get github.com/aws/aws-sdk-go-v2/config
go get github.com/aws/aws-sdk-go-v2/service/s3
go get github.com/aws/aws-sdk-go-v2/feature/s3/manager

Impact

The results of the backup speed comparison are as follows. (Average of 5 times)

File size: 280MB

- AWS V1
 - Download time: 10s
 - Upload time: 31s

- AWS V2
 - Download time: 10s
 - Upload time: 29s

Related Issue:

How Has This Been Tested?:

Environment:

  • Go Version: 1.17.3
  • Docker Version: 20.10.8
  • Kubernetes Version: 1.22.0
  • NGT Version: 1.13.8

Types of changes:

  • [ ] Bug fix [type/bug]
  • [x] New feature [type/feature]
  • [ ] Add tests [type/test]
  • [ ] Security related changes [type/security]
  • [ ] Add documents [type/documentation]
  • [ ] Refactoring [type/refactoring]
  • [ ] Update dependencies [type/dependency]
  • [ ] Update benchmarks and performances [type/bench]
  • [ ] Update CI [type/ci]

Changes to Core Features:

  • [x] Have you added an explanation of what your changes do and why you'd like us to include them?
  • [ ] Have you written new tests for your core changes, as applicable?
  • [x] Have you successfully ran tests with your changes locally?

Checklist:

  • [x] I have read the CONTRIBUTING document.
  • [x] I have checked open Pull Requests for the similar feature or fixes?
  • [ ] I have added tests and benchmarks to cover my changes.
  • [x] I have ensured all new and existing tests passed.
  • [x] I have commented my code, particularly in hard-to-understand areas
  • [ ] I have updated the documentation accordingly.

Summary by CodeRabbit

  • New Features

    • Enhanced S3 storage integration with new concurrency control for upload and download operations.
    • Introduced new logging capabilities for S3 operations.
    • Added new configuration options for S3 client customization, including concurrency settings.
  • Bug Fixes

    • Removed outdated S3 configuration options such as parameter validation and MD5 validation to streamline functionality.
  • Documentation

    • Updated documentation to reflect new features and removed configurations in S3 storage settings.
  • Refactor

    • Implemented new internal structures for S3 client operations to improve performance and maintainability.

hlts2 avatar Aug 16 '22 02:08 hlts2

[WARNING:INTCFG] Changes in interal/config may require you to change Helm charts. Please check.

vdaas-ci avatar Aug 16 '22 02:08 vdaas-ci

Deploying vald with  Cloudflare Pages  Cloudflare Pages

Latest commit: 389050f
Status: ✅  Deploy successful!
Preview URL: https://1ac1703e.vald.pages.dev
Branch Preview URL: https://feature-internal-db-s3-aws-s.vald.pages.dev

View logs

Codecov Report

Attention: Patch coverage is 0% with 28 lines in your changes are missing coverage. Please review.

Project coverage is 31.82%. Comparing base (6d4b505) to head (828a0e6).

:exclamation: Current head 828a0e6 differs from pull request most recent head 389050f. Consider uploading reports for the commit 389050f to get more accurate results

Files Patch % Lines
...ent/sidecar/usecase/initcontainer/initcontainer.go 0.00% 14 Missing :warning:
pkg/agent/sidecar/usecase/sidecar/sidecar.go 0.00% 14 Missing :warning:
Additional details and impacted files
@@             Coverage Diff             @@
##             main    #1769       +/-   ##
===========================================
+ Coverage   18.91%   31.82%   +12.91%     
===========================================
  Files         565      374      -191     
  Lines       65223    32027    -33196     
===========================================
- Hits        12337    10194     -2143     
+ Misses      52089    21443    -30646     
+ Partials      797      390      -407     

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

codecov[bot] avatar Aug 16 '22 02:08 codecov[bot]

Walkthrough

Walkthrough

The recent updates focus on refining S3 storage interactions across various components in the Vald Helm chart and internal S3 storage handling. Changes include the removal of outdated S3 features, introduction of concurrency controls, and enhancements in error handling and logging. These modifications aim to streamline operations, improve performance, and ensure more robust data handling with AWS S3.

Changes

File Path Change Summary
charts/.../crds/valdrelease.yaml Modified schema properties for S3 settings, removed some outdated options.
charts/.../values.yaml Updated S3 settings in Helm values, focusing on concurrency and removing deprecated features.
internal/.../blob_test.go Updated S3Config struct to include Concurrency.
internal/.../s3/downloader/..., uploader/... Enhanced client functionality for S3 downloads and uploads, including error handling and options.
internal/.../s3/file/file.go Introduced file handling for temporary storage during operations.
internal/.../s3/logger/logger.go Added custom logging for S3 operations, mapping AWS Smithy logs to internal levels.
internal/.../s3/s3.go, option.go General enhancements in S3 client configuration and operations, maintaining existing functionalities.

Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

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>.
    • Generate unit testing code for this file.
    • 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 generate unit testing code for this file.
    • @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 generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

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 as PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger a review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

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.

coderabbitai[bot] avatar May 08 '24 08:05 coderabbitai[bot]

@coderabbitai review

hlts2 avatar May 08 '24 09:05 hlts2

Actions Performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

coderabbitai[bot] avatar May 08 '24 09:05 coderabbitai[bot]

[!NOTE] Currently processing new changes in this PR. This may take a few minutes, please wait...

Commits Files that changed from the base of the PR and between 6d4b50543c6a900594aabca3a44b160fd27964d9 and 389050fd104b5ccf9d96358fa5db56e7efa725dd.
Files selected for processing (11)
  • charts/vald-helm-operator/crds/valdrelease.yaml (1 hunks)
  • charts/vald/values.yaml (1 hunks)
  • internal/config/blob_test.go (6 hunks)
  • internal/db/storage/blob/v3/s3/downloader/downloader.go (1 hunks)
  • internal/db/storage/blob/v3/s3/downloader/option.go (1 hunks)
  • internal/db/storage/blob/v3/s3/file/file.go (1 hunks)
  • internal/db/storage/blob/v3/s3/logger/logger.go (1 hunks)
  • internal/db/storage/blob/v3/s3/option.go (1 hunks)
  • internal/db/storage/blob/v3/s3/s3.go (1 hunks)
  • internal/db/storage/blob/v3/s3/uploader/option.go (1 hunks)
  • internal/db/storage/blob/v3/s3/uploader/uploader.go (1 hunks)
 _________________________________________________
< PhD, MSc, BSc, and a black belt in code review. >
 -------------------------------------------------
  \
   \   \
        \ /\
        ( )
      .( o ).

Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

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>.
    • Generate unit testing code for this file.
    • 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 generate unit testing code for this file.
    • @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 generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

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 as PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger a review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

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.

coderabbitai[bot] avatar May 08 '24 09:05 coderabbitai[bot]