Merge pull request #155 from democratic-csi/next
ci flakes, delegated zfs setups
This commit is contained in:
commit
1de7625dd8
|
|
@ -1,3 +1,11 @@
|
||||||
|
# v1.5.1
|
||||||
|
|
||||||
|
Released 2022-02-23
|
||||||
|
|
||||||
|
- fix ci flakes
|
||||||
|
- better support running `zfs` commands as non-root with `delegated`
|
||||||
|
permissions
|
||||||
|
|
||||||
# v1.5.0
|
# v1.5.0
|
||||||
|
|
||||||
Released 2022-02-23
|
Released 2022-02-23
|
||||||
|
|
|
||||||
|
|
@ -162,7 +162,7 @@ volume is/was provisioned.
|
||||||
|
|
||||||
### local-hostpath
|
### local-hostpath
|
||||||
|
|
||||||
This `driver` provisions node-local storage. Each node should and an
|
This `driver` provisions node-local storage. Each node should have an
|
||||||
identically name folder where volumes will be created.
|
identically name folder where volumes will be created.
|
||||||
|
|
||||||
## Server Prep
|
## Server Prep
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "democratic-csi",
|
"name": "democratic-csi",
|
||||||
"version": "1.5.0",
|
"version": "1.5.1",
|
||||||
"description": "kubernetes csi driver framework",
|
"description": "kubernetes csi driver framework",
|
||||||
"main": "bin/democratic-csi",
|
"main": "bin/democratic-csi",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
|
|
||||||
|
|
@ -320,6 +320,10 @@ class ControllerClientCommonDriver extends CsiBaseDriver {
|
||||||
return response.stdout.split("\n")[1].trim();
|
return response.stdout.split("\n")[1].trim();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async createDir(path) {
|
||||||
|
await this.exec("mkdir", ["-p", path]);
|
||||||
|
}
|
||||||
|
|
||||||
async deleteDir(path) {
|
async deleteDir(path) {
|
||||||
await this.exec("rm", ["-rf", path]);
|
await this.exec("rm", ["-rf", path]);
|
||||||
|
|
||||||
|
|
@ -600,6 +604,10 @@ class ControllerClientCommonDriver extends CsiBaseDriver {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!(await driver.directoryExists(driver.getControllerBasePath()))) {
|
||||||
|
await driver.createDir(driver.getControllerBasePath());
|
||||||
|
}
|
||||||
|
|
||||||
const available_capacity = await driver.getAvailableSpaceAtPath(
|
const available_capacity = await driver.getAvailableSpaceAtPath(
|
||||||
driver.getControllerBasePath()
|
driver.getControllerBasePath()
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,4 @@
|
||||||
|
const _ = require("lodash");
|
||||||
const { ControllerZfsBaseDriver } = require("../controller-zfs");
|
const { ControllerZfsBaseDriver } = require("../controller-zfs");
|
||||||
const { GrpcError, grpc } = require("../../utils/grpc");
|
const { GrpcError, grpc } = require("../../utils/grpc");
|
||||||
const SshClient = require("../../utils/ssh").SshClient;
|
const SshClient = require("../../utils/ssh").SshClient;
|
||||||
|
|
@ -30,13 +31,7 @@ class ControllerZfsGenericDriver extends ControllerZfsBaseDriver {
|
||||||
options.paths = this.options.zfs.cli.paths;
|
options.paths = this.options.zfs.cli.paths;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (
|
options.sudo = _.get(this.options, "zfs.cli.sudoEnabled", false);
|
||||||
this.options.zfs.hasOwnProperty("cli") &&
|
|
||||||
this.options.zfs.cli &&
|
|
||||||
this.options.zfs.cli.hasOwnProperty("sudoEnabled")
|
|
||||||
) {
|
|
||||||
options.sudo = this.getSudoEnabled();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (typeof this.setZetabyteCustomOptions === "function") {
|
if (typeof this.setZetabyteCustomOptions === "function") {
|
||||||
await this.setZetabyteCustomOptions(options);
|
await this.setZetabyteCustomOptions(options);
|
||||||
|
|
@ -367,7 +362,7 @@ delete ${iscsiName}
|
||||||
taregetCliCommand.push("|");
|
taregetCliCommand.push("|");
|
||||||
taregetCliCommand.push("targetcli");
|
taregetCliCommand.push("targetcli");
|
||||||
|
|
||||||
if (this.options.iscsi.shareStrategyTargetCli.sudoEnabled) {
|
if (_.get(this.options, "iscsi.shareStrategyTargetCli.sudoEnabled", false)) {
|
||||||
command = "sudo";
|
command = "sudo";
|
||||||
args.unshift("sh");
|
args.unshift("sh");
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -59,13 +59,7 @@ class ControllerZfsLocalDriver extends ControllerZfsBaseDriver {
|
||||||
chroot: "chroot",
|
chroot: "chroot",
|
||||||
};
|
};
|
||||||
|
|
||||||
if (
|
options.sudo = _.get(this.options, "zfs.cli.sudoEnabled", false);
|
||||||
this.options.zfs.hasOwnProperty("cli") &&
|
|
||||||
this.options.zfs.cli &&
|
|
||||||
this.options.zfs.cli.hasOwnProperty("sudoEnabled")
|
|
||||||
) {
|
|
||||||
options.sudo = this.getSudoEnabled();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (typeof this.setZetabyteCustomOptions === "function") {
|
if (typeof this.setZetabyteCustomOptions === "function") {
|
||||||
await this.setZetabyteCustomOptions(options);
|
await this.setZetabyteCustomOptions(options);
|
||||||
|
|
@ -105,7 +99,7 @@ class ControllerZfsLocalDriver extends ControllerZfsBaseDriver {
|
||||||
* default want to provision volumes of RWX. The topology contraints
|
* default want to provision volumes of RWX. The topology contraints
|
||||||
* implicity will enforce only a single node can use the volume at a given
|
* implicity will enforce only a single node can use the volume at a given
|
||||||
* time.
|
* time.
|
||||||
*
|
*
|
||||||
* @returns Array
|
* @returns Array
|
||||||
*/
|
*/
|
||||||
getAccessModes() {
|
getAccessModes() {
|
||||||
|
|
|
||||||
|
|
@ -149,8 +149,17 @@ class ControllerZfsBaseDriver extends CsiBaseDriver {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
getSudoEnabled() {
|
async getWhoAmI() {
|
||||||
return this.options.zfs.cli && this.options.zfs.cli.sudoEnabled === true;
|
const driver = this;
|
||||||
|
const execClient = driver.getExecClient();
|
||||||
|
const command = "whoami";
|
||||||
|
driver.ctx.logger.verbose("whoami command: %s", command);
|
||||||
|
const response = await execClient.exec(command);
|
||||||
|
if (response.code !== 0) {
|
||||||
|
throw new Error("failed to run uname to determine max zvol name length");
|
||||||
|
} else {
|
||||||
|
return response.stdout.trim();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async getSudoPath() {
|
async getSudoPath() {
|
||||||
|
|
@ -321,6 +330,13 @@ class ControllerZfsBaseDriver extends CsiBaseDriver {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (
|
||||||
|
!zb.helpers.isPropertyValueSet(row[SHARE_VOLUME_CONTEXT_PROPERTY_NAME])
|
||||||
|
) {
|
||||||
|
driver.ctx.logger.warn(`${row.name} is missing share context`);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
let volume_content_source;
|
let volume_content_source;
|
||||||
let volume_context = JSON.parse(row[SHARE_VOLUME_CONTEXT_PROPERTY_NAME]);
|
let volume_context = JSON.parse(row[SHARE_VOLUME_CONTEXT_PROPERTY_NAME]);
|
||||||
if (
|
if (
|
||||||
|
|
@ -1019,7 +1035,7 @@ class ControllerZfsBaseDriver extends CsiBaseDriver {
|
||||||
this.options.zfs.datasetPermissionsMode,
|
this.options.zfs.datasetPermissionsMode,
|
||||||
properties.mountpoint.value,
|
properties.mountpoint.value,
|
||||||
]);
|
]);
|
||||||
if (this.getSudoEnabled()) {
|
if ((await this.getWhoAmI()) != "root") {
|
||||||
command = (await this.getSudoPath()) + " " + command;
|
command = (await this.getSudoPath()) + " " + command;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1050,7 +1066,7 @@ class ControllerZfsBaseDriver extends CsiBaseDriver {
|
||||||
: ""),
|
: ""),
|
||||||
properties.mountpoint.value,
|
properties.mountpoint.value,
|
||||||
]);
|
]);
|
||||||
if (this.getSudoEnabled()) {
|
if ((await this.getWhoAmI()) != "root") {
|
||||||
command = (await this.getSudoPath()) + " " + command;
|
command = (await this.getSudoPath()) + " " + command;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1073,7 +1089,7 @@ class ControllerZfsBaseDriver extends CsiBaseDriver {
|
||||||
acl,
|
acl,
|
||||||
properties.mountpoint.value,
|
properties.mountpoint.value,
|
||||||
]);
|
]);
|
||||||
if (this.getSudoEnabled()) {
|
if ((await this.getWhoAmI()) != "root") {
|
||||||
command = (await this.getSudoPath()) + " " + command;
|
command = (await this.getSudoPath()) + " " + command;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1641,12 +1657,13 @@ class ControllerZfsBaseDriver extends CsiBaseDriver {
|
||||||
}
|
}
|
||||||
|
|
||||||
let volume = await driver.populateCsiVolumeFromData(row);
|
let volume = await driver.populateCsiVolumeFromData(row);
|
||||||
let status = await driver.getVolumeStatus(datasetName);
|
if (volume) {
|
||||||
|
let status = await driver.getVolumeStatus(datasetName);
|
||||||
entries.push({
|
entries.push({
|
||||||
volume,
|
volume,
|
||||||
status,
|
status,
|
||||||
});
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (max_entries && entries.length > max_entries) {
|
if (max_entries && entries.length > max_entries) {
|
||||||
|
|
|
||||||
|
|
@ -1521,7 +1521,7 @@ class FreeNASApiDriver extends CsiBaseDriver {
|
||||||
|
|
||||||
if (deleteAsset) {
|
if (deleteAsset) {
|
||||||
response = await httpClient.delete(endpoint);
|
response = await httpClient.delete(endpoint);
|
||||||
if (![200, 204].includes(response.statusCode)) {
|
if (![200, 204, 404].includes(response.statusCode)) {
|
||||||
throw new GrpcError(
|
throw new GrpcError(
|
||||||
grpc.status.UNKNOWN,
|
grpc.status.UNKNOWN,
|
||||||
`received error deleting iscsi target - target: ${targetId} code: ${
|
`received error deleting iscsi target - target: ${targetId} code: ${
|
||||||
|
|
@ -1583,7 +1583,7 @@ class FreeNASApiDriver extends CsiBaseDriver {
|
||||||
|
|
||||||
if (deleteAsset) {
|
if (deleteAsset) {
|
||||||
response = await httpClient.delete(endpoint);
|
response = await httpClient.delete(endpoint);
|
||||||
if (![200, 204].includes(response.statusCode)) {
|
if (![200, 204, 404].includes(response.statusCode)) {
|
||||||
throw new GrpcError(
|
throw new GrpcError(
|
||||||
grpc.status.UNKNOWN,
|
grpc.status.UNKNOWN,
|
||||||
`received error deleting iscsi extent - extent: ${extentId} code: ${
|
`received error deleting iscsi extent - extent: ${extentId} code: ${
|
||||||
|
|
@ -1657,7 +1657,7 @@ class FreeNASApiDriver extends CsiBaseDriver {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (reload) {
|
if (reload) {
|
||||||
if (this.getSudoEnabled()) {
|
if ((await this.getWhoAmI()) != "root") {
|
||||||
command = (await this.getSudoPath()) + " " + command;
|
command = (await this.getSudoPath()) + " " + command;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1726,6 +1726,13 @@ class FreeNASApiDriver extends CsiBaseDriver {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (
|
||||||
|
!zb.helpers.isPropertyValueSet(row[SHARE_VOLUME_CONTEXT_PROPERTY_NAME])
|
||||||
|
) {
|
||||||
|
driver.ctx.logger.warn(`${row.name} is missing share context`);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
let volume_content_source;
|
let volume_content_source;
|
||||||
let volume_context = JSON.parse(row[SHARE_VOLUME_CONTEXT_PROPERTY_NAME]);
|
let volume_context = JSON.parse(row[SHARE_VOLUME_CONTEXT_PROPERTY_NAME]);
|
||||||
if (
|
if (
|
||||||
|
|
@ -3208,12 +3215,13 @@ class FreeNASApiDriver extends CsiBaseDriver {
|
||||||
);
|
);
|
||||||
|
|
||||||
let volume = await driver.populateCsiVolumeFromData(row);
|
let volume = await driver.populateCsiVolumeFromData(row);
|
||||||
let status = await driver.getVolumeStatus(volume_id);
|
if (volume) {
|
||||||
|
let status = await driver.getVolumeStatus(volume_id);
|
||||||
entries.push({
|
entries.push({
|
||||||
volume,
|
volume,
|
||||||
status,
|
status,
|
||||||
});
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (max_entries && entries.length > max_entries) {
|
if (max_entries && entries.length > max_entries) {
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,4 @@
|
||||||
|
const _ = require("lodash");
|
||||||
const { ControllerZfsBaseDriver } = require("../controller-zfs");
|
const { ControllerZfsBaseDriver } = require("../controller-zfs");
|
||||||
const { GrpcError, grpc } = require("../../utils/grpc");
|
const { GrpcError, grpc } = require("../../utils/grpc");
|
||||||
const SshClient = require("../../utils/ssh").SshClient;
|
const SshClient = require("../../utils/ssh").SshClient;
|
||||||
|
|
@ -42,13 +43,7 @@ class FreeNASSshDriver extends ControllerZfsBaseDriver {
|
||||||
options.paths = this.options.zfs.cli.paths;
|
options.paths = this.options.zfs.cli.paths;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (
|
options.sudo = _.get(this.options, "zfs.cli.sudoEnabled", false);
|
||||||
this.options.zfs.hasOwnProperty("cli") &&
|
|
||||||
this.options.zfs.cli &&
|
|
||||||
this.options.zfs.cli.hasOwnProperty("sudoEnabled")
|
|
||||||
) {
|
|
||||||
options.sudo = this.getSudoEnabled();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (typeof this.setZetabyteCustomOptions === "function") {
|
if (typeof this.setZetabyteCustomOptions === "function") {
|
||||||
await this.setZetabyteCustomOptions(options);
|
await this.setZetabyteCustomOptions(options);
|
||||||
|
|
@ -1706,7 +1701,7 @@ class FreeNASSshDriver extends ControllerZfsBaseDriver {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (reload) {
|
if (reload) {
|
||||||
if (this.getSudoEnabled()) {
|
if ((await this.getWhoAmI()) != "root") {
|
||||||
command = (await this.getSudoPath()) + " " + command;
|
command = (await this.getSudoPath()) + " " + command;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue