Skip to content

Commit e2bbbe1

Browse files
authored
Merge pull request #251 from andyzhangx/dynamic-provisoning-doc
doc: add bring your own account doc
2 parents 6ee67ad + dbae8e4 commit e2bbbe1

File tree

5 files changed

+49
-25
lines changed

5 files changed

+49
-25
lines changed

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,6 @@ This driver allows Kubernetes to access Azure Storage through one of following m
1010

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

13-
#### Breaking change
14-
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.
15-
1613
### Container Images & Kubernetes Compatibility:
1714
|driver version |Image | 1.15+ | built-in blobfuse version |
1815
|----------------|-------------------------------------------|--------|---------------------------|
@@ -21,6 +18,9 @@ Since `v0.7.0`, driver name changed from `blobfuse.csi.azure.com` to `blob.csi.a
2118
|v0.8.0 |mcr.microsoft.com/k8s/csi/blob-csi:v0.8.0 | yes | 1.3.1 |
2219
|v0.7.0 |mcr.microsoft.com/k8s/csi/blob-csi:v0.7.0 | yes | 1.2.4 |
2320

21+
#### Breaking change notice
22+
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.
23+
2424
### Driver parameters
2525
Please refer to `blob.csi.azure.com` [driver parameters](./docs/driver-parameters.md)
2626

deploy/example/e2e_usage.md

Lines changed: 25 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,33 @@
11
## CSI driver example
22
> refer to [driver parameters](../../docs/driver-parameters.md) for more detailed usage
33
4-
### Dynamic Provisioning (create storage account and blob container by CSI driver)
5-
- Create CSI storage class
4+
### Dynamic Provisioning
5+
#### Option#1: create storage account by CSI driver
6+
- Create storage class
67
```console
78
kubectl create -f https://raw.githubusercontent.com/kubernetes-sigs/blob-csi-driver/master/deploy/example/storageclass-blobfuse.yaml
89
```
910

10-
- Create a statefulset with blob storage mount
11+
#### Option#2: bring your own storage account
12+
> only available from `v0.9.0`
13+
- Use `kubectl create secret` to create `azure-secret` with existing storage account name and key
14+
```console
15+
kubectl create secret generic azure-secret --from-literal accountname=NAME --from-literal accountkey="KEY" --type=Opaque
16+
```
17+
18+
- create storage class referencing `azure-secret`
19+
```console
20+
kubectl create -f https://raw.githubusercontent.com/kubernetes-sigs/blob-csi-driver/master/deploy/example/storageclass-blob-secret.yaml
21+
```
22+
23+
#### Create application
24+
- Create a statefulset with volume mount
1125
```console
1226
kubectl create -f https://raw.githubusercontent.com/kubernetes-sigs/blob-csi-driver/master/deploy/example/statefulset.yaml
1327
```
1428

1529
- Execute `df -h` command in the container
16-
```
30+
```console
1731
# kubectl exec -it statefulset-blob-0 sh
1832
# df -h
1933
Filesystem Size Used Avail Use% Mounted on
@@ -50,13 +64,18 @@ kubectl create -f https://raw.githubusercontent.com/kubernetes-sigs/blob-csi-dri
5064
- Use `kubectl create secret` to create `azure-secret` with existing storage account name and key(or sastoken)
5165
```console
5266
kubectl create secret generic azure-secret --from-literal azurestorageaccountname=NAME --from-literal azurestorageaccountkey="KEY" --type=Opaque
53-
#kubectl create secret generic azure-secret --from-literal azurestorageaccountname=NAME --from-literal azurestorageaccountsastoken
67+
```
68+
69+
or create `azure-secret` with existing storage account name and sastoken:
70+
71+
```console
72+
kubectl create secret generic azure-secret --from-literal azurestorageaccountname=NAME --from-literal azurestorageaccountsastoken
5473
="sastoken" --type=Opaque
5574
```
5675

5776
> storage account key(or sastoken) could also be stored in Azure Key Vault, check example here: [read-from-keyvault](../../docs/read-from-keyvault.md)
5877
59-
- 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`
78+
- 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`
6079
```yaml
6180
apiVersion: v1
6281
kind: PersistentVolume

pkg/blob/blob.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,11 @@ const (
5353
serverNameField = "server"
5454
tagsField = "tags"
5555
protocolField = "protocol"
56+
storageAccountField = "storageaccount"
57+
storageAccountTypeField = "storageaccounttype"
58+
skuNameField = "skuname"
59+
resourceGroupField = "resourcegroup"
60+
locationField = "location"
5661
secretNamespaceField = "secretnamespace"
5762
containerNameField = "containername"
5863
storeAccountKeyField = "storeaccountkey"

pkg/blob/controllerserver.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -62,15 +62,15 @@ func (d *Driver) CreateVolume(ctx context.Context, req *csi.CreateVolumeRequest)
6262
// the values to the cloud provider.
6363
for k, v := range parameters {
6464
switch strings.ToLower(k) {
65-
case "skuname":
65+
case skuNameField:
6666
storageAccountType = v
67-
case "storageaccounttype":
67+
case storageAccountTypeField:
6868
storageAccountType = v
69-
case "location":
69+
case locationField:
7070
location = v
71-
case "storageaccount":
71+
case storageAccountField:
7272
account = v
73-
case "resourcegroup":
73+
case resourceGroupField:
7474
resourceGroup = v
7575
case containerNameField:
7676
containerName = v

pkg/blob/controllerserver_test.go

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -122,11 +122,11 @@ func TestCreateVolume(t *testing.T) {
122122
d.cloud = &azure.Cloud{}
123123
mp := make(map[string]string)
124124
mp["protocol"] = "unit-test"
125-
mp["skuname"] = "unit-test"
126-
mp["storageaccounttype"] = "unit-test"
127-
mp["location"] = "unit-test"
128-
mp["storageaccount"] = "unit-test"
129-
mp["resourcegroup"] = "unit-test"
125+
mp[skuNameField] = "unit-test"
126+
mp[storageAccountTypeField] = "unit-test"
127+
mp[locationField] = "unit-test"
128+
mp[storageAccountField] = "unit-test"
129+
mp[resourceGroupField] = "unit-test"
130130
mp["containername"] = "unit-test"
131131
req := &csi.CreateVolumeRequest{
132132
Name: "unit-test",
@@ -172,7 +172,7 @@ func TestCreateVolume(t *testing.T) {
172172
d.cloud = &azure.Cloud{}
173173
mp := make(map[string]string)
174174
mp["tags"] = "unit-test"
175-
mp["storageaccounttype"] = "premium"
175+
mp[storageAccountTypeField] = "premium"
176176
req := &csi.CreateVolumeRequest{
177177
Name: "unit-test",
178178
VolumeCapabilities: stdVolumeCapabilities,
@@ -193,11 +193,11 @@ func TestCreateVolume(t *testing.T) {
193193
testFunc: func(t *testing.T) {
194194
d := NewFakeDriver()
195195
mp := make(map[string]string)
196-
mp["skuname"] = "unit-test"
197-
mp["storageaccounttype"] = "unit-test"
198-
mp["location"] = "unit-test"
199-
mp["storageaccount"] = "unit-test"
200-
mp["resourcegroup"] = "unit-test"
196+
mp[skuNameField] = "unit-test"
197+
mp[storageAccountTypeField] = "unit-test"
198+
mp[locationField] = "unit-test"
199+
mp[storageAccountField] = "unit-test"
200+
mp[resourceGroupField] = "unit-test"
201201
mp["containername"] = "unit-test"
202202
req := &csi.CreateVolumeRequest{
203203
Name: "unit-test",

0 commit comments

Comments
 (0)