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
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ This option does not depend on cloud provider config file, supports cross subscr
- [Basic usage](./deploy/example/e2e_usage.md)
- [NFSv3](./deploy/example/nfs)
- [fsGroupPolicy](./deploy/example/fsgroup)
- [Volume cloning](./deploy/example/cloning)
- [Workload identity](./docs/workload-identity.md)

### Troubleshooting
Expand Down
66 changes: 66 additions & 0 deletions deploy/example/cloning/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
# Volume Cloning Example
## Feature Status: Beta

- supported from v1.23.2

## Create a Source PVC

```console
kubectl apply -f https://raw.githubusercontent.com/kubernetes-sigs/blob-csi-driver/master/deploy/example/storageclass-blobfuse2.yaml
kubectl apply -f https://raw.githubusercontent.com/kubernetes-sigs/blob-csi-driver/master/deploy/example/pvc-blob-csi.yaml
kubectl apply -f https://raw.githubusercontent.com/kubernetes-sigs/blob-csi-driver/master/deploy/example/nginx-pod-blob.yaml
```

### Check the Source PVC

```console
$ kubectl exec nginx-blob -- ls /mnt/blob
outfile
```

## Create a PVC from an existing PVC
> Make sure application is not writing data to source blob container
```console
kubectl apply -f https://raw.githubusercontent.com/kubernetes-sigs/blob-csi-driver/master/deploy/example/cloning/pvc-blob-cloning.yaml
```
### Check the Creation Status

```console
$ kubectl describe pvc pvc-blob-cloning
Name: pvc-blob-cloning
Namespace: default
StorageClass: blob-fuse
Status: Bound
Volume: pvc-6db5af93-3b32-4c24-a68e-b727d7801fd5
Labels: <none>
Annotations: kubectl.kubernetes.io/last-applied-configuration:
{"apiVersion":"v1","kind":"PersistentVolumeClaim","metadata":{"annotations":{},"name":"pvc-blob-cloning","namespace":"default"},"spec":{"a...
pv.kubernetes.io/bind-completed: yes
pv.kubernetes.io/bound-by-controller: yes
volume.beta.kubernetes.io/storage-provisioner: blob.csi.azure.com
volume.kubernetes.io/storage-provisioner: blob.csi.azure.com
Finalizers: [kubernetes.io/pvc-protection]
Capacity: 100Gi
Access Modes: RWX
VolumeMode: Filesystem
Mounted By: <none>
Events:
Type Reason Age From Message
---- ------ ---- ---- -------
Normal Provisioning 16s blob.csi.azure.com_aks-nodepool1-34988195-vmss000002_8ecdf8ad-b636-4ca5-81ee-0f1a49337168 External provisioner is provisioning volume for claim "default/pvc-blob-cloning"
Normal ExternalProvisioning 14s (x3 over 16s) persistentvolume-controller waiting for a volume to be created, either by external provisioner "blob.csi.azure.com" or manually created by system administrator
Normal ProvisioningSucceeded 8s blob.csi.azure.com_aks-nodepool1-34988195-vmss000002_8ecdf8ad-b636-4ca5-81ee-0f1a49337168 Successfully provisioned volume pvc-6db5af93-3b32-4c24-a68e-b727d7801fd5
```

## Restore the PVC into a Pod

```console
kubectl apply -f https://raw.githubusercontent.com/kubernetes-sigs/blob-csi-driver/master/deploy/example/cloning/nginx-pod-restored-cloning.yaml
```

### Check Sample Data

```console
$ kubectl exec nginx-blob-restored-cloning -- ls /mnt/blob
outfile
```
21 changes: 21 additions & 0 deletions deploy/example/cloning/nginx-pod-restored-cloning.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
---
kind: Pod
apiVersion: v1
metadata:
name: nginx-blob-restored-cloning
spec:
nodeSelector:
kubernetes.io/os: linux
containers:
- image: mcr.microsoft.com/oss/nginx/nginx:1.17.3-alpine
name: nginx-blob-restored-cloning
args:
- sleep
- "3600"
volumeMounts:
- name: blob-cloning
mountPath: "/mnt/blob"
volumes:
- name: blob-cloning
persistentVolumeClaim:
claimName: pvc-blob-cloning
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: pvc-blob-clone
name: pvc-blob-cloning
namespace: default
spec:
accessModes:
Expand Down
2 changes: 1 addition & 1 deletion hack/verify-yamllint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ if [[ "${deployDirNum}" != "${helmDirNum}" ]]; then
exit 1
fi

for path in "deploy/*.yaml" "deploy/example/*.yaml" "deploy/example/metrics/*.yaml"
for path in "deploy/*.yaml" "deploy/example/*.yaml" "deploy/example/metrics/*.yaml" "deploy/example/cloning/*.yaml"
do
echo "checking yamllint under path: $path ..."
yamllint -f parsable $path | grep -v "line too long" > $LOG
Expand Down