Skip to content
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

chore!: make minio client optional and improve initialization #434

Merged
merged 18 commits into from
Jun 27, 2024

Conversation

mojtaba-esk
Copy link
Member

@mojtaba-esk mojtaba-esk commented Jun 10, 2024

Closes #429

Summary by CodeRabbit

  • New Features

    • Introduced a consistent Minio client initialization to improve performance and reliability.
  • Refactor

    • Renamed fields in various modules for better clarity (e.g., K8s to K8sClient, Minio to MinioClient).
    • Added a validation step in initialization functions to ensure proper configuration.
  • Bug Fixes

    • Improved error handling with new error variables to address missing or mismatched configurations.
  • Tests

    • Updated test cases to reflect changes in Minio and K8s client initialization.
    • Added new test scenarios for enhanced coverage.

@mojtaba-esk mojtaba-esk requested a review from a team June 10, 2024 10:37
@mojtaba-esk mojtaba-esk self-assigned this Jun 10, 2024
Copy link
Contributor

coderabbitai bot commented Jun 10, 2024

Walkthrough

The changes introduce a new field client of type *miniogo.Client in the Minio struct to optimize client reuse across requests. This improvement seeks to enhance performance by reusing a single Minio client instance. The New method initializes the client, while existing methods utilize this client for network operations, reducing redundant client creation.

Changes

Files Change Summary
pkg/minio/minio.go Added client field to Minio struct. Introduced New method for client initialization. Updated methods to use client instead of creating a new instance.
pkg/builder/kaniko/kaniko.go Renamed K8s to K8sClient and Minio to MinioClient in Kaniko struct. Updated related method calls accordingly.
e2e/tshark/tshark_test.go Initialized Minio client with minio.New(ctx, k8sClient) instead of direct deployment in TestTshark.
pkg/knuu/knuu.go Renamed variables in Options struct. Added Timeout field. Introduced validateOptions function. Adjusted logic in New function to validate options.
e2e/system/build_from_git_test.go Modified kn initialization by passing k8sClient and minioClient. Added TestBuildFromGitWithModifications function.
e2e/system/main_test.go Commented out knuu initialization and logging statements in TestMain.
e2e/bittwister/suite_setup_test.go Modified SetupSuite method to initialize Knuu with specific options and adjusted error handling.
pkg/knuu/errors.go Added new error variables ErrTestScopeNotSet, ErrK8sClientNotSet, and ErrTestScopeMistMatch.
pkg/knuu/knuu_test.go Removed minio import. Added test case for Minio enabled. Adjusted test cases for Knuu initialization options.

Sequence Diagram(s)

sequenceDiagram
    participant Client
    participant Minio
    Client->>Minio: Initialize
    Minio->>Client: Return client instance
    Client->>Minio: PushToMinio / DeleteFromMinio / GetMinioURL
    Minio->>Client: Ensure client initialization via New method
    Client->>Minio: Perform Minio operations
Loading

Assessment against linked issues

Objective Addressed Explanation
Reuse Minio client across requests for improved performance (Issue #429)
Refactor to reduce initialization overhead and leverage connection pooling (Issue #429)

Poem

In the land of code a change was made,
To stop the Minio client cascade,
One client to rule, to share the load,
Performance lifts, in speed mode.
A leap for bunnies, a hop in time,
Efficiency sings, in code’s sweet rhyme. 🚀🐰


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.
    • @coderabbitai help me debug CodeRabbit configuration file.

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 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 resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @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.

Copy link
Contributor

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

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 5b65065 and b442dfa.

Files selected for processing (1)
  • pkg/minio/minio.go (5 hunks)
Additional comments not posted (6)
pkg/minio/minio.go (6)

47-47: Added cli field to Minio struct to hold a Minio client instance.

This change aligns with the PR's objective to optimize Minio client usage by reusing a single instance across multiple requests, reducing overhead.


164-183: Refactored init method to initialize cli field if not already set.

This ensures that the Minio client is lazily initialized only once, which is a good practice for resource management. However, consider handling potential race conditions if multiple goroutines could call init concurrently.


187-189: Updated PushToMinio method to use the cli field.

The method now initializes the client if necessary and uses it to perform operations, which should improve performance by reusing the client. Ensure that error handling is robust, especially around client initialization and bucket operations.

Also applies to: 191-191, 195-195


206-207: Updated DeleteFromMinio method to use the cli field.

Similar to PushToMinio, this method now uses the initialized client to perform deletion operations. This change is consistent with the goal of optimizing client usage.

Also applies to: 211-211, 216-216


227-228: Updated GetMinioURL method to use the cli field.

The method now ensures the client is initialized before generating a presigned URL. This is a critical improvement for performance and resource utilization.

Also applies to: 235-235


294-296: Updated createBucketIfNotExists method to use the cli field.

This method now initializes the client and checks for the existence of a bucket before attempting to create it, which is a more efficient use of resources.

Also applies to: 298-298, 306-306

pkg/minio/minio.go Outdated Show resolved Hide resolved
pkg/minio/minio.go Outdated Show resolved Hide resolved
Copy link
Member

@MSevey MSevey left a comment

Choose a reason for hiding this comment

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

We should update this to have a New or Init method that is called once as opposed to requiring init to be called by every method.

pkg/minio/minio.go Outdated Show resolved Hide resolved
pkg/minio/minio.go Outdated Show resolved Hide resolved
pkg/minio/minio.go Outdated Show resolved Hide resolved
pkg/minio/minio.go Outdated Show resolved Hide resolved
pkg/minio/minio.go Outdated Show resolved Hide resolved
pkg/minio/minio.go Outdated Show resolved Hide resolved
pkg/minio/minio.go Outdated Show resolved Hide resolved
pkg/minio/minio.go Outdated Show resolved Hide resolved
pkg/minio/minio.go Outdated Show resolved Hide resolved
Co-authored-by: Jose Ramon Mañes <[email protected]>
Copy link
Contributor

@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

Outside diff range and nitpick comments (2)
pkg/minio/minio.go (2)

164-183: Consider initializing the Minio client in a constructor to avoid repetitive initialization checks in every method.

This approach simplifies the code and ensures the client is ready before any operations, enhancing reliability and performance.


Line range hint 35-35: Avoid hardcoding sensitive information like passwords. Use environment variables or a secure vault solution.

This reduces the risk of unauthorized access and complies with security best practices.

Tools
golangci-lint

47-47: File is not goimports-ed with -local github.com/celestiaorg (goimports)

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between b442dfa and e14dc59.

Files selected for processing (1)
  • pkg/minio/minio.go (5 hunks)
Additional context used
Gitleaks
pkg/minio/minio.go

35-35: Identified a HashiCorp Terraform password field, risking unauthorized infrastructure configuration and security breaches. (hashicorp-tf-password)

golangci-lint
pkg/minio/minio.go

47-47: File is not goimports-ed with -local github.com/celestiaorg (goimports)

Additional comments not posted (1)
pkg/minio/minio.go (1)

47-47: The client field is a good addition to the Minio struct for reusing the Minio client. However, ensure proper formatting as per Go standards.

- client *miniogo.Client
+ Client *miniogo.Client  // Exported fields should be capitalized and properly commented.

Likely invalid or redundant comment.

Tools
golangci-lint

47-47: File is not goimports-ed with -local github.com/celestiaorg (goimports)

pkg/minio/minio.go Outdated Show resolved Hide resolved
@mojtaba-esk mojtaba-esk requested review from tty47 and MSevey June 14, 2024 15:12
Copy link
Contributor

@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

Outside diff range and nitpick comments (1)
pkg/minio/minio.go (1)

Line range hint 35-35: Identified a potential security risk related to a hardcoded password (rootPassword). Consider using environment variables or a secure vault solution to manage sensitive credentials.

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between e14dc59 and 51d8083.

Files selected for processing (1)
  • pkg/minio/minio.go (5 hunks)
Additional context used
Gitleaks
pkg/minio/minio.go

35-35: Identified a HashiCorp Terraform password field, risking unauthorized infrastructure configuration and security breaches. (hashicorp-tf-password)

Additional comments not posted (3)
pkg/minio/minio.go (3)

45-46: The addition of the client field to the Minio struct aligns with the objective of optimizing client reuse.


169-188: The init method ensures that the Minio client is only instantiated once, which is a good use of lazy initialization pattern to optimize resource usage.


192-200: Refactoring of PushToMinio, DeleteFromMinio, GetMinioURL, and createBucketIfNotExists to use the single client instance is correctly implemented. Each method properly initializes the client before proceeding with its operations, ensuring that the client is ready to use.
[APROVED]

Also applies to: 211-221, 232-240, 311-324

pkg/minio/minio.go Outdated Show resolved Hide resolved
Copy link
Contributor

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

Outside diff range and nitpick comments (1)
pkg/minio/minio.go (1)

Line range hint 35-35: Security concern: Hardcoded credentials in the codebase.

Please consider using environment variables or a secure vault solution to manage sensitive credentials like rootUser and rootPassword.

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 51d8083 and b2ed2f8.

Files selected for processing (9)
  • e2e/tshark/tshark_test.go (2 hunks)
  • pkg/builder/kaniko/errors.go (1 hunks)
  • pkg/builder/kaniko/kaniko.go (10 hunks)
  • pkg/builder/kaniko/kaniko_test.go (1 hunks)
  • pkg/knuu/knuu.go (1 hunks)
  • pkg/knuu/knuu_old.go (1 hunks)
  • pkg/knuu/minio.go (1 hunks)
  • pkg/minio/errors.go (1 hunks)
  • pkg/minio/minio.go (5 hunks)
Additional context used
Learnings (2)
pkg/builder/kaniko/kaniko_test.go (1)
User: mojtaba-esk
PR: celestiaorg/knuu#416
File: pkg/builder/kaniko/kaniko_test.go:28-28
Timestamp: 2024-06-12T10:15:25.573Z
Learning: The `Kaniko` type is defined within the same package in `pkg/builder/kaniko/kaniko_test.go`.
pkg/builder/kaniko/kaniko.go (1)
User: mojtaba-esk
PR: celestiaorg/knuu#416
File: pkg/builder/kaniko/kaniko_test.go:28-28
Timestamp: 2024-06-12T10:15:25.573Z
Learning: The `Kaniko` type is defined within the same package in `pkg/builder/kaniko/kaniko_test.go`.
Gitleaks
pkg/minio/minio.go

35-35: Identified a HashiCorp Terraform password field, risking unauthorized infrastructure configuration and security breaches. (hashicorp-tf-password)

Additional comments not posted (10)
pkg/knuu/minio.go (1)

12-22: The implementation of initMinio correctly ensures that the Minio client is initialized only once, aligning with the PR's objective to optimize resource usage by reusing the Minio client.

pkg/builder/kaniko/errors.go (1)

33-33: The addition of ErrMinioFailedToGetDeployment enhances error specificity and improves the robustness of error handling in Minio operations.

e2e/tshark/tshark_test.go (1)

52-52: Correct implementation of the Minio client initialization in the test setup, aligning with the new approach to use a single client instance.

pkg/knuu/knuu_old.go (1)

85-86: Proper adaptation of the deprecated knuu_old.go to use the new Minio client structure, ensuring consistency across the codebase.

pkg/builder/kaniko/kaniko_test.go (1)

31-31: The renaming of the K8s field to K8sClient aligns with the changes in other parts of the codebase, enhancing consistency.

pkg/minio/errors.go (1)

43-43: The introduction of ErrMinioClientNotInitialized is appropriate and necessary for handling cases where the Minio client is not properly initialized. This aligns with the PR's objective of managing Minio client lifecycle more effectively.

pkg/knuu/knuu.go (1)

198-199: Renaming K8s and Minio to K8sClient and MinioClient respectively in the Kaniko struct instantiation ensures consistent naming conventions across the project, which improves code readability and maintainability.

pkg/builder/kaniko/kaniko.go (3)

34-35: The update to use K8sClient and MinioClient in the Kaniko struct is consistent with changes across other parts of the codebase. This not only aligns with the PR's objectives but also ensures that the codebase remains consistent and maintainable.


47-47: The refactoring of error handling and the introduction of new error constants make the code more robust and easier to debug. It's good to see comprehensive error checks and appropriate wrapping of errors, which will aid in troubleshooting and maintaining the code.
[APROVED]

Also applies to: 79-79, 110-110, 133-133, 143-143, 152-152, 162-164, 173-181


264-264: Ensuring Minio client initialization before its usage and handling potential errors appropriately is crucial. These changes are well-aligned with the PR's goals of optimizing resource management and should help prevent runtime issues related to uninitialized clients.

Also applies to: 279-279, 283-283

pkg/minio/minio.go Outdated Show resolved Hide resolved
pkg/minio/minio.go Outdated Show resolved Hide resolved
pkg/minio/minio.go Outdated Show resolved Hide resolved
pkg/minio/minio.go Show resolved Hide resolved
Copy link
Contributor

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

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 59f133e and fef3306.

Files selected for processing (3)
  • e2e/system/build_from_git_test.go (2 hunks)
  • pkg/knuu/knuu.go (4 hunks)
  • pkg/knuu/knuu_test.go (2 hunks)
Files skipped from review as they are similar to previous changes (3)
  • e2e/system/build_from_git_test.go
  • pkg/knuu/knuu.go
  • pkg/knuu/knuu_test.go

Copy link
Contributor

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

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between fef3306 and 6793a8b.

Files selected for processing (3)
  • e2e/system/build_from_git_test.go (2 hunks)
  • e2e/system/main_test.go (1 hunks)
  • pkg/knuu/knuu.go (4 hunks)
Files skipped from review due to trivial changes (1)
  • e2e/system/main_test.go
Files skipped from review as they are similar to previous changes (1)
  • pkg/knuu/knuu.go
Additional comments not posted (4)
e2e/system/build_from_git_test.go (4)

67-67: Add comprehensive tests for new test scenarios.

The addition of TestBuildFromGitWithModifications is a good practice as it tests new functionalities. Ensure that this test covers all scenarios related to the modifications in the Git repository and the interaction with Minio.


73-73: Review the initialization and usage of k8sClient and minioClient.

The initialization of k8sClient and minioClient is crucial for the test setup. Ensure that these clients are properly initialized and used in subsequent method calls. It's also important to verify that the minio.New method properly initializes the Minio client with the necessary configurations.

Also applies to: 78-78

Verification successful

Initialization and Usage of k8sClient and minioClient Verified

The initialization and usage of k8sClient and minioClient in the TestBuildFromGitWithModifications function have been verified. Both clients are properly initialized and used in subsequent method calls.

  • k8sClient is initialized with k8s.NewClient(ctx, e2e.DefaultTestScope()) and checked for errors.
  • minioClient is initialized with minio.New(ctx, k8sClient) and checked for errors.
  • Both clients are passed to the knuu.New method with the appropriate configurations.

No issues were found regarding the initialization and usage of these clients.

Scripts executed

The following scripts were executed for the analysis:


Script:

#!/bin/bash
# Description: Verify the initialization and proper usage of k8sClient and minioClient.
ast-grep --lang go --pattern $'func NewClient($_, $_) (*k8s.Client, error) {
  $$$
  $_ = $_.New($_, $_)
  $$$
}'

Length of output: 114



Script:

#!/bin/bash
# Search for the NewClient function in the codebase
ast-grep --lang go --pattern 'func NewClient($_, $_) (*k8s.Client, error)' 

# Search for the New method in the codebase
ast-grep --lang go --pattern 'func ($_ *$_) New($_, $_) $_' 

# Search for the TestBuildFromGitWithModifications function to verify the usage of k8sClient and minioClient
ast-grep --lang go --pattern 'func TestBuildFromGitWithModifications($_) $_' 

Length of output: 4005


29-29: Check the robustness of Git repository setup in tests.

The SetGitRepo method is used here to configure the Git repository from which the Docker image is built. Given the critical nature of this setup for the test, it's essential to ensure that this method handles potential errors gracefully, such as unreachable repositories or authentication issues.

Also applies to: 35-40

Verification successful

The SetGitRepo method in pkg/instance/instance.go includes robust error handling.

The method contains multiple checks and error returns, ensuring that various potential issues (such as invalid states, build context errors, image name retrieval errors, and builder creation errors) are handled gracefully.

  • File: pkg/instance/instance.go
    • Lines: 261-283
Scripts executed

The following scripts were executed for the analysis:


Script:

#!/bin/bash
# Description: Verify that error handling is robust in the SetGitRepo method.
ast-grep --lang go --pattern $'func ($_ *knuu) SetGitRepo($_, $_) error {
  $$$
  if $_, $_ := $_; $_ != nil {
    return $_
  }
  $$$
}'

Length of output: 138



Script:

#!/bin/bash
# Searching for the definition of the SetGitRepo method in the codebase
rg "func (.*) SetGitRepo" --no-heading --line-number

Length of output: 291



Script:

#!/bin/bash
# Extracting the implementation of the SetGitRepo method from pkg/knuu/instance_old.go
ast-grep --lang go --pattern 'func (i *Instance) SetGitRepo(ctx context.Context, gitContext builder.GitContext) error {
  $$$
}' pkg/knuu/instance_old.go

Length of output: 378



Script:

#!/bin/bash
# Extracting the implementation of the SetGitRepo method from pkg/instance/instance.go
ast-grep --lang go --pattern 'func (i *Instance) SetGitRepo(ctx context.Context, gitContext builder.GitContext) error {
  $$$
}' pkg/instance/instance.go

Length of output: 1483


26-26: Ensure the new instance creation is done properly.

The New method of knuu is expected to handle all necessary initializations, including setting up the MinioClient and K8sClient as per the PR changes. It is crucial to ensure that this method is properly setting up these clients to avoid runtime errors.

pkg/knuu/knuu.go Outdated Show resolved Hide resolved
pkg/knuu/knuu_test.go Outdated Show resolved Hide resolved
pkg/knuu/knuu_test.go Outdated Show resolved Hide resolved
pkg/knuu/knuu_test.go Outdated Show resolved Hide resolved
pkg/knuu/knuu_test.go Outdated Show resolved Hide resolved
pkg/knuu/knuu.go Outdated Show resolved Hide resolved
Co-authored-by: Matthew Sevey <[email protected]>
pkg/knuu/knuu_test.go Outdated Show resolved Hide resolved
pkg/knuu/knuu_test.go Outdated Show resolved Hide resolved
Copy link
Contributor

@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

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 6793a8b and dd6c378.

Files selected for processing (1)
  • pkg/knuu/knuu.go (4 hunks)
Additional context used
GitHub Check: test (./e2e/bittwister, 60m)
pkg/knuu/knuu.go

[failure] 175-175:
undefined: ErrTestScopeMistMatch

GitHub Check: test (./e2e/system, 15m)
pkg/knuu/knuu.go

[failure] 175-175:
undefined: ErrTestScopeMistMatch

GitHub Check: test (./e2e/basic, 15m)
pkg/knuu/knuu.go

[failure] 175-175:
undefined: ErrTestScopeMistMatch

GitHub Check: Run govulncheck
pkg/knuu/knuu.go

[failure] 175-175:
undefined: ErrTestScopeMistMatch

GitHub Check: golangci-lint
pkg/knuu/knuu.go

[failure] 175-175:
undefined: ErrTestScopeMistMatch) (typecheck)


[failure] 175-175:
undefined: ErrTestScopeMistMatch) (typecheck)


[failure] 175-175:
undefined: ErrTestScopeMistMatch) (typecheck)


[failure] 175-175:
undefined: ErrTestScopeMistMatch (typecheck)

Additional comments not posted (3)
pkg/knuu/knuu.go (3)

52-54: Ensure proper error handling in the New function.

The error handling in the New function is correctly implemented. It checks for errors from validateOptions and returns early if an error is encountered, which is a good practice to prevent further execution when the configuration is not valid.


62-63: Good use of struct embedding for system dependencies.

Embedding SystemDependencies within Knuu struct is a clean way to inherit methods and properties, reducing redundancy and enhancing code organization.


196-197: Ensure consistent handling of default values in setDefaults.

The handling of default values for TestScope and timeout is crucial for ensuring the system behaves predictably when configurations are not explicitly provided. The current implementation correctly sets defaults based on the presence of K8sClient.

pkg/knuu/knuu.go Outdated Show resolved Hide resolved
pkg/knuu/knuu.go Outdated Show resolved Hide resolved
@mojtaba-esk mojtaba-esk requested review from tty47 and MSevey June 25, 2024 15:04
Copy link
Contributor

@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 UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between dd6c378 and ba554f4.

Files selected for processing (6)
  • e2e/bittwister/suite_setup_test.go (1 hunks)
  • e2e/system/build_from_git_test.go (2 hunks)
  • e2e/tshark/tshark_test.go (4 hunks)
  • pkg/knuu/errors.go (1 hunks)
  • pkg/knuu/knuu.go (4 hunks)
  • pkg/knuu/knuu_test.go (2 hunks)
Files skipped from review as they are similar to previous changes (4)
  • e2e/bittwister/suite_setup_test.go
  • e2e/tshark/tshark_test.go
  • pkg/knuu/knuu.go
  • pkg/knuu/knuu_test.go
Additional comments not posted (2)
e2e/system/build_from_git_test.go (1)

72-85: Good integration of k8sClient and minioClient in knuu initialization.

The changes correctly implement the PR's objective of reusing Minio clients by integrating k8sClient and minioClient into the knuu initialization. This should help in reducing the overhead as intended.

pkg/knuu/errors.go (1)

208-210: Proper addition of error handling related to test scope and Kubernetes client.

The addition of ErrTestScopeNotSet, ErrK8sClientNotSet, and ErrTestScopeMistMatch enhances the error handling capabilities of the system, providing more descriptive errors related to the configuration of knuu. This aligns well with the PR's goal of improving validation processes.

e2e/system/build_from_git_test.go Show resolved Hide resolved
Copy link
Member

@MSevey MSevey left a comment

Choose a reason for hiding this comment

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

Nice!

@MSevey MSevey changed the title chore: optimize minio cli to be reused chore!: make minio client optional and improve initialization Jun 26, 2024
@MSevey MSevey added this to the v0.15.0 milestone Jun 26, 2024
Copy link
Contributor

@tty47 tty47 left a comment

Choose a reason for hiding this comment

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

nice!

@mojtaba-esk mojtaba-esk added this pull request to the merge queue Jun 27, 2024
Merged via the queue into main with commit 9b40b70 Jun 27, 2024
10 of 11 checks passed
@mojtaba-esk mojtaba-esk deleted the mojtaba/429-optimize-minio-cli-reuse branch June 27, 2024 10:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

Optimize Minio Client Usage by Reusing Across Requests
3 participants