Skip to content

Add Test dockerscript for rustfs#65

Open
kwonkwonn wants to merge 1 commit into
easy-cloud-Knet:stagingfrom
kwonkwonn:object_storage_intergration
Open

Add Test dockerscript for rustfs#65
kwonkwonn wants to merge 1 commit into
easy-cloud-Knet:stagingfrom
kwonkwonn:object_storage_intergration

Conversation

@kwonkwonn
Copy link
Copy Markdown
Contributor

@kwonkwonn kwonkwonn commented May 25, 2026

Summary

Closes #64 — Story 1: rustfsClient 구현 및 테스트 환경 구성

client/rustfs.go: aws-sdk-go-v2 기반 RustFS 클라이언트 구현

  • NewRustFSClient() — endpoint/accessKey/secretKey 환경변수 기반 초기화 (RUSTFS_ENDPOINT, RUSTFS_ACCESS_KEY, RUSTFS_SECRET_KEY)
  • ListBuckets(), CreateBucket() — 버킷 관리
  • PresignGetObject(), PresignPutObject() — Presigned URL 발급 (업로드/다운로드는 Core가 직접 수행)
  • S3 Path-style 강제 설정 (UsePathStyle: true) — RustFS 호환을 위해 필수
  • tests/docker-compose.test.yml: rustfs-test 서비스 추가 (포트 19000/19001, healthcheck 포함)
  • SDK 결정: 이슈에서 검토된 MinIO SDK 대신 aws-sdk-go-v2 채택 — RustFS가 S3 API 호환을 공식 지원하므로 AWS 표준 SDK로 충분하며, 이미 AWS 생태계를 사용하는 경우 의존성을 통일할 수 있음

Test plan

docker compose -f docker-compose.test.yml up --build 실행 후 kws-test-rustfs healthy 확인
NewRustFSClient() 호출 시 버킷 생성 및 ListBuckets() 반환값 로그 확인
Presigned URL로 Core에서 추가 인증 없이 업로드/다운로드 가능 여부 확인

Out of scope (후속 태스크)

Service 레이어 연동 (Story 2)
Repository / DB 스키마 (별도 태스크)
동기/비동기 처리 방식 확정 (Story 3)

notes

go.mod 및 dockerfile 에 변화가 있었습니다.
aws-sdk import 중에 발생했는데 특정 버전에 sdk 를 맞추는것도 좋지 않아보여서 업데이트했습니다.
혹시 관련하여 우려사항 있다면 알려주세용

Type of Change

  • Bug fix
  • New feature
  • Refactoring
  • Docs / Config
  • CI/CD

Testing

  • Tested locally
  • No regression in existing functionality

Checklist

  • Reviewers assigned
  • Related issue linked

Summary by CodeRabbit

  • New Features
    • Added file storage integration with support for creating and managing storage buckets
    • Generate presigned URLs for secure file uploads and downloads with configurable expiration times
    • Flexible configuration with support for AWS S3-compatible storage endpoints
    • List and organize storage buckets for better file management

Review Change Stack

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 25, 2026

Warning

Review limit reached

@kwonkwonn, we couldn't start this review because you've used your available PR reviews for now.

Your plan includes 1 review of capacity. Refill in 54 minutes and 10 seconds.

Your organization has run out of usage credits. Purchase more in the billing tab.

⌛ How to resolve this issue?

After more review capacity refills, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than trial, open-source, and free plans. In all cases, review capacity refills continuously over time.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: f37b1b01-89a2-4692-b7aa-f7757cf0a476

📥 Commits

Reviewing files that changed from the base of the PR and between a00027c and 1198a35.

⛔ Files ignored due to path filters (1)
  • go.sum is excluded by !**/*.sum
📒 Files selected for processing (4)
  • Dockerfile
  • client/rustfs.go
  • go.mod
  • tests/docker-compose.test.yml
📝 Walkthrough

Walkthrough

This PR introduces RustFSClient, a Go wrapper around AWS S3 SDK v2 for S3-compatible storage operations. The client reads configuration from environment variables, manages bucket lifecycle, and generates presigned URLs for uploads and downloads. A new rustfs-test Docker Compose service is added to support integration testing with the control-test orchestration.

Changes

RustFS Client and Testing

Layer / File(s) Summary
Client initialization and structure
client/rustfs.go
RustFSClient type wraps an S3 client. Constructor reads RUSTFS_ENDPOINT, RUSTFS_ACCESS_KEY, RUSTFS_SECRET_KEY from environment with MinIO defaults, configures AWS SDK for region us-east-1 using static credentials, builds an S3 client with custom base endpoint and path-style addressing, creates hardcoded buckets, lists them to stdout, and returns the initialized client.
Bucket and presigned URL operations
client/rustfs.go
Methods ListBuckets, CreateBucket, PresignPutObject, and PresignGetObject expose core S3 operations: list existing buckets, create new buckets, and generate pre-authorized URLs for object uploads and downloads with configurable expiration durations.
Test environment orchestration
tests/docker-compose.test.yml
New rustfs-test service runs rustfs/rustfs:latest with MinIO-like access keys, volume mounts, and a TCP healthcheck on port 9000. The control-test service is updated to set RUSTFS_ENDPOINT and declare a service_healthy dependency on rustfs-test.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related issues

  • #63: Story 1 implementation aligns with this PR—the RustFS client initialization, bucket creation, and presigned URL generation in client/rustfs.go directly implement the client layer and core operations referenced in the issue narrative.

Poem

🐰 A fuzzy wrapper 'round the S3 stack,
With presigned URLs keeping data on track,
Docker-tested and ready to store,
Buckets and blobs forevermore! 📦✨

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'Add Test dockerscript for rustfs' is partially related to the changeset; it mentions the docker-compose file addition but overlooks the main change: the new RustFS client implementation in client/rustfs.go.
Linked Issues check ✅ Passed The PR successfully implements the RustFS client initialization requirements from linked issue #64, including the dedicated client under /client with full S3-compatible interaction logic.
Out of Scope Changes check ✅ Passed All changes are directly related to implementing the RustFS client and test infrastructure; no out-of-scope modifications were detected.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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

Comment @coderabbitai help to get the list of available commands and usage tips.

@kwonkwonn kwonkwonn force-pushed the object_storage_intergration branch 3 times, most recently from a664e76 to 9b1ec88 Compare May 25, 2026 08:27
Copy link
Copy Markdown

@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: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@client/rustfs.go`:
- Around line 9-12: The build is failing because client/rustfs.go imports
github.com/aws/aws-sdk-go-v2 modules (aws, config, credentials, service/s3) but
go.mod lacks those requirements; update the module dependencies by adding the
aws-sdk-v2 packages to go.mod (e.g., run `go get
github.com/aws/aws-sdk-go-v2@latest` for the needed submodules or add the
specific versions) then run `go mod tidy` to update go.mod and go.sum, verify
the package (client/rustfs.go) builds, and commit the updated go.mod and go.sum.
- Around line 50-62: Remove the test/debug bucket creation from the RustFSClient
constructor: delete the CreateBucket calls that use hardcoded names, the
fmt.Println(bucks) debug print, and the extra return that constructs a new
RustFSClient instead of returning the existing newCLI; if bucket initialization
is required, implement a separate method like EnsureBuckets(ctx, buckets
[]string) error that calls CreateBucket and returns on the first non-nil error
(do not overwrite or ignore err), and update the constructor to simply return
newCLI (and any constructor-level errors) without side-effectful I/O or silent
error swallowing.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: d4110205-e7a7-4e8d-8f51-9e94cfe2e352

📥 Commits

Reviewing files that changed from the base of the PR and between 40f74be and a00027c.

📒 Files selected for processing (2)
  • client/rustfs.go
  • tests/docker-compose.test.yml

Comment thread client/rustfs.go
Comment thread client/rustfs.go Outdated
@kwonkwonn kwonkwonn force-pushed the object_storage_intergration branch from 9b1ec88 to 2923f85 Compare May 25, 2026 08:28
@kwonkwonn kwonkwonn force-pushed the object_storage_intergration branch from 2923f85 to 1198a35 Compare May 25, 2026 08:30
Copy link
Copy Markdown
Contributor Author

@kwonkwonn kwonkwonn left a comment

Choose a reason for hiding this comment

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

공식 문서상 aws-s3-sdk 와 완전히 compatible 하다고 합니다.
그래서 aws-s3-sdk 를 가져다 쓸 예정이고, list 및 bucket 생성은 컨트롤에서
업로드 및 다운로드는 preasigned link 를 코어에 넘기는 방식으로 할 예정입니다

Comment thread go.mod
module github.com/easy-cloud-Knet/KWS_Control

go 1.23.0
go 1.24
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

1.23.0 <-> aws sdk 와 호환성 문제가 있어서 업데이트 했는데 혹시 관련해서 문제 있을까요

Comment thread client/rustfs.go
endpoint := os.Getenv("RUSTFS_ENDPOINT")
if endpoint == "" {
endpoint = "http://localhost:9001"
}
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

minioadmin<-- docker-compose.test.yaml 파일의 인자를 일단 덮어쓰도록 했습니다.
control 단에서 accesskey 넘어가는건 마지막 단계에서 할 거 같아요

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

RustFS client initialization

1 participant