- Clone repo
$ mkdir -p $GOPATH/src/sigs.k8s.io
$ git clone https://github.com/kubernetes-sigs/blob-csi-driver $GOPATH/src/sigs.k8s.io/blob-csi-driver
- Build Blob Storage CSI driver
$ cd $GOPATH/src/sigs.k8s.io/blob-csi-driver
$ make blob
- Run verification before sending PR
$ make verify
- If there is config file changed under
charts
directory, run following command to update chart file.
helm package charts/latest/blob-csi-driver -d charts/latest/
- Build container image and push to dockerhub
export REGISTRY_NAME=<dockerhub-alias>
make push-latest
Install csc
tool according to https://github.com/rexray/gocsi/tree/master/csc:
$ mkdir -p $GOPATH/src/github.com
$ cd $GOPATH/src/github.com
$ git clone https://github.com/rexray/gocsi.git
$ cd rexray/gocsi/csc
$ make build
$ cd $GOPATH/src/sigs.k8s.io/blob-csi-driver
$ ./_output/blobplugin --endpoint tcp://127.0.0.1:10000 --nodeid CSINode -v=5 &
Before running CSI driver, create "/etc/kubernetes/azure.json" file under testing server(it's better copy
azure.json
file from a k8s cluster with service principle configured correctly) and setAZURE_CREDENTIAL_FILE
as following:
export set AZURE_CREDENTIAL_FILE=/etc/kubernetes/azure.json
$ csc identity plugin-info --endpoint tcp://127.0.0.1:10000
"blob.csi.azure.com" "v0.7.0"
$ csc controller new --endpoint tcp://127.0.0.1:10000 --cap 1,block CSIVolumeName --req-bytes 2147483648 --params skuname=Standard_LRS
"andy-mg1160alpha3#fuse4ef4b1d0c53d41bc88f#csivolumename" 2147483648 "skuname"="Standard_LRS"
mkdir /tmp/staging-target-path
csc node stage --endpoint tcp://127.0.0.1:10000 --cap 1,block --staging-target-path /tmp/staging-target-path "andy-mg1160alpha3#fuse4ef4b1d0c53d41bc88f#csivolumename"
mkdir /tmp/target-path
csc node publish --endpoint tcp://127.0.0.1:10000 --cap 1,block --staging-target-path /tmp/staging-target-path --target-path /tmp/target-path "andy-mg1160alpha3#fuse4ef4b1d0c53d41bc88f#csivolumename"
csc node unpublish --endpoint tcp://127.0.0.1:10000 --target-path /tmp/target-path "andy-mg1160alpha3#fuse4ef4b1d0c53d41bc88f#csivolumename"
csc node unstage --endpoint tcp://127.0.0.1:10000 --staging-target-path /tmp/staging-target-path "andy-mg1160alpha3#fuse4ef4b1d0c53d41bc88f#csivolumename"
$ csc controller del --endpoint tcp://127.0.0.1:10000 CSIVolumeID
CSIVolumeID
$ csc controller validate-volume-capabilities --endpoint tcp://127.0.0.1:10000 --cap 1,block CSIVolumeID
CSIVolumeID true
$ csc node get-info --endpoint tcp://127.0.0.1:10000
CSINode
$ csc controller create-snapshot
$ csc controller delete-snapshot
helm repo index charts --url=https://raw.githubusercontent.com/kubernetes-sigs/blobfuse-csi-driver/master/charts
- create
blob.Dockerfile
file
FROM us.gcr.io/k8s-artifacts-prod/build-image/debian-base-amd64:v2.1.0
RUN apt-get update && clean-install ca-certificates pkg-config libfuse-dev cmake libcurl4-gnutls-dev libgnutls28-dev uuid-dev libgcrypt20-dev wget
RUN wget -O /tmp/packages-microsoft-prod.deb https://packages.microsoft.com/config/ubuntu/16.04/packages-microsoft-prod.deb && dpkg -i /tmp/packages-microsoft-prod.deb && apt-get update && apt install blobfuse fuse -y && rm -f /tmp/packages-microsoft-prod.deb
RUN apt remove wget -y
# this is a workaround to install nfs-common & nfs-kernel-server and don't quit with error
RUN apt update && apt install nfs-common nfs-kernel-server -y || true
LABEL maintainers="andyzhangx"
LABEL description="Azure Blob Storage CSI driver"
- build image from
blob.Dockerfile
docker build --no-cache -t andyzhangx/blobnfs:v1 -f ./blob.Dockerfile .
docker run --network host -it andyzhangx/blobnfs:v1 sh