ensure SCALE for freenas-api-* Probes, better sudo usage, prep v1.7.0

Signed-off-by: Travis Glenn Hansen <travisghansen@yahoo.com>
This commit is contained in:
Travis Glenn Hansen 2022-06-05 20:45:05 -06:00
parent 7041b7fe45
commit bd08538a87
6 changed files with 326 additions and 234 deletions

View File

@ -129,8 +129,8 @@ jobs:
- self-hosted
- Linux
- X64
#- csi-sanity-truenas
- csi-sanity-zfs-generic
- csi-sanity-truenas
#- csi-sanity-zfs-generic
steps:
- uses: actions/checkout@v2
- uses: actions/download-artifact@v2
@ -163,8 +163,8 @@ jobs:
- self-hosted
- Linux
- X64
#- csi-sanity-truenas
- csi-sanity-zfs-generic
- csi-sanity-truenas
#- csi-sanity-zfs-generic
steps:
- uses: actions/checkout@v2
- uses: actions/download-artifact@v2
@ -196,8 +196,8 @@ jobs:
- self-hosted
- Linux
- X64
#- csi-sanity-truenas
- csi-sanity-zfs-generic
- csi-sanity-truenas
#- csi-sanity-zfs-generic
steps:
- uses: actions/checkout@v2
- uses: actions/download-artifact@v2

View File

@ -1,3 +1,30 @@
# v1.7.0
Released 2022-06-05
The windows release.
- windows smb, iscsi, and local-hostpath support
- ntfs, exfat, vfat fs support
- zfs-generic-smb driver
- synology improvements
- DSM7 support
- synology enhancements to allow templates to be configured at various
'levels'
- testing improvements
- support (for testing) generating volume_id from name
- test all the smb variants
- test all nfs/smb client drivers
- misc fixes
- wait for chown/chmod jobs to complete (freenas)
- general improvement to smb behavior throughout
- better logging
- better sudo logic throughout
- more robust logic for connecting to iscsi devices with partition tables
- massive performance improvement for ssh-based drivers (reusing existing
connection instead of new connection per-command)
- dep bumps
# v1.6.3
Released 2022-04-08

View File

@ -64,6 +64,16 @@ Predominantly 3 things are needed:
You should install/configure the requirements for both nfs and iscsi.
### cifs
```
RHEL / CentOS
sudo yum install -y cifs-utils
Ubuntu / Debian
sudo apt-get install -y cifs-utils
```
### nfs
```
@ -176,6 +186,35 @@ volume is/was provisioned.
The nature of this `driver` also prevents the enforcement of quotas. In short
the requested volume size is generally ignored.
### windows
Support for Windows was introduced in `v1.7.0`. Currently support is limited
to kubernetes nodes capabale of running `HostProcess` containers. Support was
tested against `Windows Server 2019` using `rke2-v1.24`. Currently any of the
`-smb` and `-iscsi` drivers will work. Support for `ntfs` was added to the
linux nodes as well (using the `ntfs3` driver) so volumes created can be
utilized by nodes with either operating system (in the case of `cifs` by both
simultaneously).
Due to current limits in the kubernetes tooling it is not possible to use the
`local-hostpath` driver but support is implemented in this project and will
work as soon as kubernetes support is available.
```
# ensure all updates are installed
# enable the container feature
Enable-WindowsOptionalFeature -Online -FeatureName Containers All
# create symbolic link due to current limitations in the driver-registrar container
New-Item -ItemType SymbolicLink -Path "C:\registration\" -Target "C:\var\lib\kubelet\plugins_registry\"
# install a HostProcess compatible kubernetes
```
- https://kubernetes.io/blog/2021/08/16/windows-hostprocess-containers/
- https://kubernetes.io/docs/tasks/configure-pod-container/create-hostprocess-pod/
## Server Prep
Server preparation depends slightly on which `driver` you are using.
@ -201,6 +240,7 @@ Ensure the following services are configurged and running:
- ensure `zsh`, `bash`, or `sh` is set as the root shell, `csh` gives false errors due to quoting
- nfs
- iscsi
- (fixed in 12.0-U2+) when using the FreeNAS API concurrently the
`/etc/ctl.conf` file on the server can become invalid, some sample scripts
are provided in the `contrib` directory to clean things up ie: copy the
@ -216,7 +256,7 @@ Ensure the following services are configurged and running:
- `curl --header "Accept: application/json" --user root:<password> 'http(s)://<ip>/api/v2.0/iscsi/initiator'`
- `curl --header "Accept: application/json" --user root:<password> 'http(s)://<ip>/api/v2.0/iscsi/auth'`
- The maximum number of volumes is limited to 255 by default on FreeBSD (physical devices such as disks and CD-ROM drives count against this value).
Be sure to properly adjust both [tunables](https://www.freebsd.org/cgi/man.cgi?query=ctl&sektion=4#end) `kern.cam.ctl.max_ports` and `kern.cam.ctl.max_luns` to avoid running out of resources when dynamically provisioning iSCSI volumes on FreeNAS or TrueNAS Core.
Be sure to properly adjust both [tunables](https://www.freebsd.org/cgi/man.cgi?query=ctl&sektion=4#end) `kern.cam.ctl.max_ports` and `kern.cam.ctl.max_luns` to avoid running out of resources when dynamically provisioning iSCSI volumes on FreeNAS or TrueNAS Core.
- smb

444
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -2107,6 +2107,7 @@ class FreeNASApiDriver extends CsiBaseDriver {
*/
async Probe(call) {
const driver = this;
const httpApiClient = await driver.getTrueNASHttpApiClient();
if (driver.ctx.args.csiMode.includes("controller")) {
let datasetParentName = this.getVolumeParentDatasetName() + "/";
@ -2121,6 +2122,14 @@ class FreeNASApiDriver extends CsiBaseDriver {
`datasetParentName and detachedSnapshotsDatasetParentName must not overlap`
);
}
if (!(await httpApiClient.getIsScale())) {
throw new GrpcError(
grpc.status.FAILED_PRECONDITION,
`driver is only availalbe with TrueNAS SCALE`
);
}
return { ready: { value: true } };
} else {
return { ready: { value: true } };

View File

@ -1147,14 +1147,23 @@ class Zetabyte {
if (arguments.length < 4) throw Error("Invalid arguments");
return new Promise((resolve, reject) => {
// specially handle sudo here to avoid the need for using sudo on the whole script
// but rather limit sudo access to only the zfs command
let use_sudo = zb.options.sudo;
let args = ["-c"];
let command = [];
if (use_sudo) {
command = command.concat(zb.options.paths.sudo);
}
command = command.concat(["zfs", "send"]);
command = command.concat(send_options);
command.push(source);
command.push("|");
if (use_sudo) {
command = command.concat(zb.options.paths.sudo);
}
command = command.concat(["zfs", "receive"]);
command = command.concat(receive_options);
command.push(target);
@ -1164,7 +1173,7 @@ class Zetabyte {
zb.exec(
"/bin/sh",
args,
{ timeout: zb.options.timeout },
{ timeout: zb.options.timeout, sudo: false },
function (error, stdout, stderr) {
if (error) return reject(zb.helpers.zfsError(error, stderr));
return resolve(stdout);
@ -1550,7 +1559,12 @@ class Zetabyte {
command = zb.options.paths.chroot;
}
if (zb.options.sudo) {
let use_sudo = zb.options.sudo;
if (options && options.hasOwnProperty("sudo")) {
use_sudo = options.sudo;
}
if (use_sudo) {
args = args || [];
args.unshift(command);
command = zb.options.paths.sudo;
@ -1558,11 +1572,13 @@ class Zetabyte {
if (zb.options.log_commands) {
if (typeof zb.options.logger.verbose != "function") {
zb.options.logger.verbose = function() {
zb.options.logger.verbose = function () {
console.debug(...arguments);
}
};
}
zb.options.logger.verbose(`executing zfs command: ${command} ${args.join(" ")}`);
zb.options.logger.verbose(
`executing zfs command: ${command} ${args.join(" ")}`
);
}
const child = zb.options.executor.spawn(command, args, options);