mirror of
https://github.com/lucky-sideburn/kubeinvaders.git
synced 2026-08-23 21:46:21 +00:00
fixed show vm
This commit is contained in:
+1
-1
@@ -697,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-24 09:45:04</p>
|
||||
<p class="text-muted credit" style="color:#fff;">version: 2024-12-25 10:23:42</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
+21
-25
@@ -345,44 +345,40 @@ function deletePods(pod_name) {
|
||||
oReq.send();
|
||||
}
|
||||
|
||||
function addNodeAndVMstoPods() {
|
||||
if (chaos_vms && virtualMachines && virtualMachines.length > 0) {
|
||||
pods = pods.concat(virtualMachines);
|
||||
}
|
||||
|
||||
if (nodes && nodes.length > 0) {
|
||||
pods = pods.concat(nodes);
|
||||
}
|
||||
return pods;
|
||||
}
|
||||
|
||||
|
||||
|
||||
function getPods() {
|
||||
if (chaos_pods) {
|
||||
var oReq = new XMLHttpRequest();
|
||||
oReq.onload = function () {
|
||||
new_pods = JSON.parse(this.responseText)["items"];
|
||||
|
||||
let new_pods = JSON.parse(this.responseText)["items"];
|
||||
|
||||
// Pod might just be killed in game, but not terminated in k8s yet.
|
||||
for (i=0; i<new_pods.length; i++) {
|
||||
if (aliens.some((alien) => alien.name == new_pods[i].name && alien.status == "killed")) {
|
||||
new_pods[i].status = "killed";
|
||||
}
|
||||
}
|
||||
|
||||
if (chaos_vms && virtualMachines && virtualMachines.length > 0) {
|
||||
pods = new_pods.concat(virtualMachines);
|
||||
}
|
||||
|
||||
if (nodes && nodes.length > 0) {
|
||||
pods = new_pods.concat(nodes);
|
||||
}
|
||||
else {
|
||||
pods = new_pods;
|
||||
}
|
||||
|
||||
pods = new_pods;
|
||||
addNodeAndVMstoPods();
|
||||
};;
|
||||
oReq.open("GET", k8s_url + "/kube/pods?action=list&namespace=" + namespace);
|
||||
oReq.send();
|
||||
}
|
||||
else {
|
||||
if (nodes && nodes.length > 0) {
|
||||
pods = nodes;
|
||||
} else {
|
||||
pods = [];
|
||||
}
|
||||
|
||||
if (chaos_vms && virtualMachines && virtualMachines.length > 0) {
|
||||
pods = pods.concat(virtualMachines);
|
||||
}
|
||||
pods = [];
|
||||
addNodeAndVMstoPods();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -855,10 +851,10 @@ window.setInterval(function setAliens() {
|
||||
}, 1000)
|
||||
|
||||
window.setInterval(function backgroundTasks() {
|
||||
|
||||
console.log("Nodes:", nodes);
|
||||
console.log("Virtual Machines:", virtualMachines);
|
||||
console.log("chaos_vms flag:", chaos_vms);
|
||||
console.log("Pods:", pods);
|
||||
|
||||
|
||||
if (!codename_configured) {
|
||||
chaosProgram = $('#chaosProgramTextArea').val();
|
||||
|
||||
Reference in New Issue
Block a user