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

storage(RadosGWStorage): add Region to RadosGWStorage for multi-zone setups (PROJQUAY-7300) #2928

Merged
merged 1 commit into from
Jul 4, 2024

Conversation

michaelalang
Copy link
Contributor

Reason

Red Hat/IBM Ceph Storage provides multi-zone setups for on prem and geo-replication of Buckets. 

The RadosGWStorage Class in quay does not provide capability to configure region_name which is mandator for S3v4 signature in such scenarios. 

Expectation and change description

The default behavior is not changed as boto3 anyway sets us-east-1 as default region 


>>> import boto3

>>> client = boto3.client("s3", endpoint_url="https://s3.example.com", aws_access_key_id="user1", aws_secret_access_key="user1")

>>> boto3.set_stream_logger(name='botocore')

>>> client.list_buckets()

...

2024-06-10 06:42:41,550 botocore.hooks [DEBUG] Event request-created.s3.ListBuckets: calling handler <function add_retry_headers at 0x7fb041ca9820>

2024-06-10 06:42:41,550 botocore.endpoint [DEBUG] Sending http request: <AWSPreparedRequest stream_output=False, method=GET, url=https://s3.example.com/, headers={'User-Agent': b'Boto3/1.34.54 md/Botocore#1.34.54 ua/2.0 os/linux#5.14.0-362.24.2.el9_3.x86_64 md/arch#x86_64 lang/python#3.9.18 md/pyimpl#CPython cfg/retry-mode#legacy Botocore/1.34.54', 'X-Amz-Date': b'20240610T044241Z', 'X-Amz-Content-SHA256': b'e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855', 'Authorization': b'AWS4-HMAC-SHA256 Credential=user1/20240610/us-east-1/s3/aws4_request, SignedHeaders=host;x-amz-content-sha256;x-amz-date, Signature=8470aac39171991fdd9296cdc239ef785bd9be8c9084a8adc08f49d75a47968a', 'amz-sdk-invocation-id': b'506a670b-f4e9-4cc9-be86-300c3bef38ea', 'amz-sdk-request': b'attempt=3; max=5'}>

The reason Red Hat/IBM Ceph storage accepts the region is that without Zones in RGW the  default configuration will accept all signatures in that regards.

By extending the RadosGWStorage with the region_name parameter we will be able to adjust the region and S3v4 signatures accordingly.

The change is minimal inversive as we only need to extend the Class initialization accepted parameters and hand it over to the connect_kwargs which are boto3's client/session parameters.

The region is called region_name which is the reason for the naming schema choosen.

Documentation

It is expected that we update the Documentation of the RadosGWStorage class with region_name as optional parameter.

@app-sre-bot
Copy link
Collaborator

Can one of the admins verify this patch?

@michaelalang michaelalang changed the title storage(RadosGWStorage): add Region to RadosGWStorage for multi-zone setups (RPOJQUAY-7300) storage(RadosGWStorage): add Region to RadosGWStorage for multi-zone setups (PROJQUAY-7300) Jun 10, 2024
Copy link

codecov bot commented Jun 10, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 70.84%. Comparing base (d112435) to head (27b5b25).

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #2928      +/-   ##
==========================================
- Coverage   70.85%   70.84%   -0.01%     
==========================================
  Files         439      439              
  Lines       41065    41065              
  Branches     5382     5382              
==========================================
- Hits        29095    29094       -1     
- Misses      10269    10271       +2     
+ Partials     1701     1700       -1     
Flag Coverage Δ
unit 70.84% <ø> (-0.01%) ⬇️

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.

@dmage dmage enabled auto-merge (squash) July 4, 2024 09:21
@dmage dmage disabled auto-merge July 4, 2024 09:21
@dmage dmage merged commit 27ebc40 into quay:master Jul 4, 2024
17 of 19 checks passed
@dmage
Copy link
Member

dmage commented Jul 4, 2024

/cherrypick redhat-3.12

@openshift-cherrypick-robot

@dmage: new pull request created: #2994

In response to this:

/cherrypick redhat-3.12

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

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