minor doc updates, prep for 1.0

This commit is contained in:
Travis Glenn Hansen 2020-12-10 20:45:45 -07:00
parent 6ddf84d240
commit 01117a3247
10 changed files with 1562 additions and 13 deletions

View File

@ -32,7 +32,7 @@ const args = require("yargs")
})
.option("csi-version", {
describe: "versin of the csi spec to load",
choices: ["0.2.0", "0.3.0", "1.0.0", "1.1.0", "1.2.0"],
choices: ["0.2.0", "0.3.0", "1.0.0", "1.1.0", "1.2.0", "1.3.0"],
})
.demandOption(["csi-version"], "csi-version is required")
.option("csi-name", {
@ -78,7 +78,7 @@ const { logger } = require("../src/utils/logger");
if (args.logLevel) {
logger.level = args.logLevel;
}
const csiVersion = process.env.CSI_VERSION || "1.1.0";
const csiVersion = process.env.CSI_VERSION || "1.2.0";
const PROTO_PATH = __dirname + "/../csi_proto/csi-v" + csiVersion + ".proto";
// Suggested options for similarity to existing grpc.load behavior

1502
csi_proto/csi-v1.3.0.proto Normal file

File diff suppressed because it is too large Load Diff

View File

@ -49,6 +49,8 @@ zfs:
# standard volume naming overhead is 46 chars
# datasetParentName should therefore be 17 chars or less
datasetParentName: tank/k8s/b/vols
# do NOT make datasetParentName and detachedSnapshotsDatasetParentName overlap
# they may be siblings, but neither should be nested in the other
detachedSnapshotsDatasetParentName: tanks/k8s/b/snaps
# "" (inherit), lz4, gzip-9, etc
zvolCompression:

View File

@ -45,6 +45,8 @@ zfs:
# "org.freenas:test2": "some value"
datasetParentName: tank/k8s/a/vols
# do NOT make datasetParentName and detachedSnapshotsDatasetParentName overlap
# they may be siblings, but neither should be nested in the other
detachedSnapshotsDatasetParentName: tank/k8s/a/snaps
datasetEnableQuotas: true
datasetEnableReservation: false

View File

@ -49,6 +49,8 @@ zfs:
casesensitivity: mixed
datasetParentName: tank/k8s/a/vols
# do NOT make datasetParentName and detachedSnapshotsDatasetParentName overlap
# they may be siblings, but neither should be nested in the other
detachedSnapshotsDatasetParentName: tank/k8s/a/snaps
datasetEnableQuotas: true
datasetEnableReservation: false

View File

@ -32,6 +32,8 @@ zfs:
# "org.freenas:test2": "some value"
datasetParentName: tank/k8s/test
# do NOT make datasetParentName and detachedSnapshotsDatasetParentName overlap
# they may be siblings, but neither should be nested in the other
detachedSnapshotsDatasetParentName: tanks/k8s/test-snapshots
# "" (inherit), lz4, gzip-9, etc

View File

@ -32,6 +32,8 @@ zfs:
# "org.freenas:test2": "some value"
datasetParentName: tank/k8s/test
# do NOT make datasetParentName and detachedSnapshotsDatasetParentName overlap
# they may be siblings, but neither should be nested in the other
detachedSnapshotsDatasetParentName: tanks/k8s/test-snapshots
datasetEnableQuotas: true

View File

@ -1,6 +1,6 @@
{
"name": "democratic-csi",
"version": "0.1.0",
"version": "1.0.0",
"description": "kubernetes csi driver framework",
"main": "bin/democratic-csi",
"scripts": {

View File

@ -257,6 +257,37 @@ class ControllerZfsSshBaseDriver extends CsiBaseDriver {
return { valid, message };
}
/**
* Ensure sane options are used etc
* true = ready
* false = not ready, but progressiong towards ready
* throw error = faulty setup
*
* @param {*} call
*/
async Probe(call) {
const driver = this;
if (driver.ctx.args.csiMode.includes("controller")) {
let datasetParentName = this.getVolumeParentDatasetName() + "/";
let snapshotParentDatasetName =
this.getDetachedSnapshotParentDatasetName() + "/";
if (
datasetParentName.startsWith(snapshotParentDatasetName) ||
snapshotParentDatasetName.startsWith(datasetParentName)
) {
throw new GrpcError(
grpc.status.FAILED_PRECONDITION,
`datasetParentName and detachedSnapshotsDatasetParentName must not overlap`
);
}
return { ready: { value: true } };
} else {
return { ready: { value: true } };
}
}
/**
* Create a volume doing in essence the following:
* 1. create dataset

View File

@ -15,6 +15,9 @@ const FREENAS_ISCSI_TARGETTOEXTENT_ID_PROPERTY_NAME =
"democratic-csi:freenas_iscsi_targettoextent_id";
const FREENAS_ISCSI_ASSETS_NAME_PROPERTY_NAME =
"democratic-csi:freenas_iscsi_assets_name";
// used for in-memory cache of the version info
const FREENAS_SYSTEM_VERSION_CACHE_KEY = "freenas:system_version";
class FreeNASDriver extends ControllerZfsSshBaseDriver {
/**
* cannot make this a storage class parameter as storage class/etc context is *not* sent
@ -1513,7 +1516,7 @@ class FreeNASDriver extends ControllerZfsSshBaseDriver {
if (![200, 204].includes(response.statusCode)) {
throw new GrpcError(
grpc.status.UNKNOWN,
`received error deleting iscsi target - extent: ${targetId} code: ${
`received error deleting iscsi target - target: ${targetId} code: ${
response.statusCode
} body: ${JSON.stringify(response.body)}`
);
@ -1756,19 +1759,22 @@ class FreeNASDriver extends ControllerZfsSshBaseDriver {
async setVersionInfoCache(versionInfo) {
const driver = this;
this.cache = this.cache || {};
this.cache.versionInfo = versionInfo;
// crude timeout
setTimeout(function () {
driver.cache.versionInfo = null;
}, 60 * 1000);
await driver.ctx.cache.set(
FREENAS_SYSTEM_VERSION_CACHE_KEY,
versionInfo,
60 * 1000
);
}
async getSystemVersion() {
this.cache = this.cache || {};
if (this.cache.versionInfo) {
return this.cache.versionInfo;
const driver = this;
let cacheData = await driver.ctx.cache.get(
FREENAS_SYSTEM_VERSION_CACHE_KEY
);
if (cacheData) {
return cacheData;
}
const httpClient = await this.getHttpClient(false);