Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
74 changes: 46 additions & 28 deletions bin/mosaic/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -143,36 +143,47 @@ impl MosaicConfig {
);
}

if let TableStoreBackend::S3Compatible {
bucket,
region,
endpoint,
access_key_id,
secret_access_key,
..
} = &self.table_store.backend
{
if bucket.is_empty() {
bail!("table_store.bucket must not be empty");
match &self.table_store.backend {
TableStoreBackend::S3Compatible {
bucket,
region,
endpoint,
access_key_id,
secret_access_key,
..
} => {
if bucket.is_empty() {
bail!("table_store.bucket must not be empty");
}

if region.is_empty() {
bail!("table_store.region must not be empty");
}

if access_key_id.is_empty() {
bail!("table_store.access_key_id must not be empty");
}

if secret_access_key.is_empty() {
bail!("table_store.secret_access_key must not be empty");
}

if let Some(endpoint) = endpoint
&& endpoint.is_empty()
{
bail!("table_store.endpoint must not be empty when provided");
}
}

if region.is_empty() {
bail!("table_store.region must not be empty");
}

if access_key_id.is_empty() {
bail!("table_store.access_key_id must not be empty");
}

if secret_access_key.is_empty() {
bail!("table_store.secret_access_key must not be empty");
}

if let Some(endpoint) = endpoint
&& endpoint.is_empty()
{
bail!("table_store.endpoint must not be empty when provided");
TableStoreBackend::S3Irsa { bucket, region, .. } => {
if bucket.is_empty() {
bail!("table_store.bucket must not be empty");
}

if region.is_empty() {
bail!("table_store.region must not be empty");
}
}
_ => {}
}

Ok(())
Expand Down Expand Up @@ -281,6 +292,13 @@ pub(crate) enum TableStoreBackend {
#[serde(default)]
virtual_hosted_style_request: bool,
},
/// Uses the default AWS credential chain (env vars, IRSA web identity token,
/// instance profile). No static credentials required.
S3Irsa {
bucket: String,
region: String,
prefix: String,
},
}

#[derive(Debug, Clone, Deserialize)]
Expand Down
13 changes: 13 additions & 0 deletions bin/mosaic/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,19 @@ where
let store = S3TableStore::new(Arc::new(s3) as Arc<dyn ObjectStore>, prefix);
run_with_components(config, storage, store, net_client, net_controller).await
}
TableStoreBackend::S3Irsa {
bucket,
region,
prefix,
} => {
let s3 = AmazonS3Builder::new()
.with_bucket_name(bucket)
.with_region(region)
.build()
.context("failed to initialize s3 table store with IRSA credentials")?;
let store = S3TableStore::new(Arc::new(s3) as Arc<dyn ObjectStore>, prefix);
run_with_components(config, storage, store, net_client, net_controller).await
}
}
}

Expand Down
Loading