From 6345c53a4e0e265cfc2adf3c5e4725ac02ed3937 Mon Sep 17 00:00:00 2001 From: Travis Glenn Hansen Date: Tue, 22 Feb 2022 21:51:16 -0700 Subject: [PATCH] minor fixes for local-hostpath, documentation Signed-off-by: Travis Glenn Hansen --- CHANGELOG.md | 12 ++++++++++- README.md | 10 +++++++-- examples/local-hostpath.yaml | 10 +++++++++ src/driver/controller-client-common/index.js | 21 ++++++++++++------- src/driver/controller-local-hostpath/index.js | 12 +++++++++++ src/driver/node-manual/index.js | 3 +++ 6 files changed, 58 insertions(+), 10 deletions(-) create mode 100644 examples/local-hostpath.yaml diff --git a/CHANGELOG.md b/CHANGELOG.md index 4ba95a9..85ffdb6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,16 @@ +# v1.5.0 + +Released 2022-02- + +- massive ci overhaul +- introduce `zfs-local-dataset` driver +- introduce `zfs-local-zvol` driver +- introduce `local-hostpath` driver +- support manually provisioned `oneclient` volumes + # v1.4.4 -Release 2021-12-11 +Released 2021-12-11 - better adherence to expected csi behavior when volume request for less than minimum volume size is requested (see #137) diff --git a/README.md b/README.md index 4f80f29..4c2c528 100644 --- a/README.md +++ b/README.md @@ -33,8 +33,9 @@ have access to resizing, snapshots, clones, etc functionality. for all volumes) - `smb-client` (crudely provisions storage using a shared smb share/directory for all volumes) - - `node-manual` (allows connecting to manually created smb, nfs, lustre, and - iscsi volumes, see sample PVs in the `examples` directory) + - `local-hostpath` (crudely provisions node-local directories) + - `node-manual` (allows connecting to manually created smb, nfs, lustre, + oneclient, and iscsi volumes, see sample PVs in the `examples` directory) - framework for developing `csi` drivers If you have any interest in providing a `csi` driver, simply open an issue to @@ -159,6 +160,11 @@ provision `MULTI_NODE` / `RWX` volumes, any workloads using the volume will always land a single node and that node will always be the node where the volume is/was provisioned. +### local-hostpath + +This `driver` provisions node-local storage. Each node should and an +identically name folder where volumes will be created. + ## Server Prep Server preparation depends slightly on which `driver` you are using. diff --git a/examples/local-hostpath.yaml b/examples/local-hostpath.yaml new file mode 100644 index 0000000..7470f95 --- /dev/null +++ b/examples/local-hostpath.yaml @@ -0,0 +1,10 @@ +driver: local-hostpath +instance_id: +local-hostpath: + # generally shareBasePath and controllerBasePath should be the same for this + # driver, this path should be mounted into the csi-driver container + shareBasePath: "/var/lib/csi-local-hostpath" + controllerBasePath: "/var/lib/csi-local-hostpath" + dirPermissionsMode: "0777" + dirPermissionsUser: root + dirPermissionsGroup: root diff --git a/src/driver/controller-client-common/index.js b/src/driver/controller-client-common/index.js index 1849dc2..955fffb 100644 --- a/src/driver/controller-client-common/index.js +++ b/src/driver/controller-client-common/index.js @@ -1,3 +1,4 @@ +const _ = require("lodash"); const { CsiBaseDriver } = require("../index"); const { GrpcError, grpc } = require("../../utils/grpc"); const cp = require("child_process"); @@ -570,15 +571,21 @@ class ControllerClientCommonDriver extends CsiBaseDriver { * @param {*} call */ async GetCapacity(call) { - // really capacity is not used at all with nfs in this fashion, so no reason to enable - // here even though it is technically feasible. - throw new GrpcError( - grpc.status.UNIMPLEMENTED, - `operation not supported by driver` - ); - const driver = this; + if ( + !driver.options.service.controller.capabilities.rpc.includes( + "GET_CAPACITY" + ) + ) { + // really capacity is not used at all with nfs in this fashion, so no reason to enable + // here even though it is technically feasible. + throw new GrpcError( + grpc.status.UNIMPLEMENTED, + `operation not supported by driver` + ); + } + if (call.request.volume_capabilities) { const result = this.assertCapabilities(call.request.volume_capabilities); diff --git a/src/driver/controller-local-hostpath/index.js b/src/driver/controller-local-hostpath/index.js index ee7c6d3..9c22d02 100644 --- a/src/driver/controller-local-hostpath/index.js +++ b/src/driver/controller-local-hostpath/index.js @@ -15,6 +15,8 @@ class ControllerLocalHostpathDriver extends ControllerClientCommonDriver { "service.identity.capabilities.service", false ); + + const c_caps = _.get(options, "service.controller.capabilities", false); super(...arguments); if (!i_caps) { @@ -26,6 +28,16 @@ class ControllerLocalHostpathDriver extends ControllerClientCommonDriver { "VOLUME_ACCESSIBILITY_CONSTRAINTS", ]; } + + if (!c_caps) { + this.ctx.logger.debug("setting local-hostpath controller service caps"); + + if ( + !options.service.controller.capabilities.rpc.includes("GET_CAPACITY") + ) { + options.service.controller.capabilities.rpc.push("GET_CAPACITY"); + } + } } getConfigKey() { diff --git a/src/driver/node-manual/index.js b/src/driver/node-manual/index.js index bbe4640..ab5ea25 100644 --- a/src/driver/node-manual/index.js +++ b/src/driver/node-manual/index.js @@ -125,6 +125,9 @@ class NodeManualDriver extends CsiBaseDriver { driverResourceType = "filesystem"; fs_types = ["oneclient", "fuse.oneclient"]; break; + case "hostpath": + driverResourceType = "filesystem"; + break; case "iscsi": driverResourceType = "volume"; fs_types = ["ext3", "ext4", "ext4dev", "xfs"];