Skip to content

Commit

Permalink
feat(object store): support azblob workload identity (#15940)
Browse files Browse the repository at this point in the history
  • Loading branch information
wcy-fdu authored Mar 28, 2024
1 parent 17ce345 commit e380a5d
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 11 deletions.
5 changes: 2 additions & 3 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -304,6 +304,8 @@ tokio-postgres = { git = "https://github.com/madsim-rs/rust-postgres.git", rev =
futures-timer = { git = "https://github.com/madsim-rs/futures-timer.git", rev = "05b33b4" }
# patch: unlimit 4MB message size for grpc client
etcd-client = { git = "https://github.com/risingwavelabs/etcd-client.git", rev = "4e84d40" }
# todo(wcy-fdu): remove this patch fork after opendal release a new version to apply azure workload identity change.
reqsign = { git = "https://github.com/wcy-fdu/reqsign.git", rev = "e6cb304" }

[workspace.metadata.dylint]
libraries = [{ path = "./lints" }]
2 changes: 1 addition & 1 deletion risedev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1370,4 +1370,4 @@ template:
port: 6379

# address of redis
address: "127.0.0.1"
address: "127.0.0.1"
10 changes: 3 additions & 7 deletions src/object_store/src/object/opendal_engine/azblob.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ use opendal::Operator;

use super::{EngineType, OpendalObjectStore};
use crate::object::ObjectResult;

const AZBLOB_ENDPOINT: &str = "AZBLOB_ENDPOINT";
impl OpendalObjectStore {
/// create opendal azblob engine.
pub fn new_azblob_engine(container_name: String, root: String) -> ObjectResult<Self> {
Expand All @@ -26,16 +28,10 @@ impl OpendalObjectStore {
builder.root(&root);
builder.container(&container_name);

let endpoint = std::env::var("AZBLOB_ENDPOINT")
let endpoint = std::env::var(AZBLOB_ENDPOINT)
.unwrap_or_else(|_| panic!("AZBLOB_ENDPOINT not found from environment variables"));
let account_name = std::env::var("AZBLOB_ACCOUNT_NAME")
.unwrap_or_else(|_| panic!("AZBLOB_ACCOUNT_NAME not found from environment variables"));
let account_key = std::env::var("AZBLOB_ACCOUNT_KEY")
.unwrap_or_else(|_| panic!("AZBLOB_ACCOUNT_KEY not found from environment variables"));

builder.endpoint(&endpoint);
builder.account_name(&account_name);
builder.account_key(&account_key);
let op: Operator = Operator::new(builder)?
.layer(LoggingLayer::default())
.layer(RetryLayer::default())
Expand Down

0 comments on commit e380a5d

Please sign in to comment.