Compare commits

...

14 Commits

Author SHA1 Message Date
Travis Glenn Hansen 8193b689ed
Merge pull request #452 from d-uzlov/fix-global-registry
refactor: stop using global variable for cache registry
2025-03-24 15:37:37 -06:00
Danil Uzlov 4e402645d9 use registry from context 2025-02-03 22:06:20 +00:00
Travis Glenn Hansen 31f215c55a
Merge pull request #443 from ChanningHe/scale-script-fix
set script configshell_fb version to 1.1.30
2025-01-21 00:31:01 -06:00
ChanningHe 4bda571e52 set configshell_fb version to 1.1.30 2025-01-06 12:07:57 +00:00
Travis Glenn Hansen 7648b0d015
Merge pull request #435 from Routhinator/update-pv-updater-for-yq-changes
Fix pv-updater.sh for changes in yq
2024-12-15 13:21:52 -07:00
Chris Routh 8b0b7b8b4f
Fix pv-updater.sh for changes in yq 2024-12-15 09:17:41 -08:00
Travis Glenn Hansen 4ec9ff23f2
Merge pull request #411 from democratic-csi/next
doc updates
2024-07-06 21:16:19 -06:00
Travis Glenn Hansen 8c5ac0a2c7 doc updates
Signed-off-by: Travis Glenn Hansen <travisghansen@yahoo.com>
2024-07-06 11:15:54 -06:00
Travis Glenn Hansen 6c30c7ca50
Merge pull request #410 from fengye87/patch-1
Fix error string typo in connectByNQNTransport
2024-07-06 10:21:14 -06:00
Feng Ye 7595191a13
Fix error string typo in connectByNQNTransport 2024-07-05 11:31:54 +08:00
Travis Glenn Hansen 6af367fbb6
Merge pull request #405 from democratic-csi/next
fixes for objectivefs
2024-06-02 08:09:25 -06:00
Travis Glenn Hansen dd604f4d3a fixes for objectivefs
Signed-off-by: Travis Glenn Hansen <travisghansen@yahoo.com>
2024-06-01 21:58:41 -06:00
Travis Glenn Hansen 2e7eed890e
Merge pull request #404 from democratic-csi/next
minor fixes, v1.9.2
2024-05-23 10:55:49 -06:00
Travis Glenn Hansen 7206429913 minor fixes, v1.9.2
Signed-off-by: Travis Glenn Hansen <travisghansen@yahoo.com>
2024-05-23 08:53:39 -06:00
20 changed files with 65 additions and 54 deletions

View File

@ -1,3 +1,21 @@
# v1.9.4
Release 2024-07-06
- minor doc updates
# v1.9.3
Released 2024-06-01
- minor fixes for objectivefs and iscsi
# v1.9.2
Released 2024-05-23
- minor fixes for objectivefs and iscsi
# v1.9.1
Released 2024-05-06

View File

@ -30,7 +30,7 @@ have access to resizing, snapshots, clones, etc functionality.
- `zfs-local-dataset` (provision node-local volume as dataset)
- `zfs-local-zvol` (provision node-local volume as zvol)
- `synology-iscsi` experimental (manages volumes to share over iscsi)
- `objectivefs` experimental (manages objectivefs volumes)
- `objectivefs` (manages objectivefs volumes)
- `lustre-client` (crudely provisions storage using a shared lustre
share/directory for all volumes)
- `nfs-client` (crudely provisions storage using a shared nfs share/directory
@ -554,6 +554,8 @@ 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
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/features#filesystem-pool
- https://objectivefs.com/howto/how-to-create-a-filesystem-with-an-existing-empty-bucket

View File

@ -140,10 +140,13 @@ const csi = protoDescriptor.csi.v1;
logger.info("initializing csi driver: %s", options.driver);
const { Registry } = require("../src/utils/registry");
let globalRegistry = new Registry();
let driver;
try {
driver = require("../src/driver/factory").factory(
{ logger, args, cache, package, csiVersion },
{ logger, args, cache, package, csiVersion, registry: globalRegistry },
options
);
} catch (err) {

View File

@ -43,19 +43,19 @@ if [[ ! -f ${PV_ORIG_FILE} ]]; then
kubectl get pv "${PV}" -o yaml >"${PV_ORIG_FILE}"
fi
reclaimPolicy=$(yq eval '.spec.persistentVolumeReclaimPolicy' "${PV_ORIG_FILE}")
reclaimPolicy=$(yq '.spec.persistentVolumeReclaimPolicy' "${PV_ORIG_FILE}")
# copy file for editing
cp "${PV_ORIG_FILE}" "${PV_TMP_FILE}"
# pre-process before edit
yq -i eval 'del(.metadata.resourceVersion)' "${PV_TMP_FILE}"
yq -i -y 'del(.metadata.resourceVersion)' "${PV_TMP_FILE}"
# manually edit
${EDITOR} "${PV_TMP_FILE}"
# ask if looks good
yq eval '.' "${PV_TMP_FILE}"
yq '.' "${PV_TMP_FILE}"
yes_or_no "Would you like to delete the existing PV object and recreate with the above data?"
# 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}"
# 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
yes_or_no "Would you like to delete the PV backup file?" && {

View File

@ -84,7 +84,7 @@ install_nvmetcli() {
python3 setup.py install --install-scripts=${HOME}/.local/bin
# install to root home dir
pip install configshell_fb
pip install configshell_fb==1.1.30
# remove source
cd "${SCRIPTDIR}"

View File

@ -13,7 +13,7 @@ case ${ISCSIADM_HOST_STRATEGY} in
nsenter)
# https://github.com/siderolabs/extensions/issues/38#issuecomment-1125403043
iscsid_pid=$(pgrep iscsid)
iscsid_pid=$(pgrep --exact --oldest iscsid)
if [[ "${iscsid_pid}x" == "x" ]]; then
echoerr "failed to find iscsid pid for nsenter"
exit 1

View File

@ -7,7 +7,6 @@ const fse = require("fs-extra");
const Kopia = require("../../utils/kopia").Kopia;
const os = require("os");
const path = require("path");
const registry = require("../../utils/registry");
const Restic = require("../../utils/restic").Restic;
const semver = require("semver");
@ -458,7 +457,7 @@ class ControllerClientCommonDriver extends CsiBaseDriver {
async getResticClient() {
const driver = this;
return registry.get(`${__REGISTRY_NS__}:restic`, () => {
return this.ctx.registry.get(`${__REGISTRY_NS__}:restic`, () => {
const config_key = driver.getConfigKey();
const restic_env = _.get(
@ -491,7 +490,7 @@ class ControllerClientCommonDriver extends CsiBaseDriver {
async getKopiaClient() {
const driver = this;
return registry.getAsync(`${__REGISTRY_NS__}:kopia`, async () => {
return this.ctx.registry.getAsync(`${__REGISTRY_NS__}:kopia`, async () => {
const config_key = driver.getConfigKey();
const kopia_env = _.get(

View File

@ -3,7 +3,6 @@ const { CsiBaseDriver } = require("../index");
const { GrpcError, grpc } = require("../../utils/grpc");
const GeneralUtils = require("../../utils/general");
const { ObjectiveFS } = require("../../utils/objectivefs");
const registry = require("../../utils/registry");
const semver = require("semver");
const uuidv4 = require("uuid").v4;
@ -105,7 +104,7 @@ class ControllerObjectiveFSDriver extends CsiBaseDriver {
async getObjectiveFSClient() {
const driver = this;
return registry.getAsync(
return this.ctx.registry.getAsync(
`${__REGISTRY_NS__}:objectivefsclient`,
async () => {
const options = {};

View File

@ -3,7 +3,6 @@ const http = require("http");
const https = require("https");
const { axios_request, stringify } = require("../../../utils/general");
const Mutex = require("async-mutex").Mutex;
const registry = require("../../../utils/registry");
const { GrpcError, grpc } = require("../../../utils/grpc");
const USER_AGENT = "democratic-csi";
@ -95,7 +94,7 @@ class SynologyHttpClient {
}
getHttpAgent() {
return registry.get(`${__REGISTRY_NS__}:http_agent`, () => {
return this.ctx.registry.get(`${__REGISTRY_NS__}:http_agent`, () => {
return new http.Agent({
keepAlive: true,
maxSockets: Infinity,
@ -105,7 +104,7 @@ class SynologyHttpClient {
}
getHttpsAgent() {
return registry.get(`${__REGISTRY_NS__}:https_agent`, () => {
return this.ctx.registry.get(`${__REGISTRY_NS__}:https_agent`, () => {
return new https.Agent({
keepAlive: true,
maxSockets: Infinity,

View File

@ -3,7 +3,6 @@ const { CsiBaseDriver } = require("../index");
const GeneralUtils = require("../../utils/general");
const { GrpcError, grpc } = require("../../utils/grpc");
const Handlebars = require("handlebars");
const registry = require("../../utils/registry");
const SynologyHttpClient = require("./http").SynologyHttpClient;
const semver = require("semver");
const yaml = require("js-yaml");
@ -115,7 +114,7 @@ class ControllerSynologyDriver extends CsiBaseDriver {
}
async getHttpClient() {
return registry.get(`${__REGISTRY_NS__}:http_client`, () => {
return this.ctx.registry.get(`${__REGISTRY_NS__}:http_client`, () => {
return new SynologyHttpClient(this.options.httpConnection);
});
}

View File

@ -2,7 +2,6 @@ const _ = require("lodash");
const { ControllerZfsBaseDriver } = require("../controller-zfs");
const { GrpcError, grpc } = require("../../utils/grpc");
const GeneralUtils = require("../../utils/general");
const registry = require("../../utils/registry");
const LocalCliExecClient =
require("../../utils/zfs_local_exec_client").LocalCliClient;
const SshClient = require("../../utils/zfs_ssh_exec_client").SshClient;
@ -15,7 +14,7 @@ const NVMEOF_ASSETS_NAME_PROPERTY_NAME = "democratic-csi:nvmeof_assets_name";
const __REGISTRY_NS__ = "ControllerZfsGenericDriver";
class ControllerZfsGenericDriver extends ControllerZfsBaseDriver {
getExecClient() {
return registry.get(`${__REGISTRY_NS__}:exec_client`, () => {
return this.ctx.registry.get(`${__REGISTRY_NS__}:exec_client`, () => {
if (this.options.sshConnection) {
return new SshClient({
logger: this.ctx.logger,
@ -30,7 +29,7 @@ class ControllerZfsGenericDriver extends ControllerZfsBaseDriver {
}
async getZetabyte() {
return registry.getAsync(`${__REGISTRY_NS__}:zb`, async () => {
return this.ctx.registry.getAsync(`${__REGISTRY_NS__}:zb`, async () => {
const execClient = this.getExecClient();
const options = {};
if (this.options.sshConnection) {

View File

@ -4,7 +4,6 @@ const { GrpcError, grpc } = require("../../utils/grpc");
const GeneralUtils = require("../../utils/general");
const LocalCliExecClient =
require("../../utils/zfs_local_exec_client").LocalCliClient;
const registry = require("../../utils/registry");
const { Zetabyte } = require("../../utils/zfs");
const ZFS_ASSET_NAME_PROPERTY_NAME = "zfs_asset_name";
@ -33,7 +32,7 @@ class ControllerZfsLocalDriver extends ControllerZfsBaseDriver {
}
getExecClient() {
return registry.get(`${__REGISTRY_NS__}:exec_client`, () => {
return this.ctx.registry.get(`${__REGISTRY_NS__}:exec_client`, () => {
return new LocalCliExecClient({
logger: this.ctx.logger,
});
@ -41,7 +40,7 @@ class ControllerZfsLocalDriver extends ControllerZfsBaseDriver {
}
async getZetabyte() {
return registry.getAsync(`${__REGISTRY_NS__}:zb`, async () => {
return this.ctx.registry.getAsync(`${__REGISTRY_NS__}:zb`, async () => {
const execClient = this.getExecClient();
const options = {};

View File

@ -4,7 +4,6 @@ const { CsiBaseDriver } = require("../index");
const HttpClient = require("./http").Client;
const TrueNASApiClient = require("./http/api").Api;
const { Zetabyte } = require("../../utils/zfs");
const registry = require("../../utils/registry");
const GeneralUtils = require("../../utils/general");
const Handlebars = require("handlebars");
@ -156,7 +155,7 @@ class FreeNASApiDriver extends CsiBaseDriver {
* @returns
*/
async getZetabyte() {
return registry.get(`${__REGISTRY_NS__}:zb`, () => {
return this.ctx.registry.get(`${__REGISTRY_NS__}:zb`, () => {
return new Zetabyte({
executor: {
spawn: function () {
@ -2017,7 +2016,7 @@ class FreeNASApiDriver extends CsiBaseDriver {
}
async getHttpClient() {
return registry.get(`${__REGISTRY_NS__}:http_client`, () => {
return this.ctx.registry.get(`${__REGISTRY_NS__}:http_client`, () => {
const client = new HttpClient(this.options.httpConnection);
client.logger = this.ctx.logger;
client.setApiVersion(2); // requires version 2
@ -2034,7 +2033,7 @@ class FreeNASApiDriver extends CsiBaseDriver {
}
async getTrueNASHttpApiClient() {
return registry.getAsync(`${__REGISTRY_NS__}:api_client`, async () => {
return this.ctx.registry.getAsync(`${__REGISTRY_NS__}:api_client`, async () => {
const httpClient = await this.getHttpClient();
return new TrueNASApiClient(httpClient, this.ctx.cache);
});

View File

@ -1,4 +1,4 @@
const registry = require("../../../utils/registry");
const { sleep, stringify } = require("../../../utils/general");
const { Zetabyte } = require("../../../utils/zfs");
@ -22,7 +22,7 @@ class Api {
* @returns
*/
async getZetabyte() {
return registry.get(`${__REGISTRY_NS__}:zb`, () => {
return this.ctx.registry.get(`${__REGISTRY_NS__}:zb`, () => {
return new Zetabyte({
executor: {
spawn: function () {

View File

@ -1,7 +1,6 @@
const _ = require("lodash");
const { ControllerZfsBaseDriver } = require("../controller-zfs");
const { GrpcError, grpc } = require("../../utils/grpc");
const registry = require("../../utils/registry");
const SshClient = require("../../utils/zfs_ssh_exec_client").SshClient;
const HttpClient = require("./http").Client;
const TrueNASApiClient = require("./http/api").Api;
@ -57,7 +56,7 @@ class FreeNASSshDriver extends ControllerZfsBaseDriver {
}
getExecClient() {
return registry.get(`${__REGISTRY_NS__}:exec_client`, () => {
return this.ctx.registry.get(`${__REGISTRY_NS__}:exec_client`, () => {
return new SshClient({
logger: this.ctx.logger,
connection: this.options.sshConnection,
@ -66,7 +65,7 @@ class FreeNASSshDriver extends ControllerZfsBaseDriver {
}
async getZetabyte() {
return registry.getAsync(`${__REGISTRY_NS__}:zb`, async () => {
return this.ctx.registry.getAsync(`${__REGISTRY_NS__}:zb`, async () => {
const sshClient = this.getExecClient();
const options = {};
options.executor = new ZfsSshProcessManager(sshClient);
@ -126,7 +125,7 @@ class FreeNASSshDriver extends ControllerZfsBaseDriver {
async getHttpClient(autoDetectVersion = true) {
const autodetectkey = autoDetectVersion === true ? 1 : 0;
return registry.getAsync(
return this.ctx.registry.getAsync(
`${__REGISTRY_NS__}:http_client:autoDetectVersion_${autodetectkey}`,
async () => {
const client = new HttpClient(this.options.httpConnection);
@ -143,7 +142,7 @@ class FreeNASSshDriver extends ControllerZfsBaseDriver {
}
async getTrueNASHttpApiClient() {
return registry.getAsync(`${__REGISTRY_NS__}:api_client`, async () => {
return this.ctx.registry.getAsync(`${__REGISTRY_NS__}:api_client`, async () => {
const httpClient = await this.getHttpClient();
return new TrueNASApiClient(httpClient, this.ctx.cache);
});

View File

@ -12,7 +12,6 @@ const { OneClient } = require("../utils/oneclient");
const { Filesystem } = require("../utils/filesystem");
const { ISCSI } = require("../utils/iscsi");
const { NVMEoF } = require("../utils/nvmeof");
const registry = require("../utils/registry");
const semver = require("semver");
const GeneralUtils = require("../utils/general");
const { Zetabyte } = require("../utils/zfs");
@ -111,7 +110,7 @@ class CsiBaseDriver {
* @returns Filesystem
*/
getDefaultFilesystemInstance() {
return registry.get(
return this.ctx.registry.get(
`${__REGISTRY_NS__}:default_filesystem_instance`,
() => {
return new Filesystem();
@ -125,7 +124,7 @@ class CsiBaseDriver {
* @returns Mount
*/
getDefaultMountInstance() {
return registry.get(`${__REGISTRY_NS__}:default_mount_instance`, () => {
return this.ctx.registry.get(`${__REGISTRY_NS__}:default_mount_instance`, () => {
const filesystem = this.getDefaultFilesystemInstance();
return new Mount({ filesystem });
});
@ -137,7 +136,7 @@ class CsiBaseDriver {
* @returns ISCSI
*/
getDefaultISCSIInstance() {
return registry.get(`${__REGISTRY_NS__}:default_iscsi_instance`, () => {
return this.ctx.registry.get(`${__REGISTRY_NS__}:default_iscsi_instance`, () => {
return new ISCSI();
});
}
@ -149,13 +148,13 @@ class CsiBaseDriver {
*/
getDefaultNVMEoFInstance() {
const driver = this;
return registry.get(`${__REGISTRY_NS__}:default_nvmeof_instance`, () => {
return this.ctx.registry.get(`${__REGISTRY_NS__}:default_nvmeof_instance`, () => {
return new NVMEoF({ logger: driver.ctx.logger });
});
}
getDefaultZetabyteInstance() {
return registry.get(`${__REGISTRY_NS__}:default_zb_instance`, () => {
return this.ctx.registry.get(`${__REGISTRY_NS__}:default_zb_instance`, () => {
return new Zetabyte({
idempotent: true,
paths: {
@ -177,14 +176,14 @@ class CsiBaseDriver {
}
getDefaultOneClientInstance() {
return registry.get(`${__REGISTRY_NS__}:default_oneclient_instance`, () => {
return this.ctx.registry.get(`${__REGISTRY_NS__}:default_oneclient_instance`, () => {
return new OneClient();
});
}
getDefaultObjectiveFSInstance() {
const driver = this;
return registry.get(
return this.ctx.registry.get(
`${__REGISTRY_NS__}:default_objectivefs_instance`,
() => {
return new ObjectiveFS({
@ -199,7 +198,7 @@ class CsiBaseDriver {
* @returns CsiProxyClient
*/
getDefaultCsiProxyClientInstance() {
return registry.get(`${__REGISTRY_NS__}:default_csi_proxy_instance`, () => {
return this.ctx.registry.get(`${__REGISTRY_NS__}:default_csi_proxy_instance`, () => {
const options = {};
options.services = _.get(this.options, "node.csiProxy.services", {});
return new CsiProxyClient(options);
@ -207,7 +206,7 @@ class CsiBaseDriver {
}
getDefaultKubernetsConfigInstance() {
return registry.get(
return this.ctx.registry.get(
`${__REGISTRY_NS__}:default_kubernetes_config_instance`,
() => {
const kc = new k8s.KubeConfig();

View File

@ -2,7 +2,6 @@ const fs = require("fs");
const { CsiBaseDriver } = require("../index");
const { GrpcError, grpc } = require("../../utils/grpc");
const { Filesystem } = require("../../utils/filesystem");
const registry = require("../../utils/registry");
const semver = require("semver");
const SshClient = require("../../utils/zfs_ssh_exec_client").SshClient;
const { Zetabyte, ZfsSshProcessManager } = require("../../utils/zfs");
@ -125,7 +124,7 @@ class ZfsLocalEphemeralInlineDriver extends CsiBaseDriver {
}
getSshClient() {
return registry.get(`${__REGISTRY_NS__}:ssh_client`, () => {
return this.ctx.registry.get(`${__REGISTRY_NS__}:ssh_client`, () => {
return new SshClient({
logger: this.ctx.logger,
connection: this.options.sshConnection,
@ -134,7 +133,7 @@ class ZfsLocalEphemeralInlineDriver extends CsiBaseDriver {
}
getZetabyte() {
return registry.get(`${__REGISTRY_NS__}:zb`, () => {
return this.ctx.registry.get(`${__REGISTRY_NS__}:zb`, () => {
let sshClient;
let executor;
if (this.options.sshConnection) {

View File

@ -124,7 +124,7 @@ class NVMEoF {
} catch (err) {
if (
err.stderr &&
(err.stderr.includes("already connnected") ||
(err.stderr.includes("already connected") ||
err.stderr.includes("Operation already in progress"))
) {
// idempotent

View File

@ -275,13 +275,13 @@ class ObjectiveFS {
async getObjectStoreFromFilesystem(filesystem) {
if (filesystem.includes("://")) {
return GeneralUtils.before_string("://");
return GeneralUtils.before_string(filesystem, "://") + "://";
}
}
async stripObjectStoreFromFilesystem(filesystem) {
if (filesystem.includes("://")) {
return GeneralUtils.after_string("://");
return GeneralUtils.after_string(filesystem, "://");
}
return filesystem;
}

View File

@ -48,6 +48,4 @@ class Registry {
}
}
const registry = new Registry();
module.exports = registry;
module.exports.Registry = Registry;