这是indexloc提供的服务,不要输入任何密码
Skip to content

feat(Migrate Auth TPC): Add auth option while creating HTTP/gRPC client #3570

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 7 commits into
base: master
Choose a base branch
from

Conversation

Tulsishah
Copy link
Collaborator

Description

  • Add auth option while creating HTTP/gRPC client behind the flag.

Link to the issue in case of a bug fix.

Testing details

  1. Manual - NA
  2. Unit tests - NA
  3. Integration tests - NA

Any backward incompatible change? If so, please explain.

Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Summary of Changes

Hello @Tulsishah, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request introduces a new, opt-in authentication mechanism for both HTTP and gRPC clients within the storage layer. By adding an EnableGoogleLibAuth flag, the system can now leverage Google's client library authentication flow, providing an alternative and potentially more robust way to handle credentials. The changes involve updating configuration structures, modifying client creation logic to conditionally apply this new flow, and adapting the HTTP client creation function to support pre-provided token sources.

Highlights

  • New Authentication Flag: I've introduced an EnableGoogleLibAuth boolean flag to the StorageClientConfig struct. This flag allows users to opt into a new authentication mechanism, likely leveraging Google's official client libraries for credential handling.
  • Conditional Client Authentication Logic: I've updated the client creation functions (createClientOptionForGRPCClient and createHTTPClientHandle) to conditionally apply authentication options. If EnableGoogleLibAuth is true, the system now uses storageutil.GetClientAuthOptionsAndToken to retrieve and apply authentication credentials; otherwise, it falls back to the existing CreateTokenSource method.
  • Flexible HTTP Client Creation: The CreateHttpClient function in storageutil has been modified to accept an optional oauth2.TokenSource parameter. This allows the caller (specifically, the new authentication flow for HTTP clients) to provide a pre-obtained token source, enhancing flexibility in how authentication tokens are managed and applied.
  • Test Adaptations: Existing unit tests for CreateHttpClient were updated to pass nil for the newly added tokenSrc parameter. This ensures that the tests continue to function correctly with the updated function signature without altering their original behavior.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point in your pull request via creating an issue comment (i.e. comment on the pull request page) using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in issue comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments or fill out our survey to provide feedback.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request introduces a new authentication path using the EnableGoogleLibAuth flag for creating HTTP and gRPC clients. I have suggested making error messages more descriptive to aid in debugging and adding comments to clarify the logic.

@Tulsishah Tulsishah force-pushed the call_function_to_add_as_client_option branch from 4abe8d5 to 4c71841 Compare July 23, 2025 06:55
@Tulsishah Tulsishah changed the base branch from create_creds_and_add_opt_for_client to master July 23, 2025 06:56
Copy link

codecov bot commented Jul 23, 2025

Codecov Report

Attention: Patch coverage is 58.97436% with 16 lines in your changes missing coverage. Please review.

Project coverage is 79.59%. Comparing base (6e272e1) to head (8ee312f).
Report is 1 commits behind head on master.

Files with missing lines Patch % Lines
internal/storage/storage_handle.go 44.82% 14 Missing and 2 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #3570      +/-   ##
==========================================
- Coverage   79.63%   79.59%   -0.05%     
==========================================
  Files         144      144              
  Lines       19143    19158      +15     
==========================================
+ Hits        15244    15248       +4     
- Misses       3375     3385      +10     
- Partials      524      525       +1     
Flag Coverage Δ
unittests 79.59% <58.97%> (-0.05%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@Tulsishah Tulsishah force-pushed the call_function_to_add_as_client_option branch from a9b9153 to a72f2b3 Compare July 23, 2025 08:03
@Tulsishah Tulsishah force-pushed the call_function_to_add_as_client_option branch from a72f2b3 to 8ee312f Compare July 23, 2025 08:14
@Tulsishah Tulsishah added execute-integration-tests Run only integration tests execute-integration-tests-on-zb To run E2E tests on zonal bucket. labels Jul 23, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
execute-integration-tests Run only integration tests execute-integration-tests-on-zb To run E2E tests on zonal bucket.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant