Compare commits
	
		
			No commits in common. "master" and "v1.9.3" have entirely different histories.
		
	
	
		|  | @ -1,9 +1,3 @@ | ||||||
| # v1.9.4 |  | ||||||
| 
 |  | ||||||
| Release 2024-07-06 |  | ||||||
| 
 |  | ||||||
| - minor doc updates |  | ||||||
| 
 |  | ||||||
| # v1.9.3 | # v1.9.3 | ||||||
| 
 | 
 | ||||||
| Released 2024-06-01 | Released 2024-06-01 | ||||||
|  |  | ||||||
|  | @ -30,7 +30,7 @@ have access to resizing, snapshots, clones, etc functionality. | ||||||
|   - `zfs-local-dataset` (provision node-local volume as dataset) |   - `zfs-local-dataset` (provision node-local volume as dataset) | ||||||
|   - `zfs-local-zvol` (provision node-local volume as zvol) |   - `zfs-local-zvol` (provision node-local volume as zvol) | ||||||
|   - `synology-iscsi` experimental (manages volumes to share over iscsi) |   - `synology-iscsi` experimental (manages volumes to share over iscsi) | ||||||
|   - `objectivefs` (manages objectivefs volumes) |   - `objectivefs` experimental (manages objectivefs volumes) | ||||||
|   - `lustre-client` (crudely provisions storage using a shared lustre |   - `lustre-client` (crudely provisions storage using a shared lustre | ||||||
|     share/directory for all volumes) |     share/directory for all volumes) | ||||||
|   - `nfs-client` (crudely provisions storage using a shared nfs share/directory |   - `nfs-client` (crudely provisions storage using a shared nfs share/directory | ||||||
|  | @ -554,8 +554,6 @@ the respective node. Also beware that any cpu/memory limits placed on the | ||||||
| container by the orchestration system will impact any ability to use the | container by the orchestration system will impact any ability to use the | ||||||
| caching, etc features of objectivefs. | caching, etc features of objectivefs. | ||||||
| 
 | 
 | ||||||
| - https://objectivefs.com/howto/csi-driver-objectivefs |  | ||||||
| - https://objectivefs.com/howto/csi-driver-objectivefs-kubernetes-managed |  | ||||||
| - https://objectivefs.com/howto/objectivefs-admin-key-setup | - https://objectivefs.com/howto/objectivefs-admin-key-setup | ||||||
| - https://objectivefs.com/features#filesystem-pool | - https://objectivefs.com/features#filesystem-pool | ||||||
| - https://objectivefs.com/howto/how-to-create-a-filesystem-with-an-existing-empty-bucket | - https://objectivefs.com/howto/how-to-create-a-filesystem-with-an-existing-empty-bucket | ||||||
|  |  | ||||||
|  | @ -140,13 +140,10 @@ const csi = protoDescriptor.csi.v1; | ||||||
| 
 | 
 | ||||||
| logger.info("initializing csi driver: %s", options.driver); | logger.info("initializing csi driver: %s", options.driver); | ||||||
| 
 | 
 | ||||||
| const { Registry } = require("../src/utils/registry"); |  | ||||||
| let globalRegistry = new Registry(); |  | ||||||
| 
 |  | ||||||
| let driver; | let driver; | ||||||
| try { | try { | ||||||
|   driver = require("../src/driver/factory").factory( |   driver = require("../src/driver/factory").factory( | ||||||
|     { logger, args, cache, package, csiVersion, registry: globalRegistry }, |     { logger, args, cache, package, csiVersion }, | ||||||
|     options |     options | ||||||
|   ); |   ); | ||||||
| } catch (err) { | } catch (err) { | ||||||
|  |  | ||||||
|  | @ -43,19 +43,19 @@ if [[ ! -f ${PV_ORIG_FILE} ]]; then | ||||||
| 	kubectl get pv "${PV}" -o yaml >"${PV_ORIG_FILE}" | 	kubectl get pv "${PV}" -o yaml >"${PV_ORIG_FILE}" | ||||||
| fi | fi | ||||||
| 
 | 
 | ||||||
| reclaimPolicy=$(yq '.spec.persistentVolumeReclaimPolicy' "${PV_ORIG_FILE}") | reclaimPolicy=$(yq eval '.spec.persistentVolumeReclaimPolicy' "${PV_ORIG_FILE}") | ||||||
| 
 | 
 | ||||||
| # copy file for editing | # copy file for editing | ||||||
| cp "${PV_ORIG_FILE}" "${PV_TMP_FILE}" | cp "${PV_ORIG_FILE}" "${PV_TMP_FILE}" | ||||||
| 
 | 
 | ||||||
| # pre-process before edit | # pre-process before edit | ||||||
| yq -i -y 'del(.metadata.resourceVersion)' "${PV_TMP_FILE}" | yq -i eval 'del(.metadata.resourceVersion)' "${PV_TMP_FILE}" | ||||||
| 
 | 
 | ||||||
| # manually edit | # manually edit | ||||||
| ${EDITOR} "${PV_TMP_FILE}" | ${EDITOR} "${PV_TMP_FILE}" | ||||||
| 
 | 
 | ||||||
| # ask if looks good | # ask if looks good | ||||||
| yq '.' "${PV_TMP_FILE}" | yq eval '.' "${PV_TMP_FILE}" | ||||||
| yes_or_no "Would you like to delete the existing PV object and recreate with the above data?" | yes_or_no "Would you like to delete the existing PV object and recreate with the above data?" | ||||||
| 
 | 
 | ||||||
| # set relaim to Retain on PV | # set relaim to Retain on PV | ||||||
|  | @ -69,7 +69,7 @@ kubectl patch pv "${PV}" -p '{"metadata":{"finalizers": null }}' &>/dev/null || | ||||||
| kubectl apply -f "${PV_TMP_FILE}" | kubectl apply -f "${PV_TMP_FILE}" | ||||||
| 
 | 
 | ||||||
| # restore original reclaim value | # restore original reclaim value | ||||||
| kubectl patch pv "${PV}" -p "{\"spec\":{\"persistentVolumeReclaimPolicy\":${reclaimPolicy}}}" | kubectl patch pv "${PV}" -p "{\"spec\":{\"persistentVolumeReclaimPolicy\":\"${reclaimPolicy}\"}}" | ||||||
| 
 | 
 | ||||||
| # spit out any zfs properties updates | # spit out any zfs properties updates | ||||||
| yes_or_no "Would you like to delete the PV backup file?" && { | yes_or_no "Would you like to delete the PV backup file?" && { | ||||||
|  |  | ||||||
|  | @ -84,7 +84,7 @@ install_nvmetcli() { | ||||||
|   python3 setup.py install --install-scripts=${HOME}/.local/bin |   python3 setup.py install --install-scripts=${HOME}/.local/bin | ||||||
| 
 | 
 | ||||||
|   # install to root home dir |   # install to root home dir | ||||||
|   pip install configshell_fb==1.1.30 |   pip install configshell_fb | ||||||
| 
 | 
 | ||||||
|   # remove source |   # remove source | ||||||
|   cd "${SCRIPTDIR}" |   cd "${SCRIPTDIR}" | ||||||
|  |  | ||||||
|  | @ -7,6 +7,7 @@ const fse = require("fs-extra"); | ||||||
| const Kopia = require("../../utils/kopia").Kopia; | const Kopia = require("../../utils/kopia").Kopia; | ||||||
| const os = require("os"); | const os = require("os"); | ||||||
| const path = require("path"); | const path = require("path"); | ||||||
|  | const registry = require("../../utils/registry"); | ||||||
| const Restic = require("../../utils/restic").Restic; | const Restic = require("../../utils/restic").Restic; | ||||||
| const semver = require("semver"); | const semver = require("semver"); | ||||||
| 
 | 
 | ||||||
|  | @ -457,7 +458,7 @@ class ControllerClientCommonDriver extends CsiBaseDriver { | ||||||
|   async getResticClient() { |   async getResticClient() { | ||||||
|     const driver = this; |     const driver = this; | ||||||
| 
 | 
 | ||||||
|     return this.ctx.registry.get(`${__REGISTRY_NS__}:restic`, () => { |     return registry.get(`${__REGISTRY_NS__}:restic`, () => { | ||||||
|       const config_key = driver.getConfigKey(); |       const config_key = driver.getConfigKey(); | ||||||
| 
 | 
 | ||||||
|       const restic_env = _.get( |       const restic_env = _.get( | ||||||
|  | @ -490,7 +491,7 @@ class ControllerClientCommonDriver extends CsiBaseDriver { | ||||||
|   async getKopiaClient() { |   async getKopiaClient() { | ||||||
|     const driver = this; |     const driver = this; | ||||||
| 
 | 
 | ||||||
|     return this.ctx.registry.getAsync(`${__REGISTRY_NS__}:kopia`, async () => { |     return registry.getAsync(`${__REGISTRY_NS__}:kopia`, async () => { | ||||||
|       const config_key = driver.getConfigKey(); |       const config_key = driver.getConfigKey(); | ||||||
| 
 | 
 | ||||||
|       const kopia_env = _.get( |       const kopia_env = _.get( | ||||||
|  |  | ||||||
|  | @ -3,6 +3,7 @@ const { CsiBaseDriver } = require("../index"); | ||||||
| const { GrpcError, grpc } = require("../../utils/grpc"); | const { GrpcError, grpc } = require("../../utils/grpc"); | ||||||
| const GeneralUtils = require("../../utils/general"); | const GeneralUtils = require("../../utils/general"); | ||||||
| const { ObjectiveFS } = require("../../utils/objectivefs"); | const { ObjectiveFS } = require("../../utils/objectivefs"); | ||||||
|  | const registry = require("../../utils/registry"); | ||||||
| const semver = require("semver"); | const semver = require("semver"); | ||||||
| const uuidv4 = require("uuid").v4; | const uuidv4 = require("uuid").v4; | ||||||
| 
 | 
 | ||||||
|  | @ -104,7 +105,7 @@ class ControllerObjectiveFSDriver extends CsiBaseDriver { | ||||||
| 
 | 
 | ||||||
|   async getObjectiveFSClient() { |   async getObjectiveFSClient() { | ||||||
|     const driver = this; |     const driver = this; | ||||||
|     return this.ctx.registry.getAsync( |     return registry.getAsync( | ||||||
|       `${__REGISTRY_NS__}:objectivefsclient`, |       `${__REGISTRY_NS__}:objectivefsclient`, | ||||||
|       async () => { |       async () => { | ||||||
|         const options = {}; |         const options = {}; | ||||||
|  |  | ||||||
|  | @ -3,6 +3,7 @@ const http = require("http"); | ||||||
| const https = require("https"); | const https = require("https"); | ||||||
| const { axios_request, stringify } = require("../../../utils/general"); | const { axios_request, stringify } = require("../../../utils/general"); | ||||||
| const Mutex = require("async-mutex").Mutex; | const Mutex = require("async-mutex").Mutex; | ||||||
|  | const registry = require("../../../utils/registry"); | ||||||
| const { GrpcError, grpc } = require("../../../utils/grpc"); | const { GrpcError, grpc } = require("../../../utils/grpc"); | ||||||
| 
 | 
 | ||||||
| const USER_AGENT = "democratic-csi"; | const USER_AGENT = "democratic-csi"; | ||||||
|  | @ -94,7 +95,7 @@ class SynologyHttpClient { | ||||||
|   } |   } | ||||||
| 
 | 
 | ||||||
|   getHttpAgent() { |   getHttpAgent() { | ||||||
|     return this.ctx.registry.get(`${__REGISTRY_NS__}:http_agent`, () => { |     return registry.get(`${__REGISTRY_NS__}:http_agent`, () => { | ||||||
|       return new http.Agent({ |       return new http.Agent({ | ||||||
|         keepAlive: true, |         keepAlive: true, | ||||||
|         maxSockets: Infinity, |         maxSockets: Infinity, | ||||||
|  | @ -104,7 +105,7 @@ class SynologyHttpClient { | ||||||
|   } |   } | ||||||
| 
 | 
 | ||||||
|   getHttpsAgent() { |   getHttpsAgent() { | ||||||
|     return this.ctx.registry.get(`${__REGISTRY_NS__}:https_agent`, () => { |     return registry.get(`${__REGISTRY_NS__}:https_agent`, () => { | ||||||
|       return new https.Agent({ |       return new https.Agent({ | ||||||
|         keepAlive: true, |         keepAlive: true, | ||||||
|         maxSockets: Infinity, |         maxSockets: Infinity, | ||||||
|  |  | ||||||
|  | @ -3,6 +3,7 @@ const { CsiBaseDriver } = require("../index"); | ||||||
| const GeneralUtils = require("../../utils/general"); | const GeneralUtils = require("../../utils/general"); | ||||||
| const { GrpcError, grpc } = require("../../utils/grpc"); | const { GrpcError, grpc } = require("../../utils/grpc"); | ||||||
| const Handlebars = require("handlebars"); | const Handlebars = require("handlebars"); | ||||||
|  | const registry = require("../../utils/registry"); | ||||||
| const SynologyHttpClient = require("./http").SynologyHttpClient; | const SynologyHttpClient = require("./http").SynologyHttpClient; | ||||||
| const semver = require("semver"); | const semver = require("semver"); | ||||||
| const yaml = require("js-yaml"); | const yaml = require("js-yaml"); | ||||||
|  | @ -114,7 +115,7 @@ class ControllerSynologyDriver extends CsiBaseDriver { | ||||||
|   } |   } | ||||||
| 
 | 
 | ||||||
|   async getHttpClient() { |   async getHttpClient() { | ||||||
|     return this.ctx.registry.get(`${__REGISTRY_NS__}:http_client`, () => { |     return registry.get(`${__REGISTRY_NS__}:http_client`, () => { | ||||||
|       return new SynologyHttpClient(this.options.httpConnection); |       return new SynologyHttpClient(this.options.httpConnection); | ||||||
|     }); |     }); | ||||||
|   } |   } | ||||||
|  |  | ||||||
|  | @ -2,6 +2,7 @@ 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 GeneralUtils = require("../../utils/general"); | const GeneralUtils = require("../../utils/general"); | ||||||
|  | const registry = require("../../utils/registry"); | ||||||
| const LocalCliExecClient = | const LocalCliExecClient = | ||||||
|   require("../../utils/zfs_local_exec_client").LocalCliClient; |   require("../../utils/zfs_local_exec_client").LocalCliClient; | ||||||
| const SshClient = require("../../utils/zfs_ssh_exec_client").SshClient; | const SshClient = require("../../utils/zfs_ssh_exec_client").SshClient; | ||||||
|  | @ -14,7 +15,7 @@ const NVMEOF_ASSETS_NAME_PROPERTY_NAME = "democratic-csi:nvmeof_assets_name"; | ||||||
| const __REGISTRY_NS__ = "ControllerZfsGenericDriver"; | const __REGISTRY_NS__ = "ControllerZfsGenericDriver"; | ||||||
| class ControllerZfsGenericDriver extends ControllerZfsBaseDriver { | class ControllerZfsGenericDriver extends ControllerZfsBaseDriver { | ||||||
|   getExecClient() { |   getExecClient() { | ||||||
|     return this.ctx.registry.get(`${__REGISTRY_NS__}:exec_client`, () => { |     return registry.get(`${__REGISTRY_NS__}:exec_client`, () => { | ||||||
|       if (this.options.sshConnection) { |       if (this.options.sshConnection) { | ||||||
|         return new SshClient({ |         return new SshClient({ | ||||||
|           logger: this.ctx.logger, |           logger: this.ctx.logger, | ||||||
|  | @ -29,7 +30,7 @@ class ControllerZfsGenericDriver extends ControllerZfsBaseDriver { | ||||||
|   } |   } | ||||||
| 
 | 
 | ||||||
|   async getZetabyte() { |   async getZetabyte() { | ||||||
|     return this.ctx.registry.getAsync(`${__REGISTRY_NS__}:zb`, async () => { |     return registry.getAsync(`${__REGISTRY_NS__}:zb`, async () => { | ||||||
|       const execClient = this.getExecClient(); |       const execClient = this.getExecClient(); | ||||||
|       const options = {}; |       const options = {}; | ||||||
|       if (this.options.sshConnection) { |       if (this.options.sshConnection) { | ||||||
|  |  | ||||||
|  | @ -4,6 +4,7 @@ const { GrpcError, grpc } = require("../../utils/grpc"); | ||||||
| const GeneralUtils = require("../../utils/general"); | const GeneralUtils = require("../../utils/general"); | ||||||
| const LocalCliExecClient = | const LocalCliExecClient = | ||||||
|   require("../../utils/zfs_local_exec_client").LocalCliClient; |   require("../../utils/zfs_local_exec_client").LocalCliClient; | ||||||
|  | const registry = require("../../utils/registry"); | ||||||
| const { Zetabyte } = require("../../utils/zfs"); | const { Zetabyte } = require("../../utils/zfs"); | ||||||
| 
 | 
 | ||||||
| const ZFS_ASSET_NAME_PROPERTY_NAME = "zfs_asset_name"; | const ZFS_ASSET_NAME_PROPERTY_NAME = "zfs_asset_name"; | ||||||
|  | @ -32,7 +33,7 @@ class ControllerZfsLocalDriver extends ControllerZfsBaseDriver { | ||||||
|   } |   } | ||||||
| 
 | 
 | ||||||
|   getExecClient() { |   getExecClient() { | ||||||
|     return this.ctx.registry.get(`${__REGISTRY_NS__}:exec_client`, () => { |     return registry.get(`${__REGISTRY_NS__}:exec_client`, () => { | ||||||
|       return new LocalCliExecClient({ |       return new LocalCliExecClient({ | ||||||
|         logger: this.ctx.logger, |         logger: this.ctx.logger, | ||||||
|       }); |       }); | ||||||
|  | @ -40,7 +41,7 @@ class ControllerZfsLocalDriver extends ControllerZfsBaseDriver { | ||||||
|   } |   } | ||||||
| 
 | 
 | ||||||
|   async getZetabyte() { |   async getZetabyte() { | ||||||
|     return this.ctx.registry.getAsync(`${__REGISTRY_NS__}:zb`, async () => { |     return registry.getAsync(`${__REGISTRY_NS__}:zb`, async () => { | ||||||
|       const execClient = this.getExecClient(); |       const execClient = this.getExecClient(); | ||||||
| 
 | 
 | ||||||
|       const options = {}; |       const options = {}; | ||||||
|  |  | ||||||
|  | @ -4,6 +4,7 @@ const { CsiBaseDriver } = require("../index"); | ||||||
| const HttpClient = require("./http").Client; | const HttpClient = require("./http").Client; | ||||||
| const TrueNASApiClient = require("./http/api").Api; | const TrueNASApiClient = require("./http/api").Api; | ||||||
| const { Zetabyte } = require("../../utils/zfs"); | const { Zetabyte } = require("../../utils/zfs"); | ||||||
|  | const registry = require("../../utils/registry"); | ||||||
| const GeneralUtils = require("../../utils/general"); | const GeneralUtils = require("../../utils/general"); | ||||||
| 
 | 
 | ||||||
| const Handlebars = require("handlebars"); | const Handlebars = require("handlebars"); | ||||||
|  | @ -155,7 +156,7 @@ class FreeNASApiDriver extends CsiBaseDriver { | ||||||
|    * @returns |    * @returns | ||||||
|    */ |    */ | ||||||
|   async getZetabyte() { |   async getZetabyte() { | ||||||
|     return this.ctx.registry.get(`${__REGISTRY_NS__}:zb`, () => { |     return registry.get(`${__REGISTRY_NS__}:zb`, () => { | ||||||
|       return new Zetabyte({ |       return new Zetabyte({ | ||||||
|         executor: { |         executor: { | ||||||
|           spawn: function () { |           spawn: function () { | ||||||
|  | @ -2016,7 +2017,7 @@ class FreeNASApiDriver extends CsiBaseDriver { | ||||||
|   } |   } | ||||||
| 
 | 
 | ||||||
|   async getHttpClient() { |   async getHttpClient() { | ||||||
|     return this.ctx.registry.get(`${__REGISTRY_NS__}:http_client`, () => { |     return registry.get(`${__REGISTRY_NS__}:http_client`, () => { | ||||||
|       const client = new HttpClient(this.options.httpConnection); |       const client = new HttpClient(this.options.httpConnection); | ||||||
|       client.logger = this.ctx.logger; |       client.logger = this.ctx.logger; | ||||||
|       client.setApiVersion(2); // requires version 2
 |       client.setApiVersion(2); // requires version 2
 | ||||||
|  | @ -2033,7 +2034,7 @@ class FreeNASApiDriver extends CsiBaseDriver { | ||||||
|   } |   } | ||||||
| 
 | 
 | ||||||
|   async getTrueNASHttpApiClient() { |   async getTrueNASHttpApiClient() { | ||||||
|     return this.ctx.registry.getAsync(`${__REGISTRY_NS__}:api_client`, async () => { |     return registry.getAsync(`${__REGISTRY_NS__}:api_client`, async () => { | ||||||
|       const httpClient = await this.getHttpClient(); |       const httpClient = await this.getHttpClient(); | ||||||
|       return new TrueNASApiClient(httpClient, this.ctx.cache); |       return new TrueNASApiClient(httpClient, this.ctx.cache); | ||||||
|     }); |     }); | ||||||
|  |  | ||||||
|  | @ -1,4 +1,4 @@ | ||||||
| 
 | const registry = require("../../../utils/registry"); | ||||||
| const { sleep, stringify } = require("../../../utils/general"); | const { sleep, stringify } = require("../../../utils/general"); | ||||||
| const { Zetabyte } = require("../../../utils/zfs"); | const { Zetabyte } = require("../../../utils/zfs"); | ||||||
| 
 | 
 | ||||||
|  | @ -22,7 +22,7 @@ class Api { | ||||||
|    * @returns |    * @returns | ||||||
|    */ |    */ | ||||||
|   async getZetabyte() { |   async getZetabyte() { | ||||||
|     return this.ctx.registry.get(`${__REGISTRY_NS__}:zb`, () => { |     return registry.get(`${__REGISTRY_NS__}:zb`, () => { | ||||||
|       return new Zetabyte({ |       return new Zetabyte({ | ||||||
|         executor: { |         executor: { | ||||||
|           spawn: function () { |           spawn: function () { | ||||||
|  |  | ||||||
|  | @ -1,6 +1,7 @@ | ||||||
| const _ = require("lodash"); | 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 registry = require("../../utils/registry"); | ||||||
| const SshClient = require("../../utils/zfs_ssh_exec_client").SshClient; | const SshClient = require("../../utils/zfs_ssh_exec_client").SshClient; | ||||||
| const HttpClient = require("./http").Client; | const HttpClient = require("./http").Client; | ||||||
| const TrueNASApiClient = require("./http/api").Api; | const TrueNASApiClient = require("./http/api").Api; | ||||||
|  | @ -56,7 +57,7 @@ class FreeNASSshDriver extends ControllerZfsBaseDriver { | ||||||
|   } |   } | ||||||
| 
 | 
 | ||||||
|   getExecClient() { |   getExecClient() { | ||||||
|     return this.ctx.registry.get(`${__REGISTRY_NS__}:exec_client`, () => { |     return registry.get(`${__REGISTRY_NS__}:exec_client`, () => { | ||||||
|       return new SshClient({ |       return new SshClient({ | ||||||
|         logger: this.ctx.logger, |         logger: this.ctx.logger, | ||||||
|         connection: this.options.sshConnection, |         connection: this.options.sshConnection, | ||||||
|  | @ -65,7 +66,7 @@ class FreeNASSshDriver extends ControllerZfsBaseDriver { | ||||||
|   } |   } | ||||||
| 
 | 
 | ||||||
|   async getZetabyte() { |   async getZetabyte() { | ||||||
|     return this.ctx.registry.getAsync(`${__REGISTRY_NS__}:zb`, async () => { |     return registry.getAsync(`${__REGISTRY_NS__}:zb`, async () => { | ||||||
|       const sshClient = this.getExecClient(); |       const sshClient = this.getExecClient(); | ||||||
|       const options = {}; |       const options = {}; | ||||||
|       options.executor = new ZfsSshProcessManager(sshClient); |       options.executor = new ZfsSshProcessManager(sshClient); | ||||||
|  | @ -125,7 +126,7 @@ class FreeNASSshDriver extends ControllerZfsBaseDriver { | ||||||
| 
 | 
 | ||||||
|   async getHttpClient(autoDetectVersion = true) { |   async getHttpClient(autoDetectVersion = true) { | ||||||
|     const autodetectkey = autoDetectVersion === true ? 1 : 0; |     const autodetectkey = autoDetectVersion === true ? 1 : 0; | ||||||
|     return this.ctx.registry.getAsync( |     return registry.getAsync( | ||||||
|       `${__REGISTRY_NS__}:http_client:autoDetectVersion_${autodetectkey}`, |       `${__REGISTRY_NS__}:http_client:autoDetectVersion_${autodetectkey}`, | ||||||
|       async () => { |       async () => { | ||||||
|         const client = new HttpClient(this.options.httpConnection); |         const client = new HttpClient(this.options.httpConnection); | ||||||
|  | @ -142,7 +143,7 @@ class FreeNASSshDriver extends ControllerZfsBaseDriver { | ||||||
|   } |   } | ||||||
| 
 | 
 | ||||||
|   async getTrueNASHttpApiClient() { |   async getTrueNASHttpApiClient() { | ||||||
|     return this.ctx.registry.getAsync(`${__REGISTRY_NS__}:api_client`, async () => { |     return registry.getAsync(`${__REGISTRY_NS__}:api_client`, async () => { | ||||||
|       const httpClient = await this.getHttpClient(); |       const httpClient = await this.getHttpClient(); | ||||||
|       return new TrueNASApiClient(httpClient, this.ctx.cache); |       return new TrueNASApiClient(httpClient, this.ctx.cache); | ||||||
|     }); |     }); | ||||||
|  |  | ||||||
|  | @ -12,6 +12,7 @@ const { OneClient } = require("../utils/oneclient"); | ||||||
| const { Filesystem } = require("../utils/filesystem"); | const { Filesystem } = require("../utils/filesystem"); | ||||||
| const { ISCSI } = require("../utils/iscsi"); | const { ISCSI } = require("../utils/iscsi"); | ||||||
| const { NVMEoF } = require("../utils/nvmeof"); | const { NVMEoF } = require("../utils/nvmeof"); | ||||||
|  | const registry = require("../utils/registry"); | ||||||
| const semver = require("semver"); | const semver = require("semver"); | ||||||
| const GeneralUtils = require("../utils/general"); | const GeneralUtils = require("../utils/general"); | ||||||
| const { Zetabyte } = require("../utils/zfs"); | const { Zetabyte } = require("../utils/zfs"); | ||||||
|  | @ -110,7 +111,7 @@ class CsiBaseDriver { | ||||||
|    * @returns Filesystem |    * @returns Filesystem | ||||||
|    */ |    */ | ||||||
|   getDefaultFilesystemInstance() { |   getDefaultFilesystemInstance() { | ||||||
|     return this.ctx.registry.get( |     return registry.get( | ||||||
|       `${__REGISTRY_NS__}:default_filesystem_instance`, |       `${__REGISTRY_NS__}:default_filesystem_instance`, | ||||||
|       () => { |       () => { | ||||||
|         return new Filesystem(); |         return new Filesystem(); | ||||||
|  | @ -124,7 +125,7 @@ class CsiBaseDriver { | ||||||
|    * @returns Mount |    * @returns Mount | ||||||
|    */ |    */ | ||||||
|   getDefaultMountInstance() { |   getDefaultMountInstance() { | ||||||
|     return this.ctx.registry.get(`${__REGISTRY_NS__}:default_mount_instance`, () => { |     return registry.get(`${__REGISTRY_NS__}:default_mount_instance`, () => { | ||||||
|       const filesystem = this.getDefaultFilesystemInstance(); |       const filesystem = this.getDefaultFilesystemInstance(); | ||||||
|       return new Mount({ filesystem }); |       return new Mount({ filesystem }); | ||||||
|     }); |     }); | ||||||
|  | @ -136,7 +137,7 @@ class CsiBaseDriver { | ||||||
|    * @returns ISCSI |    * @returns ISCSI | ||||||
|    */ |    */ | ||||||
|   getDefaultISCSIInstance() { |   getDefaultISCSIInstance() { | ||||||
|     return this.ctx.registry.get(`${__REGISTRY_NS__}:default_iscsi_instance`, () => { |     return registry.get(`${__REGISTRY_NS__}:default_iscsi_instance`, () => { | ||||||
|       return new ISCSI(); |       return new ISCSI(); | ||||||
|     }); |     }); | ||||||
|   } |   } | ||||||
|  | @ -148,13 +149,13 @@ class CsiBaseDriver { | ||||||
|    */ |    */ | ||||||
|   getDefaultNVMEoFInstance() { |   getDefaultNVMEoFInstance() { | ||||||
|     const driver = this; |     const driver = this; | ||||||
|     return this.ctx.registry.get(`${__REGISTRY_NS__}:default_nvmeof_instance`, () => { |     return registry.get(`${__REGISTRY_NS__}:default_nvmeof_instance`, () => { | ||||||
|       return new NVMEoF({ logger: driver.ctx.logger }); |       return new NVMEoF({ logger: driver.ctx.logger }); | ||||||
|     }); |     }); | ||||||
|   } |   } | ||||||
| 
 | 
 | ||||||
|   getDefaultZetabyteInstance() { |   getDefaultZetabyteInstance() { | ||||||
|     return this.ctx.registry.get(`${__REGISTRY_NS__}:default_zb_instance`, () => { |     return registry.get(`${__REGISTRY_NS__}:default_zb_instance`, () => { | ||||||
|       return new Zetabyte({ |       return new Zetabyte({ | ||||||
|         idempotent: true, |         idempotent: true, | ||||||
|         paths: { |         paths: { | ||||||
|  | @ -176,14 +177,14 @@ class CsiBaseDriver { | ||||||
|   } |   } | ||||||
| 
 | 
 | ||||||
|   getDefaultOneClientInstance() { |   getDefaultOneClientInstance() { | ||||||
|     return this.ctx.registry.get(`${__REGISTRY_NS__}:default_oneclient_instance`, () => { |     return registry.get(`${__REGISTRY_NS__}:default_oneclient_instance`, () => { | ||||||
|       return new OneClient(); |       return new OneClient(); | ||||||
|     }); |     }); | ||||||
|   } |   } | ||||||
| 
 | 
 | ||||||
|   getDefaultObjectiveFSInstance() { |   getDefaultObjectiveFSInstance() { | ||||||
|     const driver = this; |     const driver = this; | ||||||
|     return this.ctx.registry.get( |     return registry.get( | ||||||
|       `${__REGISTRY_NS__}:default_objectivefs_instance`, |       `${__REGISTRY_NS__}:default_objectivefs_instance`, | ||||||
|       () => { |       () => { | ||||||
|         return new ObjectiveFS({ |         return new ObjectiveFS({ | ||||||
|  | @ -198,7 +199,7 @@ class CsiBaseDriver { | ||||||
|    * @returns CsiProxyClient |    * @returns CsiProxyClient | ||||||
|    */ |    */ | ||||||
|   getDefaultCsiProxyClientInstance() { |   getDefaultCsiProxyClientInstance() { | ||||||
|     return this.ctx.registry.get(`${__REGISTRY_NS__}:default_csi_proxy_instance`, () => { |     return registry.get(`${__REGISTRY_NS__}:default_csi_proxy_instance`, () => { | ||||||
|       const options = {}; |       const options = {}; | ||||||
|       options.services = _.get(this.options, "node.csiProxy.services", {}); |       options.services = _.get(this.options, "node.csiProxy.services", {}); | ||||||
|       return new CsiProxyClient(options); |       return new CsiProxyClient(options); | ||||||
|  | @ -206,7 +207,7 @@ class CsiBaseDriver { | ||||||
|   } |   } | ||||||
| 
 | 
 | ||||||
|   getDefaultKubernetsConfigInstance() { |   getDefaultKubernetsConfigInstance() { | ||||||
|     return this.ctx.registry.get( |     return registry.get( | ||||||
|       `${__REGISTRY_NS__}:default_kubernetes_config_instance`, |       `${__REGISTRY_NS__}:default_kubernetes_config_instance`, | ||||||
|       () => { |       () => { | ||||||
|         const kc = new k8s.KubeConfig(); |         const kc = new k8s.KubeConfig(); | ||||||
|  |  | ||||||
|  | @ -2,6 +2,7 @@ const fs = require("fs"); | ||||||
| const { CsiBaseDriver } = require("../index"); | const { CsiBaseDriver } = require("../index"); | ||||||
| const { GrpcError, grpc } = require("../../utils/grpc"); | const { GrpcError, grpc } = require("../../utils/grpc"); | ||||||
| const { Filesystem } = require("../../utils/filesystem"); | const { Filesystem } = require("../../utils/filesystem"); | ||||||
|  | const registry = require("../../utils/registry"); | ||||||
| const semver = require("semver"); | const semver = require("semver"); | ||||||
| const SshClient = require("../../utils/zfs_ssh_exec_client").SshClient; | const SshClient = require("../../utils/zfs_ssh_exec_client").SshClient; | ||||||
| const { Zetabyte, ZfsSshProcessManager } = require("../../utils/zfs"); | const { Zetabyte, ZfsSshProcessManager } = require("../../utils/zfs"); | ||||||
|  | @ -124,7 +125,7 @@ class ZfsLocalEphemeralInlineDriver extends CsiBaseDriver { | ||||||
|   } |   } | ||||||
| 
 | 
 | ||||||
|   getSshClient() { |   getSshClient() { | ||||||
|     return this.ctx.registry.get(`${__REGISTRY_NS__}:ssh_client`, () => { |     return registry.get(`${__REGISTRY_NS__}:ssh_client`, () => { | ||||||
|       return new SshClient({ |       return new SshClient({ | ||||||
|         logger: this.ctx.logger, |         logger: this.ctx.logger, | ||||||
|         connection: this.options.sshConnection, |         connection: this.options.sshConnection, | ||||||
|  | @ -133,7 +134,7 @@ class ZfsLocalEphemeralInlineDriver extends CsiBaseDriver { | ||||||
|   } |   } | ||||||
| 
 | 
 | ||||||
|   getZetabyte() { |   getZetabyte() { | ||||||
|     return this.ctx.registry.get(`${__REGISTRY_NS__}:zb`, () => { |     return registry.get(`${__REGISTRY_NS__}:zb`, () => { | ||||||
|       let sshClient; |       let sshClient; | ||||||
|       let executor; |       let executor; | ||||||
|       if (this.options.sshConnection) { |       if (this.options.sshConnection) { | ||||||
|  |  | ||||||
|  | @ -124,7 +124,7 @@ class NVMEoF { | ||||||
|     } catch (err) { |     } catch (err) { | ||||||
|       if ( |       if ( | ||||||
|         err.stderr && |         err.stderr && | ||||||
|         (err.stderr.includes("already connected") || |         (err.stderr.includes("already connnected") || | ||||||
|           err.stderr.includes("Operation already in progress")) |           err.stderr.includes("Operation already in progress")) | ||||||
|       ) { |       ) { | ||||||
|         // idempotent
 |         // idempotent
 | ||||||
|  |  | ||||||
|  | @ -48,4 +48,6 @@ class Registry { | ||||||
|   } |   } | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| module.exports.Registry = Registry; | const registry = new Registry(); | ||||||
|  | 
 | ||||||
|  | module.exports = registry; | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue