Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PowerStore: Volume limits support in Installation Wizard #781

Merged
merged 6 commits into from
Aug 28, 2023
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,5 @@ snapNamePrefix=csi-snap
certSecretCount=1
pollRate=60
driverPodLabel=dell-storage
arrayThreshold=3
arrayThreshold=3
maxVolumesPerNode=0
14 changes: 14 additions & 0 deletions content/docs/deployment/csminstallationwizard/src/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -361,6 +361,20 @@
</div>
</div>

<div class="was-validated row mb-4 max-volumes-per-node">
<label for="max-volumes-per-node" class="col-sm-2 col-form-label" data-bs-toggle="tooltip" data-bs-placement="right" title="Default value for maximum number of volumes that controller can publish to the node." style="width: 180px;">Max Volumes Per Node</label>
<div class="row">
<div class="col-sm-2">
<input class="form-control input-sm" type="number" id="max-volumes-per-node" min="0" oninput="validateInput(validateForm, CONSTANTS)">
</div>
<div class="col-sm-4">
<div class="row mt-1">
<a class="reset" id="reset-max-volumes-per-node" onclick="resetMaxVolumesPerNode(csmMap)">Reset to default</a>
</div>
</div>
</div>
</div>

<hr>
<div class="row mb-3">
<div class="col-sm-12 h5">Other configurations for installation</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"],
Expand All @@ -85,6 +86,7 @@ describe("GIVEN setValues function", () => {
</select>
<input type="text" id="image-repository" value="dellemc">
<input type="number" id="cert-secret-count" value="1">
<input type="number" id="max-volumes-per-node" value="0">
<input type="number" id="controller-count" value="1">
<input type="text" id="vol-name-prefix" value="csivol">
<input type="text" id="snapshot-prefix" value="csi-snap">
Expand Down Expand Up @@ -121,6 +123,7 @@ describe("GIVEN setValues function", () => {
imageRepository: 'dellemc',
monitor: false,
certSecretCount: '1',
maxVolumesPerNode: '0',
controllerCount: '1',
volNamePrefix: 'csivol',
snapNamePrefix: 'csi-snap',
Expand Down Expand Up @@ -200,6 +203,7 @@ describe("GIVEN setValues function", () => {
</select>
<input type="text" id="image-repository" value="dellemc">
<input type="number" id="cert-secret-count" value="1">
<input type="number" id="max-volumes-per-node" value="0">
<input type="number" id="controller-count" value="1">
<input type="text" id="vol-name-prefix" value="csivol">
<input type="text" id="snapshot-prefix" value="csi-snap">
Expand Down Expand Up @@ -236,6 +240,7 @@ describe("GIVEN setValues function", () => {
imageRepository: 'dellemc',
monitor: false,
certSecretCount: '1',
maxVolumesPerNode: '0',
controllerCount: '1',
volNamePrefix: 'csivol',
snapNamePrefix: 'csi-snap',
Expand Down Expand Up @@ -315,6 +320,7 @@ describe("GIVEN setValues function", () => {
</select>
<input type="text" id="image-repository" value="dellemc">
<input type="number" id="cert-secret-count" value="0">
<input type="number" id="max-volumes-per-node" value="0">
<input type="number" id="controller-count" value="2">
<input type="text" id="vol-name-prefix" value="csivol">
<input type="text" id="snapshot-prefix" value="csi-snap">
Expand All @@ -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",
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -732,7 +741,8 @@ describe("GIVEN createYamlString function", () => {
podmon:
enabled: false
image: dellemc/podmon:v1.5.0

maxPowerstoreVolumesPerNode: 0

## K8S/PowerMax ATTRIBUTES
##########################################
csi-powermax:
Expand Down Expand Up @@ -1000,7 +1010,8 @@ describe("GIVEN createYamlString function", () => {
podmon:
enabled: false
image: dellemc/podmon:v1.5.0

maxPowerstoreVolumesPerNode: 0

## K8S/PowerMax ATTRIBUTES
##########################################
csi-powermax:
Expand Down Expand Up @@ -1269,7 +1280,8 @@ describe("GIVEN createYamlString function", () => {
podmon:
enabled: false
image: dellemc/podmon:v1.5.0

maxPowerstoreVolumesPerNode: 0

## K8S/PowerMax ATTRIBUTES
##########################################
csi-powermax:
Expand Down Expand Up @@ -1540,7 +1552,8 @@ describe("GIVEN createYamlString function", () => {
podmon:
enabled: false
image: dellemc/podmon:v1.5.0

maxPowerstoreVolumesPerNode: 0

## K8S/PowerMax ATTRIBUTES
##########################################
csi-powermax:
Expand Down Expand Up @@ -1810,7 +1823,8 @@ describe("GIVEN createYamlString function", () => {
podmon:
enabled: false
image: dellemc/podmon:v1.5.0

maxPowerstoreVolumesPerNode: 0

## K8S/PowerMax ATTRIBUTES
##########################################
csi-powermax:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ const {
onNodeSelectorChange,
onCopyButtonClickHandler,
resetImageRepository,
resetMaxVolumesPerNode,
resetControllerCount,
resetVolNamePrefix,
resetSnapNamePrefix,
Expand Down Expand Up @@ -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 = `
<input type="number" id="max-volumes-per-node">
`;

resetMaxVolumesPerNode(testCSMMap);

expect(document.getElementById("max-volumes-per-node").value).toEqual("0");
});
});

describe("GIVEN resetControllerCount function", () => {
const testCSMMap = new Map([
["controllerCount", "2"]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 = `
<select id="array" value="powerstore">
<option value="powerstore">PowerStore</option>
Expand All @@ -146,6 +146,7 @@ describe("GIVEN validateForm functions", () => {
</select>
<input type="text" id="driver-namespace" value="temp-value">
<input type="number" id="controller-count">
<input type="number" id="max-volumes-per-node">
`;

expect(validateForm()).toBe(false);
Expand Down Expand Up @@ -173,6 +174,7 @@ describe("GIVEN validateForm functions", () => {
<input type="text" id="vSphere-fc-host-name">
<input type="text" id="vSphere-vCenter-host">
<input type="text" id="vSphere-vCenter-cred-secret">
<input type="number" id="max-volumes-per-node">
<input type="text" id="manage-array-id">
<input type="text" id="transport-protocol">
`;
Expand Down Expand Up @@ -301,6 +303,7 @@ describe("GIVEN setDefaultValues function", () => {
test("SHOULD fill values in dom", () => {
document.body.innerHTML = `
<input type="text" id="image-repository">
<input type="number" id="max-volumes-per-node">
<input type="number" id="controller-count">
<input type="text" id="vol-name-prefix">
<input type="text" id="snapshot-prefix">
Expand All @@ -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"],
Expand All @@ -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");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"));
}
Expand Down Expand Up @@ -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();
Expand All @@ -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();
Expand Down Expand Up @@ -478,6 +486,7 @@ if (typeof exports !== 'undefined') {
onNodeSelectorChange,
onCopyButtonClickHandler,
resetImageRepository,
resetMaxVolumesPerNode,
resetControllerCount,
resetNodeSelectorLabel,
resetDriverNamespace,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,8 @@ csi-powerstore:
# - "--driverPodLabelValue=dell-storage"
# - "--ignoreVolumelessPods=false"

maxPowerstoreVolumesPerNode: $MAX_VOLUMES_PER_NODE

## K8S/CSI-PowerMax ATTRIBUTES
##########################################
csi-powermax:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down