Skip to content

Latest commit

 

History

History
154 lines (118 loc) · 4.19 KB

development-and-testing.md

File metadata and controls

154 lines (118 loc) · 4.19 KB

Development and Testing

  1. Have quay.io account, running docker and kubernetes. You could use any registry account and replace quay.io with such registry name in below steps.
  2. Docker login to your quay.io account.
$ docker login --username <QUAY_USERNAME> https://quay.io
  1. Create csi-provisioner, livenessprobe and csi-node-driver-registrar repositories by pull/tag/push respective images to your quay.io account.
$ docker pull quay.io/minio/csi-provisioner:v3.4.0 && \
docker tag quay.io/minio/csi-provisioner:v3.4.0 quay.io/<QUAY_USERNAME>/csi-provisioner:v3.4.0 && \
docker push quay.io/<QUAY_USERNAME>/csi-provisioner:v3.4.0

$ docker pull quay.io/minio/livenessprobe:v2.9.0 && \
docker tag quay.io/minio/livenessprobe:v2.9.0 quay.io/<QUAY_USERNAME>/livenessprobe:v2.9.0 && \
docker push quay.io/<QUAY_USERNAME>/livenessprobe:v2.9.0

$ docker pull quay.io/minio/csi-node-driver-registrar:v2.6.3 && \
docker tag quay.io/minio/csi-node-driver-registrar:v2.6.3 quay.io/<QUAY_USERNAME>/csi-node-driver-registrar:v2.6.3 && \
docker push quay.io/<QUAY_USERNAME>/csi-node-driver-registrar:v2.6.3

$ docker pull quay.io/minio/csi-resizer:v1.7.0 && \
docker tag quay.io/minio/csi-resizer:v1.7.0 quay.io/<QUAY_USERNAME>/csi-resizer:v1.7.0 && \
docker push quay.io/<QUAY_USERNAME>/csi-resizer:v1.7.0
  1. Make sure csi-provisioner, livenessprobe, csi-node-driver-registrar and csi-resizer repositories are public in your quay.io account.
  2. Go to your DirectPV project root.
$ cd $GOPATH/src/github.com/minio/directpv
  1. Hack, hack, hack...
  2. Run ./build.sh
$ ./build.sh
  1. Run docker build to tag image.
$ docker build -t quay.io/<QUAY_USERNAME>/directpv:<NEW_BUILD_TAG> .
  1. Push newly created image to your quay.io account.
$ docker push quay.io/<QUAY_USERNAME>/directpv:<NEW_BUILD_TAG>
  1. Make sure directpv repository is public in your quay.io account.
  2. Install DirectPV.
$ ./kubectl-directpv --kubeconfig <PATH-TO-KUBECONFIG-FILE> install \
--image directpv:<NEW_BUILD_TAG> --org <QUAY_USERNAME> --registry quay.io
  1. Check running DirectPV
$ ./kubectl-directpv --kubeconfig <PATH-TO-KUBECONFIG-FILE> info

$ ./kubectl-directpv --kubeconfig <PATH-TO-KUBECONFIG-FILE> list drives

Testing with minikube

  1. Setup LVs

The following script will create 4 LVs backed up by 4 loopback devices

sudo truncate --size=1G /tmp/disk-{1..4}.img
for disk in /tmp/disk-{1..4}.img; do sudo losetup --find $disk; done
devices=( $(for disk in /tmp/disk-{1..4}.img; do sudo losetup --noheadings --output NAME --associated $disk; done) )
sudo pvcreate "${devices[@]}"
vgname="vg0"
sudo vgcreate "$vgname" "${devices[@]}"
for lvname in lv-{0..3}; do sudo lvcreate --name="$lvname" --size=800MiB "$vgname"; done
  1. Start minikube
minikube start --driver=none
  1. Install DirectPV

Install the freshly built version

./kubectl-directpv install --image directpv:<NEW_BUILD_TAG> --org <QUAY_USERNAME> --registry quay.io
  1. Discover and initialize the drives
./kubectl-directpv discover --output-file drives.yaml
./kubectl-directpv init drives.yaml
  1. Check if the drives are showing up
./kubectl-directpv list drives
  1. Apply the minio.yaml file

Download and apply a sample MinIO deployment file available here

kubectl apply -f minio.yaml
  1. Check if the pods are up and running
kubectl get pods
  1. Check the volumes
./kubectl-directpv list volumes
  1. Check the drives contain volumes
./kubectl-directpv list drives
  1. Uninstall the MinIO deployment
kubectl delete -f minio.yaml
  1. Delete the PVCs
kubectl delete pvc --all

After deleting the PVCs, check if the drives are freed up.

  1. Release freed drives
./kubectl-directpv remove --all
  1. Cleanup LV setup
sudo lvremove vg0 -y
sudo vgremove vg0 -y
sudo pvremove /dev/loop<n> /dev/loop<n> /dev/loop<n> /dev/loop<n> # n can be replaced with the loopbacks created
sudo losetup --detach-all

Please refer here for any trouble shooting guidelines.