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

Adding operator support for powerstore in wizard #710

Merged
merged 10 commits into from
Jul 18, 2023
11 changes: 6 additions & 5 deletions content/docs/deployment/csminstallationwizard/src/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,10 @@
<label for="installation-type" class="col-sm-2 col-form-label" data-bs-toggle="tooltip" data-bs-placement="right" title="Select the installation type" style="width: 140px;">Installation Type</label>
<div class="col-sm-9"></div>
<div class="col-sm-3">
<select id="installation-type" class="form-select" onchange="validateInput(validateForm, CONSTANTS)" required>
<select id="installation-type" class="form-select" onchange="validateInput(validateForm, CONSTANTS);onInstallationTypeChange()" required>
<option value="" selected> Select the Installation type</option>
<option value="helm">Helm</option>
<option value="operator" disabled>Operator</option>
<option value="operator">Operator</option>
</select>
</div>
</div>
Expand All @@ -68,7 +68,7 @@

<!-- main content starts -->
<div id="main">
<div class="was-validated row mb-4">
<div class="was-validated row mb-4 image-repository">
<label for="image-repository" class="col-sm-2 col-form-label" data-bs-toggle="tooltip" data-bs-placement="right" title="Specify the registry from where the image should be pulled" style="width: 150px;">Image Repository</label>
<div class="col-sm-9"></div>
<div class="col-sm-3">
Expand All @@ -86,6 +86,7 @@
<div class="col-sm-3">
<select id="csm-version" class="form-select" onchange="onCSMVersionChange(); validateInput(validateForm, CONSTANTS)" required>
<option value="1.7.0" selected>CSM 1.7</option>
<option value="1.8.0">CSM 1.8</option>
</select>
</div>
</div>
Expand Down Expand Up @@ -180,7 +181,7 @@
</div>
</div>

<div class="row mb-4">
<div class="row mb-4 resizer">
<div class="col-sm-12">
<input class="form-check-input" type="checkbox" id="resizer" value="" checked>
<label for="resizer" class="form-check-label ms-2 text-dark" data-bs-toggle="tooltip" data-bs-placement="right" title="Enable/Disable Volume Expansion feature">Resizer</label>
Expand Down Expand Up @@ -474,7 +475,7 @@
<div class="mt-3 mx-1">
<span id="command1"></span>
</div>
<div class="mt-3 mx-1">
<div class="mt-3 mx-1" id="command2-wrapper">
<span id="command2"></span>
</div>
<div class="mt-3 mx-1 py-2 note" id="reverseProxyNote">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@
*
*/
var commandTitle = 'Run the following commands to install';
var commandNote = 'Ensure that the namespaces and secrets are created before installing the helm chart';
var commandNote = 'Ensure that the namespaces and secrets are created before installing the driver';
var command1 = 'helm repo add dell https://dell.github.io/helm-charts';
var command2 = 'helm install $release-name dell/container-storage-modules -n $namespace --version $version -f values.yaml';

var command3 = 'kubectl create -f values.yaml';
var nodeSelectorNote = 'For the pod to be eligible to run on a node, the node must have the indicated key-value pair as label';

const snapshotNote = 'If Snapshot is enabled, ensure the Snapshot CRDs are installed';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ const CONSTANTS = {
TEMP_DIR: "templates",
TEMP_EXT: ".template",
HYPHEN: "-",
NODE_SELECTOR_TAB: '\n'.padEnd(7, " "),
SLASH: "/",
VERSIONS_DIR: "csm-versions",
CSM: "csm",
Expand All @@ -39,9 +38,14 @@ const CONSTANTS = {
HELM: "helm",
OPERATOR: "operator",
CSM_HELM_V170: "1.0.0",
TAINTS: `
HELM_TAINTS: `
- key: "$KEY"
operator: "Exists"
effect: "NoSchedule"
`,
OPERATOR_TAINTS: `
- key: "$KEY"
operator: "Exists"
effect: "NoSchedule"
`
};
Original file line number Diff line number Diff line change
Expand Up @@ -47,21 +47,31 @@ function setValues(csmMapValues, CONSTANTS_PARAM) {
DriverValues.volNamePrefix = document.getElementById("vol-name-prefix").value;
DriverValues.snapNamePrefix = document.getElementById("snapshot-prefix").value;
DriverValues.fsGroupPolicy = document.getElementById("fsGroup-Policy").value;
DriverValues.driverNamespace = document.getElementById("driver-namespace").value;
DriverValues.installationType = document.getElementById("installation-type").value;
DriverValues.controllerPodsNodeSelector = $("#controller-pods-node-selector").prop('checked') ? true : "";
DriverValues.nodePodsNodeSelector = $("#node-pods-node-selector").prop('checked') ? true : "";
DriverValues.nodeSelectorLabel = document.getElementById("node-selector-label").value || '""';
var taint = document.getElementById("taint").value || '""';
var labels = DriverValues.nodeSelectorLabel.split(":");
var nodeSelector = CONSTANTS_PARAM.NODE_SELECTOR_TAB + labels[0] + ': "' + labels[1] + '"';
var nodeSelector
var taints
if (DriverValues.installationType === CONSTANTS_PARAM.OPERATOR) {
nodeSelector = '\n'.padEnd(8, " ") + labels[0] + ': "' + labels[1] + '"';
taints = CONSTANTS_PARAM.OPERATOR_TAINTS.replace("$KEY", taint).trimEnd();
} else {
nodeSelector = '\n'.padEnd(7, " ") + labels[0] + ': "' + labels[1] + '"';
taints = CONSTANTS_PARAM.HELM_TAINTS.replace("$KEY", taint).trimEnd();
}
DriverValues.controllerTolerations = "";
DriverValues.nodeTolerations= "";
if ($("#controller-pods-node-selector").prop('checked') === true) {
DriverValues.controllerPodsNodeSelector = nodeSelector;
DriverValues.controllerTolerations = CONSTANTS_PARAM.TAINTS.replace("$KEY", taint).trimEnd();
DriverValues.controllerTolerations = taints;
}
if ($("#node-pods-node-selector").prop('checked') === true) {
DriverValues.nodePodsNodeSelector = nodeSelector;
DriverValues.nodeTolerations = CONSTANTS_PARAM.TAINTS.replace("$KEY", taint).trimEnd();
DriverValues.nodeTolerations = taints;
}
DriverValues.snapshot = $("#snapshot").prop('checked') ? true : false;
DriverValues.vgsnapshot = $("#vgsnapshot").prop('checked') ? true : false;
Expand Down Expand Up @@ -101,6 +111,8 @@ function createYamlString(yamlTpl, yamlTplValues, driverParam, CONSTANTS_PARAM)
yamlTpl = yamlTpl.replaceAll("$VOLUME_NAME_PREFIX", yamlTplValues.volNamePrefix);
yamlTpl = yamlTpl.replaceAll("$SNAP_NAME_PREFIX", yamlTplValues.snapNamePrefix);
yamlTpl = yamlTpl.replaceAll("$FSGROUP_POLICY", yamlTplValues.fsGroupPolicy);
yamlTpl = yamlTpl.replaceAll("$NAMESPACE", yamlTplValues.driverNamespace);
yamlTpl = yamlTpl.replaceAll("$INSTALLATIONTYPE", yamlTplValues.installationType);
yamlTpl = yamlTpl.replaceAll("$CONTROLLER_POD_NODE_SELECTOR", yamlTplValues.controllerPodsNodeSelector);
yamlTpl = yamlTpl.replaceAll("$NODE_POD_NODE_SELECTOR", yamlTplValues.nodePodsNodeSelector);
yamlTpl = yamlTpl.replaceAll("$HEALTH_MONITOR_ENABLED", yamlTplValues.healthMonitor);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ const CONSTANTS = {
TEMP_DIR: "templates",
TEMP_EXT: ".template",
HYPHEN: "-",
NODE_SELECTOR_TAB: '\n'.padEnd(7, " "),
SLASH: "/",
VERSIONS_DIR: "csm-versions",
CSM: "csm",
Expand All @@ -44,10 +43,15 @@ const CONSTANTS = {
HELM: "helm",
OPERATOR: "operator",
CSM_HELM_V170: "1.0.0",
TAINTS: `
HELM_TAINTS: `
- key: "$KEY"
operator: "Exists"
effect: "NoSchedule"
`,
OPERATOR_TAINTS: `
- key: "$KEY"
operator: "Exists"
effect: "NoSchedule"
`,
COMMENTED_TAINTS: `
#- key: "node-role.kubernetes.io/control-plane"
Expand All @@ -57,27 +61,30 @@ const CONSTANTS = {
};

const testCSMMap = new Map([
["csmVersion", "1.6.0"],
["csmVersion", "1.7.0"],
["imageRepository", "dellemc"],
["controllerCount", "1"],
["volNamePrefix", "csivol"],
["snapNamePrefix", "csi-snap"],
["nodeSelectorLabel", "node-role.kubernetes.io/control-plane:"],
["driverVersion", "v2.6.0"],
["driverVersion", "v2.7.0"],
]);

describe("GIVEN setValues function", () => {
test("SHOULD return expected DriverValues", () => {
test("SHOULD return expected DriverValues for Helm", () => {
document.body.innerHTML = `
<select id="csm-version">
<option value="1.6.0">CSM 1.6</option>
<option value="1.7.0">CSM 1.7</option>
</select>
<select id="installation-type">
<option value="helm" selected>Helm</option>
</select>
<select id="fsGroup-Policy">
<option value="ReadWriteOnceWithFSType">Select the FSGroupPolicy type</option>
</select>
<input type="text" id="image-repository" value="dellemc">
<input type="number" id="cert-secret-count" value="0">
<input type="number" id="controller-count" value="2">
<input type="number" id="cert-secret-count" value="1">
<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">
<input type="text" id="node-selector-label" value="node-role.kubernetes.io/control-plane:">
Expand All @@ -89,39 +96,143 @@ describe("GIVEN setValues function", () => {
`;

const expected = {
csmVersion: "1.6.0",
driverVersion: "v2.6.0",
imageRepository: "dellemc",
certSecretCount: "0",
controllerCount: "1",
volNamePrefix: "csivol",
snapNamePrefix: "csi-snap",
csmVersion: '1.7.0',
driverVersion: 'v2.7.0',
imageRepository: 'dellemc',
monitor: false,
certSecretCount: '1',
controllerCount: '1',
volNamePrefix: 'csivol',
snapNamePrefix: 'csi-snap',
fsGroupPolicy: 'ReadWriteOnceWithFSType',
driverNamespace: '',
installationType: 'helm',
controllerPodsNodeSelector: '\n node-role.kubernetes.io/control-plane: ""',
nodePodsNodeSelector: '\n node-role.kubernetes.io/control-plane: ""',
nodeSelectorLabel: "node-role.kubernetes.io/control-plane:",
snapshot: true,
nodeSelectorLabel: 'node-role.kubernetes.io/control-plane:',
controllerTolerations: '\n' +
' - key: "node-role.kubernetes.io/control-plane"\n' +
' operator: "Exists"\n' +
' effect: "NoSchedule"',
nodeTolerations: '\n' +
' - key: "node-role.kubernetes.io/control-plane"\n' +
' operator: "Exists"\n' +
' effect: "NoSchedule"',
snapshot: false,
vgsnapshot: false,
resizer: true,
resizer: false,
healthMonitor: false,
replication: false,
migration: false,
observability: false,
observabilityMetrics: false,
authorization: false,
authorizationSkipCertValidation: true,
resiliency: false,
storageCapacity: false,
authorizationSkipCertValidation: false,
authorizationProxyHost: '""',
certManagerEnabled: false,
taint: "node-role.kubernetes.io/control-plane"
storageArrayId: undefined,
storageArrayEndpointUrl: '""',
storageArrayBackupEndpointUrl: '""',
clusterPrefix: undefined,
portGroups: undefined,
vSphereEnabled: false,
vSphereFCPortGroup: undefined,
vSphereFCHostName: undefined,
vSphereVCenterHost: undefined,
vSphereVCenterCredSecret: undefined
};

const received = setValues(testCSMMap, CONSTANTS);
expect(expected).toEqual(received);
});

expect(received).toEqual(received);
test("SHOULD return expected DriverValues for Operator", () => {
document.body.innerHTML = `
<select id="csm-version">
<option value="1.7.0">CSM 1.7</option>
</select>
<select id="installation-type">
<option value="operator" selected>Operator</option>
</select>
<select id="fsGroup-Policy">
<option value="ReadWriteOnceWithFSType">Select the FSGroupPolicy type</option>
</select>
<input type="text" id="image-repository" value="dellemc">
<input type="number" id="cert-secret-count" value="1">
<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">
<input type="text" id="node-selector-label" value="node-role.kubernetes.io/control-plane:">
<input type="checkbox" id="controller-pods-node-selector" checked>
<input type="checkbox" id="node-pods-node-selector" checked>
<input type="text" id="driver-namespace" value="">
<input type="text" id="authorization-proxy-host" value="">
<input type="text" id="taint" value="node-role.kubernetes.io/control-plane">
`;

const expected = {
csmVersion: '1.7.0',
driverVersion: 'v2.7.0',
imageRepository: 'dellemc',
monitor: false,
certSecretCount: '1',
controllerCount: '1',
volNamePrefix: 'csivol',
snapNamePrefix: 'csi-snap',
fsGroupPolicy: 'ReadWriteOnceWithFSType',
driverNamespace: '',
installationType: 'operator',
controllerPodsNodeSelector: '\n node-role.kubernetes.io/control-plane: ""',
nodePodsNodeSelector: '\n node-role.kubernetes.io/control-plane: ""',
nodeSelectorLabel: 'node-role.kubernetes.io/control-plane:',
controllerTolerations: '\n' +
' - key: "node-role.kubernetes.io/control-plane"\n' +
' operator: "Exists"\n' +
' effect: "NoSchedule"',
nodeTolerations: '\n' +
' - key: "node-role.kubernetes.io/control-plane"\n' +
' operator: "Exists"\n' +
' effect: "NoSchedule"',
snapshot: false,
vgsnapshot: false,
resizer: false,
healthMonitor: false,
replication: false,
migration: false,
observability: false,
observabilityMetrics: false,
authorization: false,
resiliency: false,
storageCapacity: false,
authorizationSkipCertValidation: false,
authorizationProxyHost: '""',
certManagerEnabled: false,
storageArrayId: undefined,
storageArrayEndpointUrl: '""',
storageArrayBackupEndpointUrl: '""',
clusterPrefix: undefined,
portGroups: undefined,
vSphereEnabled: false,
vSphereFCPortGroup: undefined,
vSphereFCHostName: undefined,
vSphereVCenterHost: undefined,
vSphereVCenterCredSecret: undefined
};

const received = setValues(testCSMMap, CONSTANTS);
expect(expected).toEqual(received);
});

test("SHOULD return expected DriverValues for csm version 1.6.0", () => {
document.body.innerHTML = `
<select id="csm-version">
<option value="1.6.0">CSM 1.6</option>
</select>
<select id="installation-type">
<option value="operator" selected>Operator</option>
</select>
<select id="fsGroup-Policy">
<option value="ReadWriteOnceWithFSType">Select the FSGroupPolicy type</option>
</select>
Expand All @@ -139,6 +250,7 @@ describe("GIVEN setValues function", () => {
`;

const expected = {
installationType: "operator",
csmVersion: "1.6.0",
driverVersion: "v2.6.0",
imageRepository: "dellemc",
Expand All @@ -163,7 +275,6 @@ describe("GIVEN setValues function", () => {
};

const received = setValues(testCSMMap, CONSTANTS);

expect(received).toEqual(received);
});
});
Expand Down
Loading