From 417de73bf8ab014682bcc9dc16d6d245fb162c81 Mon Sep 17 00:00:00 2001
From: Surya Gupta <109594002+suryagupta4@users.noreply.github.com>
Date: Mon, 28 Aug 2023 10:14:22 +0530
Subject: [PATCH] PowerStore: Volume limits support in Installation Wizard
(#781)
* volume limits support in installation wizard for powerstore
* indentation fix
* updated csm-version check
* updated comparator
Co-authored-by: Niranjan N <110103643+niranjan-n1@users.noreply.github.com>
* increased width of max-volumes-per-node field
---------
Co-authored-by: Niranjan N <110103643+niranjan-n1@users.noreply.github.com>
---
.../csm-versions/default-values.properties | 3 ++-
.../csminstallationwizard/src/index.html | 14 ++++++++++
.../src/static/js/generate-yaml.js | 2 ++
.../src/static/js/tests/generate-yaml.test.js | 26 ++++++++++++++-----
.../src/static/js/tests/ui-functions.test.js | 17 ++++++++++++
.../src/static/js/tests/utility.test.js | 7 ++++-
.../src/static/js/ui-functions.js | 9 +++++++
.../src/static/js/utility.js | 4 +++
.../templates/helm/csm-1.8.0-values.template | 2 ++
.../operator/csm-powerstore-1.8.0.template | 2 +-
10 files changed, 77 insertions(+), 9 deletions(-)
diff --git a/content/docs/deployment/csminstallationwizard/src/csm-versions/default-values.properties b/content/docs/deployment/csminstallationwizard/src/csm-versions/default-values.properties
index 90ede37c5e..150565a2a4 100644
--- a/content/docs/deployment/csminstallationwizard/src/csm-versions/default-values.properties
+++ b/content/docs/deployment/csminstallationwizard/src/csm-versions/default-values.properties
@@ -8,4 +8,5 @@ snapNamePrefix=csi-snap
certSecretCount=1
pollRate=60
driverPodLabel=dell-storage
-arrayThreshold=3
\ No newline at end of file
+arrayThreshold=3
+maxVolumesPerNode=0
\ No newline at end of file
diff --git a/content/docs/deployment/csminstallationwizard/src/index.html b/content/docs/deployment/csminstallationwizard/src/index.html
index 487c2588c7..4edf88dab3 100644
--- a/content/docs/deployment/csminstallationwizard/src/index.html
+++ b/content/docs/deployment/csminstallationwizard/src/index.html
@@ -361,6 +361,20 @@
+
Other configurations for installation
diff --git a/content/docs/deployment/csminstallationwizard/src/static/js/generate-yaml.js b/content/docs/deployment/csminstallationwizard/src/static/js/generate-yaml.js
index a4bb2f1ccc..9bef565d1d 100644
--- a/content/docs/deployment/csminstallationwizard/src/static/js/generate-yaml.js
+++ b/content/docs/deployment/csminstallationwizard/src/static/js/generate-yaml.js
@@ -45,6 +45,7 @@ function setValues(csmMapValues, CONSTANTS_PARAM) {
DriverValues.imageRepository = document.getElementById("image-repository").value;
DriverValues.monitor = $("#monitor").prop('checked') ? true : false;
DriverValues.certSecretCount = document.getElementById("cert-secret-count").value;
+ DriverValues.maxVolumesPerNode = document.getElementById("max-volumes-per-node").value;
DriverValues.controllerCount = document.getElementById("controller-count").value;
DriverValues.volNamePrefix = document.getElementById("vol-name-prefix").value;
DriverValues.snapNamePrefix = document.getElementById("snapshot-prefix").value;
@@ -129,6 +130,7 @@ function setValues(csmMapValues, CONSTANTS_PARAM) {
function createYamlString(yamlTpl, yamlTplValues, driverParam, CONSTANTS_PARAM) {
yamlTpl = yamlTpl.replaceAll("$IMAGE_REPOSITORY", yamlTplValues.imageRepository);
+ yamlTpl = yamlTpl.replaceAll("$MAX_VOLUMES_PER_NODE", yamlTplValues.maxVolumesPerNode);
yamlTpl = yamlTpl.replaceAll("$CONTROLLER_COUNT", yamlTplValues.controllerCount);
yamlTpl = yamlTpl.replaceAll("$VOLUME_NAME_PREFIX", yamlTplValues.volNamePrefix);
yamlTpl = yamlTpl.replaceAll("$SNAP_NAME_PREFIX", yamlTplValues.snapNamePrefix);
diff --git a/content/docs/deployment/csminstallationwizard/src/static/js/tests/generate-yaml.test.js b/content/docs/deployment/csminstallationwizard/src/static/js/tests/generate-yaml.test.js
index 797b91e63f..fbc7ca9260 100644
--- a/content/docs/deployment/csminstallationwizard/src/static/js/tests/generate-yaml.test.js
+++ b/content/docs/deployment/csminstallationwizard/src/static/js/tests/generate-yaml.test.js
@@ -64,6 +64,7 @@ const CONSTANTS = {
const testCSMMap = new Map([
["csmVersion", "1.7.0"],
["imageRepository", "dellemc"],
+ ["maxVolumesPerNode", "0"],
["controllerCount", "1"],
["volNamePrefix", "csivol"],
["snapNamePrefix", "csi-snap"],
@@ -85,6 +86,7 @@ describe("GIVEN setValues function", () => {
+
@@ -121,6 +123,7 @@ describe("GIVEN setValues function", () => {
imageRepository: 'dellemc',
monitor: false,
certSecretCount: '1',
+ maxVolumesPerNode: '0',
controllerCount: '1',
volNamePrefix: 'csivol',
snapNamePrefix: 'csi-snap',
@@ -200,6 +203,7 @@ describe("GIVEN setValues function", () => {
+
@@ -236,6 +240,7 @@ describe("GIVEN setValues function", () => {
imageRepository: 'dellemc',
monitor: false,
certSecretCount: '1',
+ maxVolumesPerNode: '0',
controllerCount: '1',
volNamePrefix: 'csivol',
snapNamePrefix: 'csi-snap',
@@ -315,6 +320,7 @@ describe("GIVEN setValues function", () => {
+
@@ -341,6 +347,7 @@ describe("GIVEN setValues function", () => {
driverVersion: "v2.6.0",
imageRepository: "dellemc",
certSecretCount: "0",
+ maxVolumesPerNode: '0',
controllerCount: "1",
VolnamePrefix: "csivol",
SnapnamePrefix: "csi-snap",
@@ -426,7 +433,8 @@ describe("GIVEN createYamlString function", () => {
podmon:
enabled: $RESILIENCY_ENABLED
image: dellemc/podmon:v1.5.0
-
+ maxPowerstoreVolumesPerNode: $MAX_VOLUMES_PER_NODE
+
## K8S/PowerMax ATTRIBUTES
##########################################
csi-powermax:
@@ -634,6 +642,7 @@ describe("GIVEN createYamlString function", () => {
csmVersion: "1.6.0",
driverVersion: "v2.6.0",
imageRepository: "dellemc",
+ maxVolumesPerNode: "0",
controllerCount: "1",
fsGroupPolicy: "ReadWriteOnceWithFSType",
volNamePrefix: "csivol",
@@ -732,7 +741,8 @@ describe("GIVEN createYamlString function", () => {
podmon:
enabled: false
image: dellemc/podmon:v1.5.0
-
+ maxPowerstoreVolumesPerNode: 0
+
## K8S/PowerMax ATTRIBUTES
##########################################
csi-powermax:
@@ -1000,7 +1010,8 @@ describe("GIVEN createYamlString function", () => {
podmon:
enabled: false
image: dellemc/podmon:v1.5.0
-
+ maxPowerstoreVolumesPerNode: 0
+
## K8S/PowerMax ATTRIBUTES
##########################################
csi-powermax:
@@ -1269,7 +1280,8 @@ describe("GIVEN createYamlString function", () => {
podmon:
enabled: false
image: dellemc/podmon:v1.5.0
-
+ maxPowerstoreVolumesPerNode: 0
+
## K8S/PowerMax ATTRIBUTES
##########################################
csi-powermax:
@@ -1540,7 +1552,8 @@ describe("GIVEN createYamlString function", () => {
podmon:
enabled: false
image: dellemc/podmon:v1.5.0
-
+ maxPowerstoreVolumesPerNode: 0
+
## K8S/PowerMax ATTRIBUTES
##########################################
csi-powermax:
@@ -1810,7 +1823,8 @@ describe("GIVEN createYamlString function", () => {
podmon:
enabled: false
image: dellemc/podmon:v1.5.0
-
+ maxPowerstoreVolumesPerNode: 0
+
## K8S/PowerMax ATTRIBUTES
##########################################
csi-powermax:
diff --git a/content/docs/deployment/csminstallationwizard/src/static/js/tests/ui-functions.test.js b/content/docs/deployment/csminstallationwizard/src/static/js/tests/ui-functions.test.js
index 1e5ada998d..8e193ca151 100644
--- a/content/docs/deployment/csminstallationwizard/src/static/js/tests/ui-functions.test.js
+++ b/content/docs/deployment/csminstallationwizard/src/static/js/tests/ui-functions.test.js
@@ -27,6 +27,7 @@ const {
onNodeSelectorChange,
onCopyButtonClickHandler,
resetImageRepository,
+ resetMaxVolumesPerNode,
resetControllerCount,
resetVolNamePrefix,
resetSnapNamePrefix,
@@ -383,6 +384,22 @@ describe("GIVEN resetImageRepository function", () => {
});
});
+describe("GIVEN resetMaxVolumesPerNode function", () => {
+ const testCSMMap = new Map([
+ ["maxVolumesPerNode", "0"]
+ ]);
+
+ test("SHOULD invoke resetMaxVolumesPerNode function", () => {
+ document.body.innerHTML = `
+
+ `;
+
+ resetMaxVolumesPerNode(testCSMMap);
+
+ expect(document.getElementById("max-volumes-per-node").value).toEqual("0");
+ });
+});
+
describe("GIVEN resetControllerCount function", () => {
const testCSMMap = new Map([
["controllerCount", "2"]
diff --git a/content/docs/deployment/csminstallationwizard/src/static/js/tests/utility.test.js b/content/docs/deployment/csminstallationwizard/src/static/js/tests/utility.test.js
index 87a20a3d1d..3b9cb875f6 100644
--- a/content/docs/deployment/csminstallationwizard/src/static/js/tests/utility.test.js
+++ b/content/docs/deployment/csminstallationwizard/src/static/js/tests/utility.test.js
@@ -132,7 +132,7 @@ describe("GIVEN validateForm functions", () => {
expect(validateForm()).toBe(false);
});
- test("SHOULD return false IF controller-count value is empty", () => {
+ test("SHOULD return false IF controller-count & max-volumes-per-node value is empty", () => {
document.body.innerHTML = `
+
`;
expect(validateForm()).toBe(false);
@@ -173,6 +174,7 @@ describe("GIVEN validateForm functions", () => {
+
`;
@@ -301,6 +303,7 @@ describe("GIVEN setDefaultValues function", () => {
test("SHOULD fill values in dom", () => {
document.body.innerHTML = `
+
@@ -317,6 +320,7 @@ describe("GIVEN setDefaultValues function", () => {
const testCSMMap = new Map([
["csmVersion", "1.7.0"],
["imageRepository", "dellemc"],
+ ["maxVolumesPerNode", "0"],
["controllerCount", "2"],
["volNamePrefix", "csivol"],
["snapNamePrefix", "csi-snap"],
@@ -330,6 +334,7 @@ describe("GIVEN setDefaultValues function", () => {
setDefaultValues("csmVersion=1.7.0\r\nimageRepository=dellemc\r\ncontrollerCount=2\r\ncertSecretCount=1", testCSMMap);
expect(document.getElementById("image-repository").value).toEqual("dellemc");
+ expect(document.getElementById("max-volumes-per-node").value).toEqual("0");
expect(document.getElementById("controller-count").value).toEqual("2");
expect(document.getElementById("csm-version").value).toEqual("1.7.0");
expect(document.getElementById("vol-name-prefix").value).toEqual("csivol");
diff --git a/content/docs/deployment/csminstallationwizard/src/static/js/ui-functions.js b/content/docs/deployment/csminstallationwizard/src/static/js/ui-functions.js
index 4e12de8a51..1ab6b84e45 100644
--- a/content/docs/deployment/csminstallationwizard/src/static/js/ui-functions.js
+++ b/content/docs/deployment/csminstallationwizard/src/static/js/ui-functions.js
@@ -207,6 +207,10 @@ const resetControllerCount = csmMapValue => {
document.getElementById("controller-count").value = String(csmMapValue.get("controllerCount"));
}
+const resetMaxVolumesPerNode = csmMapValue => {
+ document.getElementById("max-volumes-per-node").value = String(csmMapValue.get("maxVolumesPerNode"));
+}
+
const resetVolNamePrefix = csmMapValue => {
document.getElementById("vol-name-prefix").value = String(csmMapValue.get("volNamePrefix"));
}
@@ -287,6 +291,7 @@ function displayModules(installationType, driverName, CONSTANTS_PARAM) {
$(".resizer").show();
$(".snapshot-feature").show();
$(".resiliency-operator").hide();
+ $(".max-volumes-per-node").hide();
$(".observability-operator").hide();
$(".managedArrays").hide();
$(".transport-protocol").hide();
@@ -302,6 +307,9 @@ function displayModules(installationType, driverName, CONSTANTS_PARAM) {
$("#authorization").prop('checked', false);
$(".storage-capacity").show();
$(".resiliency").show();
+ if (document.getElementById("csm-version").value !== "1.7.0") {
+ $(".max-volumes-per-node").show();
+ }
document.getElementById("driver-namespace").value = CONSTANTS_PARAM.POWERSTORE_NAMESPACE;
if (installationType === 'operator'){
$(".resiliency").hide();
@@ -478,6 +486,7 @@ if (typeof exports !== 'undefined') {
onNodeSelectorChange,
onCopyButtonClickHandler,
resetImageRepository,
+ resetMaxVolumesPerNode,
resetControllerCount,
resetNodeSelectorLabel,
resetDriverNamespace,
diff --git a/content/docs/deployment/csminstallationwizard/src/static/js/utility.js b/content/docs/deployment/csminstallationwizard/src/static/js/utility.js
index 6143ac0c68..303794b30b 100644
--- a/content/docs/deployment/csminstallationwizard/src/static/js/utility.js
+++ b/content/docs/deployment/csminstallationwizard/src/static/js/utility.js
@@ -37,6 +37,9 @@ function validateForm(CONSTANTS_PARAM) {
if (document.getElementById('controller-count').value.trim() < 1) {
return false;
}
+ if (document.getElementById('max-volumes-per-node').value.trim() < 0) {
+ return false;
+ }
const powermaxSelected = document.getElementById('array').value.trim() === CONSTANTS_PARAM.POWERMAX;
const vSphereEnabled = $("#vSphere").prop('checked') ? true : false;
@@ -107,6 +110,7 @@ function setDefaultValues(defaultValuesParam, csmMapValues) {
setMap(defaultValuesParam);
document.getElementById("image-repository").value = csmMapValues.get("imageRepository");
document.getElementById("csm-version").value = String(csmMapValues.get("csmVersion"));
+ document.getElementById("max-volumes-per-node").value = String(csmMapValues.get("maxVolumesPerNode"));
document.getElementById("controller-count").value = String(csmMapValues.get("controllerCount"));
document.getElementById("vol-name-prefix").value = csmMapValues.get("volNamePrefix");
document.getElementById("snapshot-prefix").value = csmMapValues.get("snapNamePrefix");
diff --git a/content/docs/deployment/csminstallationwizard/src/templates/helm/csm-1.8.0-values.template b/content/docs/deployment/csminstallationwizard/src/templates/helm/csm-1.8.0-values.template
index db05e0d04e..ab5d95f0db 100644
--- a/content/docs/deployment/csminstallationwizard/src/templates/helm/csm-1.8.0-values.template
+++ b/content/docs/deployment/csminstallationwizard/src/templates/helm/csm-1.8.0-values.template
@@ -87,6 +87,8 @@ csi-powerstore:
# - "--driverPodLabelValue=dell-storage"
# - "--ignoreVolumelessPods=false"
+ maxPowerstoreVolumesPerNode: $MAX_VOLUMES_PER_NODE
+
## K8S/CSI-PowerMax ATTRIBUTES
##########################################
csi-powermax:
diff --git a/content/docs/deployment/csminstallationwizard/src/templates/operator/csm-powerstore-1.8.0.template b/content/docs/deployment/csminstallationwizard/src/templates/operator/csm-powerstore-1.8.0.template
index 8bb97d6f66..12a0b9482b 100644
--- a/content/docs/deployment/csminstallationwizard/src/templates/operator/csm-powerstore-1.8.0.template
+++ b/content/docs/deployment/csminstallationwizard/src/templates/operator/csm-powerstore-1.8.0.template
@@ -131,7 +131,7 @@ spec:
# Allowed values: Any value greater than or equal to 0
# Default value: "0"
- name: X_CSI_POWERSTORE_MAX_VOLUMES_PER_NODE
- value: "0"
+ value: "$MAX_VOLUMES_PER_NODE"
# nodeSelector: Define node selection constraints for node pods.
# For the pod to be eligible to run on a node, the node must have each