Skip to content

Commit

Permalink
SwanSpawner: Restrict spark clusters to different platforms
Browse files Browse the repository at this point in the history
This is a temporary change to restrict certain spark clusters to users,
based on the platform chosen by the user, while the migration to alma9
is not completed.

The analytix cluster will only be available for the CentOS7 platform and
the K8s and QA clusters will only be available for the AlmaLinux9.

It will be reverted once the analytix cluster is fully migrated to alma9
thus completing the migration of all spark clusters to that
distribution.
  • Loading branch information
PMax5 authored and etejedor committed May 29, 2024
1 parent 61b63d0 commit 5b05f51
Showing 1 changed file with 27 additions and 6 deletions.
33 changes: 27 additions & 6 deletions SwanSpawner/swanspawner/templates/options_form_template.html
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,10 @@
for( var i = 0 ; i < lcgData.clusters.length ; i++ ){
var lcgCluster = lcgData.clusters[i];

if (lcgCluster.value === "k8s" && lcgCluster.value === "hadoop-qa") {
continue;
}

var selectClusterOption = document.createElement("option");
selectClusterOption.value = lcgCluster.value;
selectClusterOption.text = lcgCluster.text;
Expand Down Expand Up @@ -177,19 +181,36 @@
*/
function adjust_spark() {
var platformOptions = document.getElementById('platformOptions');
var clusterOptions = document.getElementById('clusterOptions');

function removeCluster(cluster) {
var clusterOptions = document.getElementById('clusterOptions');
for (var i = 0; i < clusterOptions.options.length; i++) {
if (clusterOptions.options[i].value === cluster) {
clusterOptions.remove(i);
break;
}
}
}

function addCluster(clusterValue, clusterName) {
var selectClusterOption = document.createElement("option");
selectClusterOption.value = clusterValue;
selectClusterOption.text = clusterName;
clusterOptions.add(selectClusterOption);
}

var isAlma = platformOptions.selectedOptions[0].text.startsWith('AlmaLinux 9');

if (isAlma) {
// Disable Spark cluster selection, since Spark is still not supported
// on Alma9
clusterOptions.setAttribute('disabled', '');
clusterOptions.selectedIndex = 0;
removeCluster("analytix")
addCluster("k8s", "Cloud Containers (K8s)")
addCluster("hadoop-qa", "QA")
}
else {
// On CentOS7, make sure cluster selection is enabled
clusterOptions.removeAttribute('disabled');
addCluster("analytix", "General Purpose (Analytix)")
removeCluster("k8s")
removeCluster("hadoop-qa")
}
}

Expand Down

0 comments on commit 5b05f51

Please sign in to comment.