kubevirt integration

This commit is contained in:
luckysideburn
2024-12-24 09:45:36 +00:00
parent df8b0a9049
commit b073184fc6
3 changed files with 22 additions and 24 deletions

View File

@@ -650,11 +650,12 @@ k8s_jobs:
<label for="httpElapsedChart">HTTP Elapsed (seconds)</label>
<div id="httpElapsedChart" style="width: 100%; height: 50%; margin-top: 0.5%;"></div>
</div>
<div class="row" style="margin-top: 2%; text-align: center; margin: auto; margin-top: 1%;">
<div id="alert_placeholder" style="margin-top: 3%;"></div>
</div>
<div class="row" style="margin-top: 2%; text-align: center; margin: auto; margin-top: 1%;">
<canvas id="myCanvas" width="1200" height="800" class="game-canvas"></canvas>
</div>
<div class="row">
<div class="col text-center">
</div>
@@ -670,7 +671,7 @@ k8s_jobs:
<!-- HELPER ALERT -->
<div class="row">
<div id="alert_placeholder" style="margin-top: 3%;"></div>
<!-- <div id="alert_placeholder" style="margin-top: 3%;"></div> -->
<div id="alert_placeholder3" style="margin-top: 3%;"></div>
</div>
<div class="settings">
@@ -696,7 +697,7 @@ k8s_jobs:
<div class="container text-center" style="margin-top: 20%;">
<div>
<img style="scale: 60%" src="images/kubeinvaders_spaceship2.png" id="spaceShip">
<p class="text-muted credit" style="color:#fff;">version: 2024-12-22 18:48:13</p>
<p class="text-muted credit" style="color:#fff;">version: 2024-12-24 09:45:04</p>
</div>
</div>
</div>

View File

@@ -99,7 +99,7 @@ function chaosReportHttpEndpointAdd() {
<div class="row" style="margin-top: 2%;">
<div class="col col-xl-10">
<label for="chaosReportCheckSiteURL">URL</label>
<label for="chaosReportCheckSiteURL">URL (insert manually if it is not an ingress)</label>
<input type="text" class="form-control input-lg" id="chaosReportCheckSiteURL" value="" style="margin-top: 1%; width: 80%;">
</div>
</div>

View File

@@ -378,7 +378,11 @@ function getPods() {
pods = nodes;
} else {
pods = [];
}
}
if (chaos_vms && virtualMachines && virtualMachines.length > 0) {
pods = pods.concat(virtualMachines);
}
}
}
@@ -402,23 +406,12 @@ function getVMs() {
var oReq = new XMLHttpRequest();
oReq.onload = function () {
const jsonData = JSON.parse(this.responseText);
// const vmList = {
// items: [
// // { name: "node1", status: "ready" } // Primo elemento
// ]
// };
virtualMachines = [];
Array.from(jsonData.items).forEach(vm => {
const name = vm.metadata.name; // Nome della VM
const status = vm.status.printableStatus; // Stato della VM
virtualMachines.push({ name: name, status: status });
});
console.log("Mappa delle VM e dei loro stati:");
vmList.items.forEach(vm => {
console.log(`Nome: ${vm.name}, Stato: ${vm.status}`);
});
};;
oReq.open("GET", k8s_url + "/kube/vm?namespace=" + namespace);
oReq.send();
@@ -547,12 +540,12 @@ function drawAlien(alienX, alienY, name, status) {
ctx.drawImage(image, alienX, alienY, 30, 40);
ctx.fillText(name.substring(0, 10) + '..', alienX, alienY + 50);
}
// else if (virtualMachines.some((vm) => vm.name == name)) {
// image.src = './images/k8s_node.png';
// ctx.font = '10px pixel';
// ctx.drawImage(image, alienX, alienY, 30, 40);
// ctx.fillText(name.substring(0, 10) + '..', alienX, alienY + 50);
// }
else if (virtualMachines.some((vm) => vm.name == name)) {
image.src = './images/k8s_node.png';
ctx.font = '10px pixel';
ctx.drawImage(image, alienX, alienY, 30, 40);
ctx.fillText(name.substring(0, 10) + '..', alienX, alienY + 50);
}
else {
image.src = `./images/sprite_invader_${status}.png`;
ctx.font = '8px pixel';
@@ -863,6 +856,10 @@ window.setInterval(function setAliens() {
window.setInterval(function backgroundTasks() {
console.log("Virtual Machines:", virtualMachines);
console.log("Pods:", pods);
if (!codename_configured) {
chaosProgram = $('#chaosProgramTextArea').val();
chaosProgramWithCodename = chaosProgram.replace(codename_regex, "chaos-codename: " + codename);