Skip to content

Commit

Permalink
rptest: add url_style customization to SISettings
Browse files Browse the repository at this point in the history
Adds the customization option for `cloud_storage_url_style` to
`SISettings`. The `S3Client` will also use this style for configuring
the `boto3` client.
  • Loading branch information
WillemKauf committed Apr 16, 2024
1 parent ea629d7 commit 7727b0c
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
6 changes: 6 additions & 0 deletions tests/rptest/archival/s3_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ def __init__(self,
access_key,
secret_key,
logger,
url_style='virtual',
endpoint=None,
disable_ssl=True,
signature_version='s3v4',
Expand All @@ -70,6 +71,7 @@ def __init__(self,
self._access_key = access_key
self._secret_key = secret_key
self._endpoint = endpoint
self._url_style = url_style
self._disable_ssl = disable_ssl
if signature_version.lower() == "unsigned":
self._signature_version = UNSIGNED
Expand All @@ -83,6 +85,10 @@ def __init__(self,
def make_client(self):
cfg = Config(region_name=self._region,
signature_version=self._signature_version,
s3={
'addressing_style':
'virtual' if self._url_style != 'path' else 'path'
},
retries={
'max_attempts': 10,
'mode': 'adaptive'
Expand Down
11 changes: 11 additions & 0 deletions tests/rptest/services/redpanda.py
Original file line number Diff line number Diff line change
Expand Up @@ -435,6 +435,7 @@ def __init__(self,
cloud_storage_region: str = 'panda-region',
cloud_storage_api_endpoint: str = 'minio-s3',
cloud_storage_api_endpoint_port: int = 9000,
cloud_storage_url_style: str = 'virtual_host',
cloud_storage_cache_size: Optional[int] = None,
cloud_storage_cache_max_objects: Optional[int] = None,
cloud_storage_enable_remote_read: bool = True,
Expand Down Expand Up @@ -477,12 +478,20 @@ def __init__(self,
self.cloud_storage_secret_key = cloud_storage_secret_key
self.cloud_storage_region = cloud_storage_region
self._cloud_storage_bucket = f'panda-bucket-{uuid.uuid1()}'
self.cloud_storage_url_style = cloud_storage_url_style

self.cloud_storage_api_endpoint = cloud_storage_api_endpoint
if test_context.globals.get(self.GLOBAL_CLOUD_PROVIDER,
'aws') == 'gcp':
self.cloud_storage_api_endpoint = 'storage.googleapis.com'
self.cloud_storage_api_endpoint_port = cloud_storage_api_endpoint_port

if hasattr(test_context, 'injected_args') \
and test_context.injected_args is not None \
and 'cloud_storage_url_style' in test_context.injected_args:
self.cloud_storage_url_style = test_context.injected_args[
'cloud_storage_url_style']

elif self.cloud_storage_type == CloudStorageType.ABS:
self.cloud_storage_azure_shared_key = self.ABS_AZURITE_KEY
self.cloud_storage_azure_storage_account = self.ABS_AZURITE_ACCOUNT
Expand Down Expand Up @@ -628,6 +637,7 @@ def update_rp_conf(self, conf) -> dict[str, Any]:
conf["cloud_storage_secret_key"] = self.cloud_storage_secret_key
conf["cloud_storage_region"] = self.cloud_storage_region
conf["cloud_storage_bucket"] = self._cloud_storage_bucket
conf["cloud_storage_url_style"] = self.cloud_storage_url_style
elif self.cloud_storage_type == CloudStorageType.ABS:
conf[
'cloud_storage_azure_storage_account'] = self.cloud_storage_azure_storage_account
Expand Down Expand Up @@ -2937,6 +2947,7 @@ def start_si(self):
logger=self.logger,
signature_version=self.si_settings.
cloud_storage_signature_version,
url_style=self.si_settings.cloud_storage_url_style,
before_call_headers=self.si_settings.before_call_headers)

self.logger.debug(
Expand Down

0 comments on commit 7727b0c

Please sign in to comment.