Signed-off-by: Erik Hollensbe <email@example.com>
|2 months ago|
|ansible||2 months ago|
|api/v1alpha1||2 months ago|
|cmd/k8zfs||2 months ago|
|config||2 months ago|
|hack||2 months ago|
|pkg||2 months ago|
|.gitignore||2 months ago|
|.gitmodules||2 months ago|
|Dockerfile||2 months ago|
|LICENSE.md||2 months ago|
|Makefile||2 months ago|
|Makefile.custom||2 months ago|
|PROJECT||2 months ago|
|README.md||2 months ago|
|Vagrantfile||2 months ago|
|go.mod||2 months ago|
|go.sum||2 months ago|
some experiments I am performing around making a CSI driver + operator on k8s.
You’ll probably want to do this in a VM; you are playing directly with the kernel. Also, most tests/operations run as root as a result, and have destructive potential. For development, I am using Ubuntu 20.04.
Install golang; any version after 1.14 should work.
apt install -y libzfslinux-dev zfsutils-linux
NOTE: if you are reading this, the driver only works in a single node configuration right now.
To install the driver from source:
IMG=image/tag make docker-build docker-push. It will require your sudo password to run the tests, after which it will build the image and push it to a registry.
IMGabove, edit config/csi/bases/k8zfs-plugin.yaml to reflect it (yes, kustomization support is on the way for this).
KUBECONFIG=~/.kube/myconfig make installwill install the CRDs, RBAC rules and stateful sets required to run the driver. To uninstall, simply
make uninstallwith the same
Only tests really work right now. Note, this will mess with any live ZFS
installation on the host. It impacts the pool
testpool by default by removing
and re-creating it a number of times, as well as datasets beneath it. To run
Note that you may run into go.mod issues; be sure to
go clean -modcache as
root and your user account if you’re running into resolution issues.
As noted in the examples, most makefile commands come from the
Makefile.custom file; specify
make to invoke tasks in it.
The tests create several files in
/tmp that it uses as zfs zpools. The
datasets are created on top of the zpools. The default pool name is
and if your tests break, you can correct them by destroying this pool with this
sudo -E make -f Makefile.custom testclean
If you’d like to mount a ZFS zpool for playing around with:
sudo -E make -f Makefile.custom dummy
If you’d like to create a testbed running the daemon along with the zpool already setup:
make -f Makefile.custom testbed # no root here, sudo will be called make -f Makefile.custom clean-testbed # clean up
If you’d like to install the latest csi-sanity suite:
make -f Makefile.custom install-csi-sanity make -f Makefile.custom csi-sanity # to run it
If you’d like to adjust parameters of the test suite, such as which pool it affects, adjust these environment variables:
ZFS_TESTPOOL: used in makefiles and tests to provide the pool to affect.
ZFS_TESTPOOLSIZE: Size (bytes) of the test pool. The pools are created from sparse images and should not affect your filesystem, but default to 5GiB which may be a problem on smaller systems. This setting does not affect the Makefile.
DEBUG: When set, this does not perform any storage cleanup. You will want to manually invoke one test at a time (with
go test -run) with this option enabled, then trigger
make testcleanto fix your system before running tests again.
CSI_SANITY_DEBUG: When set, this does not clean up the test pool after the CSI sanity run.
LOGRUS_DEBUG: when set non-empty, it will trigger logrus request logging.
ITERATIONS: set to a number, this configures the number of iterations for certain battery tests