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

Add authorization options for azure storage backend #486

Merged
merged 21 commits into from
Nov 16, 2021
Merged
Show file tree
Hide file tree
Changes from 14 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
307 changes: 121 additions & 186 deletions Cargo.lock

Large diffs are not rendered by default.

32 changes: 32 additions & 0 deletions build/setup_azurite.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
#!/bin/bash
roeap marked this conversation as resolved.
Show resolved Hide resolved

export AZURE_STORAGE_CONNECTION_STRING='DefaultEndpointsProtocol=http;AccountName=devstoreaccount1;AccountKey=Eby8vdM02xNOcqFlqUwJPLlmEtlCDXJ1OUzFT50uSRZ6IFsuFq2UVErCz4I6tq/K1SZFPTOtr/KBHBeksoGMGw==;BlobEndpoint=http://azurite:10000/devstoreaccount1;'

function wait_for() {
retries=10
until eval $2 > /dev/null 2>&1
do
if [ "$retries" -lt "0" ]; then
echo "$1 is still offline after 10 retries";
exit 1;
fi
echo "Waiting on $1 to start..."
sleep 5
retries=$((retries - 1))
done
}

# We need to use azcopy natively and not via az, since the local url is not recognized autmoatically by
# azcopy as a blob localtion and we cannot pass the '--from-to' flag down into the az commands.
wget -O azcopy_v10.tar.gz https://aka.ms/downloadazcopy-v10-linux && tar -xf azcopy_v10.tar.gz --strip-components=1
cp ./azcopy /usr/bin/

az config set extension.use_dynamic_install=yes_without_prompt

# azcopy does not support authentication via account key, thus we generate an saas key
SAS=$(az storage account generate-sas --permissions cdlruwap --services b --resource-types sco --expiry 2030-01-01 -o tsv)

# create account and copy data
az storage fs create -n deltars
azcopy copy "data/golden" "http://azurite:10000/devstoreaccount1/deltars/?$SAS" --recursive=true --from-to=LocalBlob
azcopy copy "data/simple_table" "http://azurite:10000/devstoreaccount1/deltars/?$SAS" --recursive=true --from-to=LocalBlob
25 changes: 25 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,28 @@ services:
- "./rust/tests/data/simple_table:/data/simple_table"
- "./rust/tests/data/simple_commit:/data/simple_commit"
- "./rust/tests/data/concurrent_workers:/data/concurrent_workers"

azurite:
image: mcr.microsoft.com/azure-storage/azurite
ports:
- "10000:10000"
- "10001:10001"
command:
- "azurite"
- "--blobHost"
- "0.0.0.0"
- "--loose"

setup-azurite:
image: mcr.microsoft.com/azure-cli
depends_on:
- azurite
entrypoint: "/bin/bash"
command:
- /setup_azurite.sh
volumes:
- "./build/setup_azurite.sh:/setup_azurite.sh"
- "./rust/tests/data/golden:/data/golden"
- "./rust/tests/data/simple_table:/data/simple_table"
- "./rust/tests/data/simple_commit:/data/simple_commit"
- "./rust/tests/data/concurrent_workers:/data/concurrent_workers"
roeap marked this conversation as resolved.
Show resolved Hide resolved
9 changes: 4 additions & 5 deletions rust/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,9 @@ percent-encoding = "2"
reqwest = { version = "0.11", default-features = false, features = ["rustls-tls", "stream"], optional = true}

# Azure
azure_core = { git = "https://github.com/Azure/azure-sdk-for-rust", optional = true, rev = "2f1ca2e57801c81143b871fc5bf0df8e7250a56c" }
azure_storage = { git = "https://github.com/Azure/azure-sdk-for-rust", optional = true, rev = "2f1ca2e57801c81143b871fc5bf0df8e7250a56c", features = ["blob", "account", "data_lake"] }
# added to avoid cyclic dependecy caused by transient dependencies of azure crates
indexmap = { version = "~1.6.2", optional = true}
azure_core = { git = "https://github.com/Azure/azure-sdk-for-rust", optional = true, rev = "c6f94bcd494e74dc71977136fa62362d0b8f6fbf" }
azure_storage = { git = "https://github.com/Azure/azure-sdk-for-rust", optional = true, rev = "c6f94bcd494e74dc71977136fa62362d0b8f6fbf", features = ["blob", "account"] }
azure_identity = { git = "https://github.com/Azure/azure-sdk-for-rust", optional = true, rev = "c6f94bcd494e74dc71977136fa62362d0b8f6fbf" }

# S3
rusoto_core = { version = "0.46", default-features = false, optional = true }
Expand Down Expand Up @@ -72,7 +71,7 @@ async-trait = "0.1"
[features]
rust-dataframe-ext = []
datafusion-ext = ["datafusion"]
azure = ["azure_core", "azure_storage", "reqwest", "indexmap"]
azure = ["azure_core", "azure_storage", "azure_identity", "reqwest"]
s3 = ["rusoto_core/native-tls", "rusoto_credential", "rusoto_s3/native-tls", "rusoto_sts/native-tls", "rusoto_dynamodb/native-tls", "maplit"]
s3-rustls = ["rusoto_core/rustls", "rusoto_credential", "rusoto_s3/rustls", "rusoto_sts/rustls", "rusoto_dynamodb/rustls", "maplit"]
gcs = ["async-stream", "tame-gcs", "tame-oauth", "reqwest"]
Expand Down
222 changes: 0 additions & 222 deletions rust/src/storage/azure.rs

This file was deleted.

Loading