update scale nvmet script, implement unsupported deleteStrategy
Signed-off-by: Travis Glenn Hansen <travisghansen@yahoo.com>
This commit is contained in:
parent
28f8af3147
commit
6ada2684f3
|
|
@ -188,8 +188,10 @@ node:
|
||||||
and continue your democratic installation as usuall with other iscsi drivers.
|
and continue your democratic installation as usuall with other iscsi drivers.
|
||||||
|
|
||||||
#### Privileged Namespace
|
#### Privileged Namespace
|
||||||
|
|
||||||
democratic-csi requires privileged access to the nodes, so the namespace should allow for privileged pods. One way of doing it is via [namespace labels](https://kubernetes.io/docs/tasks/configure-pod-container/enforce-standards-namespace-labels/).
|
democratic-csi requires privileged access to the nodes, so the namespace should allow for privileged pods. One way of doing it is via [namespace labels](https://kubernetes.io/docs/tasks/configure-pod-container/enforce-standards-namespace-labels/).
|
||||||
Add the followin label to the democratic-csi installation namespace `pod-security.kubernetes.io/enforce=privileged`
|
Add the followin label to the democratic-csi installation namespace `pod-security.kubernetes.io/enforce=privileged`
|
||||||
|
|
||||||
```
|
```
|
||||||
kubectl label --overwrite namespace democratic-csi pod-security.kubernetes.io/enforce=privileged
|
kubectl label --overwrite namespace democratic-csi pod-security.kubernetes.io/enforce=privileged
|
||||||
```
|
```
|
||||||
|
|
@ -648,12 +650,6 @@ Copy the `contrib/freenas-provisioner-to-democratic-csi.sh` script from the
|
||||||
project to your workstation, read the script in detail, and edit the variables
|
project to your workstation, read the script in detail, and edit the variables
|
||||||
to your needs to start migrating!
|
to your needs to start migrating!
|
||||||
|
|
||||||
# Sponsors
|
|
||||||
|
|
||||||
A special shout out to the wonderful sponsors of the project!
|
|
||||||
|
|
||||||
[](http://ixsystems.com/)
|
|
||||||
|
|
||||||
# Related
|
# Related
|
||||||
|
|
||||||
- https://github.com/nmaupu/freenas-provisioner
|
- https://github.com/nmaupu/freenas-provisioner
|
||||||
|
|
|
||||||
|
|
@ -17,25 +17,60 @@ SCRIPTDIR="$(
|
||||||
cd "${SCRIPTDIR}"
|
cd "${SCRIPTDIR}"
|
||||||
|
|
||||||
: "${NVMETCONFIG:="${SCRIPTDIR}/nvmet-config.json"}"
|
: "${NVMETCONFIG:="${SCRIPTDIR}/nvmet-config.json"}"
|
||||||
|
: "${NVMETVENV:="${SCRIPTDIR}/nvmet-venv"}"
|
||||||
|
|
||||||
export PATH=${HOME}/.local/bin:${PATH}
|
export PATH=${HOME}/.local/bin:${PATH}
|
||||||
|
|
||||||
modules=()
|
main() {
|
||||||
modules+=("nvmet")
|
|
||||||
modules+=("nvmet-fc")
|
|
||||||
modules+=("nvmet-rdma")
|
|
||||||
modules+=("nvmet-tcp")
|
|
||||||
|
|
||||||
for module in "${modules[@]}"; do
|
kernel_modules
|
||||||
modprobe "${module}"
|
nvmetcli ls &>/dev/null || {
|
||||||
done
|
setup_venv
|
||||||
|
install_nvmetcli
|
||||||
which nvmetcli &>/dev/null || {
|
|
||||||
which pip &>/dev/null || {
|
|
||||||
wget -O get-pip.py https://bootstrap.pypa.io/get-pip.py
|
|
||||||
python get-pip.py --user
|
|
||||||
rm get-pip.py
|
|
||||||
}
|
}
|
||||||
|
nvmetcli_restore
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
kernel_modules() {
|
||||||
|
|
||||||
|
modules=()
|
||||||
|
modules+=("nvmet")
|
||||||
|
modules+=("nvmet-fc")
|
||||||
|
modules+=("nvmet-rdma")
|
||||||
|
modules+=("nvmet-tcp")
|
||||||
|
|
||||||
|
for module in "${modules[@]}"; do
|
||||||
|
modprobe "${module}"
|
||||||
|
done
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
setup_venv() {
|
||||||
|
|
||||||
|
rm -rf ${NVMETVENV}
|
||||||
|
python -m venv ${NVMETVENV} --without-pip --system-site-packages
|
||||||
|
activate_venv
|
||||||
|
curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
|
||||||
|
python get-pip.py
|
||||||
|
rm get-pip.py
|
||||||
|
deactivate_venv
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
activate_venv() {
|
||||||
|
|
||||||
|
. ${NVMETVENV}/bin/activate
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
deactivate_venv() {
|
||||||
|
|
||||||
|
deactivate
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
install_nvmetcli() {
|
||||||
|
|
||||||
if [[ ! -d nvmetcli ]]; then
|
if [[ ! -d nvmetcli ]]; then
|
||||||
git clone git://git.infradead.org/users/hch/nvmetcli.git
|
git clone git://git.infradead.org/users/hch/nvmetcli.git
|
||||||
|
|
@ -43,19 +78,31 @@ which nvmetcli &>/dev/null || {
|
||||||
|
|
||||||
cd nvmetcli
|
cd nvmetcli
|
||||||
|
|
||||||
# install to root home dir
|
activate_venv
|
||||||
python3 setup.py install --user
|
|
||||||
|
|
||||||
# install to root home dir
|
# install to root home dir
|
||||||
pip install configshell_fb --user
|
python3 setup.py install --install-scripts=${HOME}/.local/bin
|
||||||
|
|
||||||
|
# install to root home dir
|
||||||
|
pip install configshell_fb
|
||||||
|
|
||||||
# remove source
|
# remove source
|
||||||
cd "${SCRIPTDIR}"
|
cd "${SCRIPTDIR}"
|
||||||
rm -rf nvmetcli
|
rm -rf nvmetcli
|
||||||
|
|
||||||
|
deactivate_venv
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
cd "${SCRIPTDIR}"
|
nvmetcli_restore() {
|
||||||
nvmetcli restore "${NVMETCONFIG}"
|
|
||||||
|
|
||||||
touch /var/run/nvmet-config-loaded
|
activate_venv
|
||||||
chmod +r /var/run/nvmet-config-loaded
|
cd "${SCRIPTDIR}"
|
||||||
|
nvmetcli restore "${NVMETCONFIG}"
|
||||||
|
deactivate_venv
|
||||||
|
touch /var/run/nvmet-config-loaded
|
||||||
|
chmod +r /var/run/nvmet-config-loaded
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
main
|
||||||
|
|
|
||||||
|
|
@ -68,6 +68,8 @@ iscsi:
|
||||||
# add as many as needed
|
# add as many as needed
|
||||||
targetGroups:
|
targetGroups:
|
||||||
# get the correct ID from the "portal" section in the UI
|
# get the correct ID from the "portal" section in the UI
|
||||||
|
# https://github.com/democratic-csi/democratic-csi/issues/302
|
||||||
|
# NOTE: the ID in the UI does NOT always match the ID in the DB, you must use the DB value
|
||||||
- targetGroupPortalGroup: 1
|
- targetGroupPortalGroup: 1
|
||||||
# get the correct ID from the "initiators" section in the UI
|
# get the correct ID from the "initiators" section in the UI
|
||||||
targetGroupInitiatorGroup: 1
|
targetGroupInitiatorGroup: 1
|
||||||
|
|
|
||||||
|
|
@ -77,6 +77,8 @@ iscsi:
|
||||||
# add as many as needed
|
# add as many as needed
|
||||||
targetGroups:
|
targetGroups:
|
||||||
# get the correct ID from the "portal" section in the UI
|
# get the correct ID from the "portal" section in the UI
|
||||||
|
# https://github.com/democratic-csi/democratic-csi/issues/302
|
||||||
|
# NOTE: the ID in the UI does NOT always match the ID in the DB, you must use the DB value
|
||||||
- targetGroupPortalGroup: 1
|
- targetGroupPortalGroup: 1
|
||||||
# get the correct ID from the "initiators" section in the UI
|
# get the correct ID from the "initiators" section in the UI
|
||||||
targetGroupInitiatorGroup: 1
|
targetGroupInitiatorGroup: 1
|
||||||
|
|
|
||||||
|
|
@ -14,6 +14,7 @@ _private:
|
||||||
#driver: kubernetes
|
#driver: kubernetes
|
||||||
|
|
||||||
# THIS IS UNSUPPORTED, BAD THINGS WILL HAPPEN IF NOT CONFIGURED PROPERLY
|
# THIS IS UNSUPPORTED, BAD THINGS WILL HAPPEN IF NOT CONFIGURED PROPERLY
|
||||||
|
# https://github.com/democratic-csi/democratic-csi/issues/289
|
||||||
#
|
#
|
||||||
# note the volume length must *always* be the same for every call for the same volume by the CO
|
# note the volume length must *always* be the same for every call for the same volume by the CO
|
||||||
# the length must NOT execeed 128 characters
|
# the length must NOT execeed 128 characters
|
||||||
|
|
@ -21,6 +22,16 @@ _private:
|
||||||
# must only contain alphnumeric characters or `-` or `_`
|
# must only contain alphnumeric characters or `-` or `_`
|
||||||
idTemplate: "{{ parameters.[csi.storage.k8s.io/pvc/namespace] }}-{{ parameters.[csi.storage.k8s.io/pvc/name] }}"
|
idTemplate: "{{ parameters.[csi.storage.k8s.io/pvc/namespace] }}-{{ parameters.[csi.storage.k8s.io/pvc/name] }}"
|
||||||
|
|
||||||
|
# THIS IS UNSUPPORTED, BAD THINGS WILL HAPPEN IF NOT CONFIGURED PROPERLY
|
||||||
|
# https://github.com/democratic-csi/democratic-csi/issues/289
|
||||||
|
#
|
||||||
|
# in order for this to behave sanely you *MUST* set consistent templates for
|
||||||
|
# share names/assets (ie: nfs/iscsi/etc) and the `idTemplate` above
|
||||||
|
#
|
||||||
|
# setting to retain results in noop delete opertions (both shares where applicable and volumes remain intact)
|
||||||
|
# delete|retain
|
||||||
|
deleteStrategy: retain
|
||||||
|
|
||||||
# if set, this hash is applied *after* the templating above
|
# if set, this hash is applied *after* the templating above
|
||||||
idHash:
|
idHash:
|
||||||
strategy: crc16
|
strategy: crc16
|
||||||
|
|
|
||||||
|
|
@ -65,6 +65,7 @@ nvmeof:
|
||||||
# http://git.infradead.org/users/hch/nvmetcli.git
|
# http://git.infradead.org/users/hch/nvmetcli.git
|
||||||
shareStrategyNvmetCli:
|
shareStrategyNvmetCli:
|
||||||
#sudoEnabled: true
|
#sudoEnabled: true
|
||||||
|
# /root/.local/bin/nvmetcli
|
||||||
#nvmetcliPath: nvmetcli
|
#nvmetcliPath: nvmetcli
|
||||||
# prevent startup race conditions by ensuring the config on disk has been imported
|
# prevent startup race conditions by ensuring the config on disk has been imported
|
||||||
# before we start messing with things
|
# before we start messing with things
|
||||||
|
|
|
||||||
|
|
@ -636,6 +636,17 @@ class ControllerClientCommonDriver extends CsiBaseDriver {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// deleteStrategy
|
||||||
|
const delete_strategy = _.get(
|
||||||
|
driver.options,
|
||||||
|
"_private.csi.volume.deleteStrategy",
|
||||||
|
""
|
||||||
|
);
|
||||||
|
|
||||||
|
if (delete_strategy == "retain") {
|
||||||
|
return {};
|
||||||
|
}
|
||||||
|
|
||||||
const volume_path = driver.getControllerVolumePath(volume_id);
|
const volume_path = driver.getControllerVolumePath(volume_id);
|
||||||
await driver.deleteDir(volume_path);
|
await driver.deleteDir(volume_path);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -458,6 +458,17 @@ class ControllerObjectiveFSDriver extends CsiBaseDriver {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// deleteStrategy
|
||||||
|
const delete_strategy = _.get(
|
||||||
|
driver.options,
|
||||||
|
"_private.csi.volume.deleteStrategy",
|
||||||
|
""
|
||||||
|
);
|
||||||
|
|
||||||
|
if (delete_strategy == "retain") {
|
||||||
|
return {};
|
||||||
|
}
|
||||||
|
|
||||||
volume_id = volume_id.toLowerCase();
|
volume_id = volume_id.toLowerCase();
|
||||||
const filesystem = `${pool}/${volume_id}`;
|
const filesystem = `${pool}/${volume_id}`;
|
||||||
await ofsClient.destroy({}, filesystem, []);
|
await ofsClient.destroy({}, filesystem, []);
|
||||||
|
|
|
||||||
|
|
@ -691,6 +691,17 @@ class ControllerSynologyDriver extends CsiBaseDriver {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// deleteStrategy
|
||||||
|
const delete_strategy = _.get(
|
||||||
|
driver.options,
|
||||||
|
"_private.csi.volume.deleteStrategy",
|
||||||
|
""
|
||||||
|
);
|
||||||
|
|
||||||
|
if (delete_strategy == "retain") {
|
||||||
|
return {};
|
||||||
|
}
|
||||||
|
|
||||||
let response;
|
let response;
|
||||||
|
|
||||||
switch (driver.getDriverShareType()) {
|
switch (driver.getDriverShareType()) {
|
||||||
|
|
|
||||||
|
|
@ -1297,6 +1297,17 @@ class ControllerZfsBaseDriver extends CsiBaseDriver {
|
||||||
|
|
||||||
driver.ctx.logger.debug("dataset properties: %j", properties);
|
driver.ctx.logger.debug("dataset properties: %j", properties);
|
||||||
|
|
||||||
|
// deleteStrategy
|
||||||
|
const delete_strategy = _.get(
|
||||||
|
driver.options,
|
||||||
|
"_private.csi.volume.deleteStrategy",
|
||||||
|
""
|
||||||
|
);
|
||||||
|
|
||||||
|
if (delete_strategy == "retain") {
|
||||||
|
return {};
|
||||||
|
}
|
||||||
|
|
||||||
// remove share resources
|
// remove share resources
|
||||||
await this.deleteShare(call, datasetName);
|
await this.deleteShare(call, datasetName);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -3020,6 +3020,17 @@ class FreeNASApiDriver extends CsiBaseDriver {
|
||||||
|
|
||||||
driver.ctx.logger.debug("dataset properties: %j", properties);
|
driver.ctx.logger.debug("dataset properties: %j", properties);
|
||||||
|
|
||||||
|
// deleteStrategy
|
||||||
|
const delete_strategy = _.get(
|
||||||
|
driver.options,
|
||||||
|
"_private.csi.volume.deleteStrategy",
|
||||||
|
""
|
||||||
|
);
|
||||||
|
|
||||||
|
if (delete_strategy == "retain") {
|
||||||
|
return {};
|
||||||
|
}
|
||||||
|
|
||||||
// remove share resources
|
// remove share resources
|
||||||
await this.deleteShare(call, datasetName);
|
await this.deleteShare(call, datasetName);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -815,11 +815,12 @@ class CsiBaseDriver {
|
||||||
if (!has_guest) {
|
if (!has_guest) {
|
||||||
mount_flags.push("guest");
|
mount_flags.push("guest");
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// handle node service VOLUME_MOUNT_GROUP
|
||||||
if (volume_mount_group) {
|
if (volume_mount_group) {
|
||||||
mount_flags.push(`gid=${volume_mount_group}`);
|
mount_flags.push(`gid=${volume_mount_group}`);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
case "iscsi":
|
case "iscsi":
|
||||||
let portals = [];
|
let portals = [];
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue