Skip to content
Merged
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
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,6 @@ This driver allows Kubernetes to access Azure Storage through one of following m

csi plugin name: `blob.csi.azure.com`

#### Breaking change
Since `v0.7.0`, driver name changed from `blobfuse.csi.azure.com` to `blob.csi.azure.com`, volume created by `v0.6.0`(or prior version) could not be mounted by `v0.7.0` driver. If you have volumes created by `v0.6.0` version, just keep the driver running in your cluster.

### Container Images & Kubernetes Compatibility:
|driver version |Image | 1.15+ | built-in blobfuse version |
|----------------|-------------------------------------------|--------|---------------------------|
Expand All @@ -21,6 +18,9 @@ Since `v0.7.0`, driver name changed from `blobfuse.csi.azure.com` to `blob.csi.a
|v0.8.0 |mcr.microsoft.com/k8s/csi/blob-csi:v0.8.0 | yes | 1.3.1 |
|v0.7.0 |mcr.microsoft.com/k8s/csi/blob-csi:v0.7.0 | yes | 1.2.4 |

#### Breaking change notice
Since `v0.7.0`, driver name changed from `blobfuse.csi.azure.com` to `blob.csi.azure.com`, volume created by `v0.6.0`(or prior version) could not be mounted by `v0.7.0` driver. If you have volumes created by `v0.6.0` version, just keep the driver running in your cluster.

### Driver parameters
Please refer to `blob.csi.azure.com` [driver parameters](./docs/driver-parameters.md)

Expand Down
31 changes: 25 additions & 6 deletions deploy/example/e2e_usage.md
Original file line number Diff line number Diff line change
@@ -1,19 +1,33 @@
## CSI driver example
> refer to [driver parameters](../../docs/driver-parameters.md) for more detailed usage

### Dynamic Provisioning (create storage account and blob container by CSI driver)
- Create CSI storage class
### Dynamic Provisioning
#### Option#1: create storage account by CSI driver
- Create storage class
```console
kubectl create -f https://raw.githubusercontent.com/kubernetes-sigs/blob-csi-driver/master/deploy/example/storageclass-blobfuse.yaml
```

- Create a statefulset with blob storage mount
#### Option#2: bring your own storage account
> only available from `v0.9.0`
- Use `kubectl create secret` to create `azure-secret` with existing storage account name and key
```console
kubectl create secret generic azure-secret --from-literal accountname=NAME --from-literal accountkey="KEY" --type=Opaque
```

- create storage class referencing `azure-secret`
```console
kubectl create -f https://raw.githubusercontent.com/kubernetes-sigs/blob-csi-driver/master/deploy/example/storageclass-blob-secret.yaml
```

#### Create application
- Create a statefulset with volume mount
```console
kubectl create -f https://raw.githubusercontent.com/kubernetes-sigs/blob-csi-driver/master/deploy/example/statefulset.yaml
```

- Execute `df -h` command in the container
```
```console
# kubectl exec -it statefulset-blob-0 sh
# df -h
Filesystem Size Used Avail Use% Mounted on
Expand Down Expand Up @@ -50,13 +64,18 @@ kubectl create -f https://raw.githubusercontent.com/kubernetes-sigs/blob-csi-dri
- Use `kubectl create secret` to create `azure-secret` with existing storage account name and key(or sastoken)
```console
kubectl create secret generic azure-secret --from-literal azurestorageaccountname=NAME --from-literal azurestorageaccountkey="KEY" --type=Opaque
#kubectl create secret generic azure-secret --from-literal azurestorageaccountname=NAME --from-literal azurestorageaccountsastoken
```

or create `azure-secret` with existing storage account name and sastoken:

```console
kubectl create secret generic azure-secret --from-literal azurestorageaccountname=NAME --from-literal azurestorageaccountsastoken
="sastoken" --type=Opaque
```

> storage account key(or sastoken) could also be stored in Azure Key Vault, check example here: [read-from-keyvault](../../docs/read-from-keyvault.md)

- Create a blob storage CSI PV: download [`pv-blobfuse-csi.yaml` file](https://raw.githubusercontent.com/kubernetes-sigs/blob-csi-driver/master/deploy/example/pv-blobfuse-csi.yaml) and edit `containerName` in `volumeAttributes`
- Create PV: download [`pv-blobfuse-csi.yaml` file](https://raw.githubusercontent.com/kubernetes-sigs/blob-csi-driver/master/deploy/example/pv-blobfuse-csi.yaml) and edit `containerName` in `volumeAttributes`
```yaml
apiVersion: v1
kind: PersistentVolume
Expand Down
5 changes: 5 additions & 0 deletions pkg/blob/blob.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,11 @@ const (
serverNameField = "server"
tagsField = "tags"
protocolField = "protocol"
storageAccountField = "storageaccount"
storageAccountTypeField = "storageaccounttype"
skuNameField = "skuname"
resourceGroupField = "resourcegroup"
locationField = "location"
secretNamespaceField = "secretnamespace"
containerNameField = "containername"
storeAccountKeyField = "storeaccountkey"
Expand Down
10 changes: 5 additions & 5 deletions pkg/blob/controllerserver.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,15 +62,15 @@ func (d *Driver) CreateVolume(ctx context.Context, req *csi.CreateVolumeRequest)
// the values to the cloud provider.
for k, v := range parameters {
switch strings.ToLower(k) {
case "skuname":
case skuNameField:
storageAccountType = v
case "storageaccounttype":
case storageAccountTypeField:
storageAccountType = v
case "location":
case locationField:
location = v
case "storageaccount":
case storageAccountField:
account = v
case "resourcegroup":
case resourceGroupField:
resourceGroup = v
case containerNameField:
containerName = v
Expand Down
22 changes: 11 additions & 11 deletions pkg/blob/controllerserver_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -122,11 +122,11 @@ func TestCreateVolume(t *testing.T) {
d.cloud = &azure.Cloud{}
mp := make(map[string]string)
mp["protocol"] = "unit-test"
mp["skuname"] = "unit-test"
mp["storageaccounttype"] = "unit-test"
mp["location"] = "unit-test"
mp["storageaccount"] = "unit-test"
mp["resourcegroup"] = "unit-test"
mp[skuNameField] = "unit-test"
mp[storageAccountTypeField] = "unit-test"
mp[locationField] = "unit-test"
mp[storageAccountField] = "unit-test"
mp[resourceGroupField] = "unit-test"
mp["containername"] = "unit-test"
req := &csi.CreateVolumeRequest{
Name: "unit-test",
Expand Down Expand Up @@ -172,7 +172,7 @@ func TestCreateVolume(t *testing.T) {
d.cloud = &azure.Cloud{}
mp := make(map[string]string)
mp["tags"] = "unit-test"
mp["storageaccounttype"] = "premium"
mp[storageAccountTypeField] = "premium"
req := &csi.CreateVolumeRequest{
Name: "unit-test",
VolumeCapabilities: stdVolumeCapabilities,
Expand All @@ -193,11 +193,11 @@ func TestCreateVolume(t *testing.T) {
testFunc: func(t *testing.T) {
d := NewFakeDriver()
mp := make(map[string]string)
mp["skuname"] = "unit-test"
mp["storageaccounttype"] = "unit-test"
mp["location"] = "unit-test"
mp["storageaccount"] = "unit-test"
mp["resourcegroup"] = "unit-test"
mp[skuNameField] = "unit-test"
mp[storageAccountTypeField] = "unit-test"
mp[locationField] = "unit-test"
mp[storageAccountField] = "unit-test"
mp[resourceGroupField] = "unit-test"
mp["containername"] = "unit-test"
req := &csi.CreateVolumeRequest{
Name: "unit-test",
Expand Down