mirror of
https://github.com/lucky-sideburn/kubeinvaders.git
synced 2026-02-14 17:50:00 +00:00
rebooting vms form k-inv ok
This commit is contained in:
@@ -51,6 +51,7 @@ COPY scripts/metrics.lua /usr/local/openresty/nginx/conf/kubeinvaders/metrics.lu
|
||||
COPY scripts/pod.lua /usr/local/openresty/nginx/conf/kubeinvaders/pod.lua
|
||||
COPY scripts/ingress.lua /usr/local/openresty/nginx/conf/kubeinvaders/ingress.lua
|
||||
COPY scripts/vm.lua /usr/local/openresty/nginx/conf/kubeinvaders/vm.lua
|
||||
COPY scripts/vm_reboot.lua /usr/local/openresty/nginx/conf/kubeinvaders/vm_reboot.lua
|
||||
COPY scripts/node.lua /usr/local/openresty/nginx/conf/kubeinvaders/node.lua
|
||||
COPY scripts/kube-linter.lua /usr/local/openresty/nginx/conf/kubeinvaders/kube-linter.lua
|
||||
COPY scripts/chaos-node.lua /usr/local/openresty/nginx/conf/kubeinvaders/chaos-node.lua
|
||||
|
||||
@@ -650,6 +650,50 @@ 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">
|
||||
<!-- Pods Section -->
|
||||
<div class="col-md-6">
|
||||
<h4>Pods status</h4>
|
||||
<ul class="list-group">
|
||||
<li class="list-group-item d-flex align-items-center">
|
||||
<img src="./images/sprite_invader_ready.png" alt="Pod Ready" class="me-3" style="width: 20px; height: 20px;">
|
||||
ready
|
||||
</li>
|
||||
<li class="list-group-item d-flex align-items-center">
|
||||
<img src="./images/sprite_invader_pending.png" alt="Pod Pending" class="me-3" style="width: 20px; height: 20px;">
|
||||
pending
|
||||
</li>
|
||||
<li class="list-group-item d-flex align-items-center">
|
||||
<img src="./images/sprite_invader_killed.png" alt="Pod Killed" class="me-3" style="width: 20px; height: 20px;">
|
||||
killed
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<!-- Virtual Machines Section -->
|
||||
<div class="col-md-6">
|
||||
<h5>Virtual Machines Status</h5>
|
||||
<ul class="list-group">
|
||||
<li class="list-group-item d-flex align-items-center">
|
||||
<img src="./images/sprite_invader_vm_running.png" alt="VM Running" class="me-3" style="width: 20px; height: 20px;">
|
||||
running
|
||||
</li>
|
||||
<li class="list-group-item d-flex align-items-center">
|
||||
<img src="./images/sprite_invader_vm_starting.png" alt="VM Starting" class="me-3" style="width: 20px; height: 20px;">
|
||||
restarting
|
||||
</li>
|
||||
<li class="list-group-item d-flex align-items-center">
|
||||
<img src="./images/sprite_invader_vm_stopped.png" alt="VM Stopped" class="me-3" style="width: 20px; height: 20px;">
|
||||
stopped
|
||||
</li>
|
||||
<li class="list-group-item d-flex align-items-center">
|
||||
<img src="./images/sprite_invader_vm_failed.png" alt="VM Failed" class="me-3" style="width: 20px; height: 20px;">
|
||||
failed
|
||||
</li>
|
||||
</ul>
|
||||
</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>
|
||||
@@ -697,7 +741,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-29 17:50:52</p>
|
||||
<p class="text-muted credit" style="color:#fff;">version: 2024-12-30 08:58:24</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -342,7 +342,7 @@ function rebootVirtualMachine(vm_name) {
|
||||
$('#alert_placeholder').replaceWith(alert_div + 'Latest action: Prepareing reboot virtual machine ' + vm_name + '</div>');
|
||||
};;
|
||||
$('#alert_placeholder').replaceWith(alert_div + 'Latest action: Reboot virtual machine ' + vm_name + '</div>');
|
||||
oReq.open("GET", k8s_url + "/kube/chaos/vm_reboot?vm_name=" + vm_name + "&namespace=" + namespace);
|
||||
oReq.open("GET", k8s_url + "/kube/vm_reboot?vm_name=" + vm_name + "&namespace=" + namespace);
|
||||
oReq.send();
|
||||
}
|
||||
|
||||
@@ -742,8 +742,9 @@ window.setInterval(function draw() {
|
||||
ctx.fillText('h => Activate or deactivate help', 10, 280);
|
||||
ctx.fillText('s => Activate or deactivate shuffle for aliens', 10, 300);
|
||||
ctx.fillText('n => Change namespace', 10, 320);
|
||||
ctx.fillText('p => Activate or deactivate chaos engineering against pods', 10, 340);
|
||||
ctx.fillText('c => Activate or deactivate chaos engineering against nodes', 10, 360);
|
||||
ctx.fillText('p => Activate or deactivate chaos engineering on pods', 10, 340);
|
||||
ctx.fillText('c => Activate or deactivate chaos engineering on nodes', 10, 360);
|
||||
ctx.fillText('v => Activate or deactivate chaos engineering on virtual machines (kubevirt)', 10, 380);
|
||||
}
|
||||
}, 10)
|
||||
|
||||
|
||||
@@ -49,6 +49,10 @@ function startGameMode() {
|
||||
chaos_program_screen.style.display = "none";
|
||||
programming_mode_buttons.style.display = "none";
|
||||
resizeCharts();
|
||||
let canvasElement = document.getElementById("myCanvas");
|
||||
if (canvasElement) {
|
||||
canvasElement.scrollIntoView({ behavior: "smooth", block: "start" });
|
||||
}
|
||||
}
|
||||
|
||||
function startProgrammingMode() {
|
||||
|
||||
@@ -70,6 +70,10 @@ server {
|
||||
access_by_lua_file "/usr/local/openresty/nginx/conf/kubeinvaders/vm.lua";
|
||||
}
|
||||
|
||||
location /kube/vm_reboot {
|
||||
access_by_lua_file "/usr/local/openresty/nginx/conf/kubeinvaders/vm_reboot.lua";
|
||||
}
|
||||
|
||||
location /kube/chaos/programming_mode {
|
||||
access_by_lua_file "/usr/local/openresty/nginx/conf/kubeinvaders/programming_mode.lua";
|
||||
}
|
||||
|
||||
@@ -16,7 +16,8 @@ local token = os.getenv("TOKEN")
|
||||
local arg = ngx.req.get_uri_args()
|
||||
local namespace = arg["namespace"]
|
||||
local vm_name = arg["vm_name"]
|
||||
local url = k8s_url .. "/apis/kubevirt.io/v1/namespaces/" .. namespace .. "/virtualmachines/" .. vm_name .. "/restart"
|
||||
local url = k8s_url .. "/apis/subresources.kubevirt.io/v1/namespaces/" .. namespace .. "/virtualmachines/" .. vm_name .. "/restart"
|
||||
|
||||
local decoded = nil
|
||||
|
||||
ngx.header['Access-Control-Allow-Origin'] = '*'
|
||||
@@ -30,10 +31,10 @@ local httpc = http.new()
|
||||
|
||||
-- Esegui la richiesta
|
||||
local res, err = httpc:request_uri(url, {
|
||||
method = "GET",
|
||||
method = "PUT",
|
||||
ssl_verify = false, -- TODO: use a valid certificate
|
||||
headers = {
|
||||
["Accept"] = "application/json",
|
||||
["Accept"] = "*/*",
|
||||
["Content-Type"] = "application/json",
|
||||
["Authorization"] = "Bearer " .. token
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user