mirror of
https://github.com/lucky-sideburn/kubeinvaders.git
synced 2026-04-29 05:16:44 +00:00
start support for kubevirt
This commit is contained in:
@@ -152,10 +152,10 @@
|
||||
</div>
|
||||
|
||||
<div class="sidebar" id="sidebar">
|
||||
<a id="gameModeButton" onclick="startGameMode()">Game Mode</a>
|
||||
<a id="programmingModeButton" onclick="startProgrammingMode()">Programming Mode</a>
|
||||
<a href="#" onclick="showSetCurrentChaosContainer()">Chaos Container Editor</a>
|
||||
<a href="#" onclick="showSpecialKeys()">Show Special Keys</a>
|
||||
<a id="gameModeButton" onclick="startGameMode()" style="font-family: pixel;">Game Mode</a>
|
||||
<a id="programmingModeButton" onclick="startProgrammingMode()" style="font-family: pixel;">Programming Mode</a>
|
||||
<a href="#" onclick="showSetCurrentChaosContainer()" style="font-family: pixel;">Chaos Container Editor</a>
|
||||
<a href="#" onclick="showSpecialKeys()" style="font-family: pixel;">Show Special Keys</a>
|
||||
</div>
|
||||
|
||||
<!-- Main content -->
|
||||
@@ -445,12 +445,12 @@ Using YAML programming, you can define your own chaos engineering experiments an
|
||||
<div class="accordion" id="specialkeys" style="margin-top: 2%; margin-bottom: 2%;">
|
||||
<div class="accordion-item">
|
||||
<h2 class="accordion-header" id="specialkeys-headingThree">
|
||||
<button class="accordion-button collapsed" type="button" data-bs-toggle="collapse" data-bs-target="#specialkeys-collapseThree" aria-expanded="false" aria-controls="collapseThree">
|
||||
<button class="accordion-button collapsed" type="button" data-bs-toggle="collapse" data-bs-target="#specialkeys-collapseThree" aria-expanded="false" aria-controls="collapseThree" style="font-size: small; font-family: pixel;">
|
||||
show keys and options
|
||||
</button>
|
||||
</h2>
|
||||
<div id="specialkeys-collapseThree" class="accordion-collapse collapse" aria-labelledby="headingThree" data-bs-parent="#accordionExample">
|
||||
<div class="accordion-body" style="font-weight: normal; font-size: small;">
|
||||
<div class="accordion-body" style="font-weight: normal; font-size: small; font-family: pixel;">
|
||||
h => Activate or deactivate help<br>
|
||||
s => Activate or deactivate shuffle for aliens<br>
|
||||
n => Change namespace<br>
|
||||
@@ -694,7 +694,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: v1.9.7</p>
|
||||
<p class="text-muted credit" style="color:#fff;">version: 2024-12-22 11:38:01</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -62,7 +62,7 @@ function getIngressLists() {
|
||||
parseIngressListJSON(JSON.parse(this.responseText));
|
||||
}
|
||||
};;
|
||||
oReq.open("GET", k8s_url + "/kube/ingress/get?namespace=" + namespace, true);
|
||||
oReq.open("GET", k8s_url + "/kube/ingresses?namespace=" + namespace, true);
|
||||
oReq.setRequestHeader("Content-Type", "application/json");
|
||||
oReq.send();
|
||||
}
|
||||
|
||||
@@ -70,6 +70,7 @@ var spaceshipxOld = 0;
|
||||
var randomFactor = 10;
|
||||
// pods list from kubernetes
|
||||
var pods = [];
|
||||
var virtualMachines = [];
|
||||
var game_mode_switch = false;
|
||||
var programming_mode_switch = false;
|
||||
var chaos_program_valid = false;
|
||||
|
||||
@@ -360,7 +360,15 @@ function getPods() {
|
||||
|
||||
if (nodes && nodes.length > 0) {
|
||||
pods = new_pods.concat(nodes);
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
pods = new_pods;
|
||||
}
|
||||
|
||||
if (nodes && virtualMachines.length > 0) {
|
||||
pods = new_pods.concat(virtualMachines);
|
||||
}
|
||||
else {
|
||||
pods = new_pods;
|
||||
}
|
||||
};;
|
||||
@@ -391,10 +399,42 @@ function getNodes() {
|
||||
}
|
||||
}
|
||||
|
||||
function getVMs() {
|
||||
if (chaos_nodes) {
|
||||
var oReq = new XMLHttpRequest();
|
||||
oReq.onload = function () {
|
||||
const jsonData = JSON.parse(this.responseText);
|
||||
|
||||
const vmList = {
|
||||
items: [
|
||||
// { name: "node1", status: "ready" } // Primo elemento
|
||||
]
|
||||
};
|
||||
|
||||
Array.from(jsonData.items).forEach(vm => {
|
||||
const name = vm.metadata.name; // Nome della VM
|
||||
const status = vm.status.printableStatus; // Stato della VM
|
||||
vmList.items.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();
|
||||
}
|
||||
else {
|
||||
virtualMachines = [];
|
||||
}
|
||||
}
|
||||
|
||||
window.setInterval(function getKubeItems() {
|
||||
if (game_mode_switch) {
|
||||
getNodes();
|
||||
getPods();
|
||||
getVMs();
|
||||
}
|
||||
}, 500)
|
||||
|
||||
@@ -486,7 +526,15 @@ function drawAlien(alienX, alienY, name, status) {
|
||||
var image = new Image(); // Image constructor
|
||||
if (nodes.some((node) => node.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`;
|
||||
|
||||
Reference in New Issue
Block a user