mirror of
https://github.com/lucky-sideburn/kubeinvaders.git
synced 2026-08-23 21:46:21 +00:00
start
This commit is contained in:
@@ -31,6 +31,7 @@ var programming_mode_buttons = document.getElementById("programming-mode-buttons
|
||||
var log_tail_switch = false;
|
||||
var log_tail_div = document.getElementById("logTailDiv");
|
||||
var log_tail_screen = document.getElementById("logTailScreen");
|
||||
var random_code = (Math.random() + 1).toString(36).substring(7);
|
||||
|
||||
// nodes list from kubernetes
|
||||
var nodes = [];
|
||||
@@ -143,7 +144,7 @@ function getChaosJobsLogs() {
|
||||
}
|
||||
}
|
||||
};;
|
||||
oReq.open("GET", "https://" + clu_endpoint + "/chaoslogs.html");
|
||||
oReq.open("GET", "https://" + clu_endpoint + "/chaoslogs" + random_code + ".html");
|
||||
oReq.send();
|
||||
}
|
||||
|
||||
@@ -193,7 +194,7 @@ function getCurrentChaosContainer() {
|
||||
|
||||
function enableLogTail() {
|
||||
var oReq = new XMLHttpRequest();
|
||||
oReq.open("POST", "https://" + clu_endpoint + "/kube/chaos/containers?action=enable_log_tail", true);
|
||||
oReq.open("POST", "https://" + clu_endpoint + "/kube/chaos/containers?action=enable_log_tail&id=" + random_code, true);
|
||||
oReq.onreadystatechange = function () {
|
||||
if (this.readyState === XMLHttpRequest.DONE && this.status === 200) {
|
||||
$('#alert_placeholder3').replaceWith(log_tail_alert + 'Logs tail started </div>');
|
||||
@@ -206,7 +207,7 @@ function enableLogTail() {
|
||||
|
||||
function disableLogTail() {
|
||||
var oReq = new XMLHttpRequest();
|
||||
oReq.open("POST", "https://" + clu_endpoint + "/kube/chaos/containers?action=disable_log_tail", true);
|
||||
oReq.open("POST", "https://" + clu_endpoint + "/kube/chaos/containers?action=disable_log_tail=id" + random_code, true);
|
||||
oReq.onreadystatechange = function () {
|
||||
if (this.readyState === XMLHttpRequest.DONE && this.status === 200) {
|
||||
$('#alert_placeholder3').replaceWith(log_tail_alert + 'Logs tail stopped </div>');
|
||||
|
||||
@@ -36,20 +36,20 @@ elseif ngx.var.request_method == "POST" and action == 'set' then
|
||||
|
||||
elseif ngx.var.request_method == "POST" and action == "set_log_regex" then
|
||||
local body_data = ngx.req.get_body_data()
|
||||
red:set("log_pod_regex", body_data)
|
||||
red:set("log_pod_regex:" .. arg['id'], body_data)
|
||||
os.execute("> /var/www/html/chaoslogs.html")
|
||||
ngx.say("New container definition has been saved in Redis => " .. body_data)
|
||||
return ngx.exit(ngx.status)
|
||||
|
||||
elseif ngx.var.request_method == "POST" and action == "enable_log_tail" then
|
||||
local body_data = ngx.req.get_body_data()
|
||||
red:set("logs_enabled", "1")
|
||||
red:set("logs_enabled:" .. arg['id'], "1")
|
||||
os.execute("> /var/www/html/chaoslogs.html")
|
||||
ngx.say("Enable Log Tail")
|
||||
return ngx.exit(ngx.status)
|
||||
|
||||
elseif ngx.var.request_method == "POST" and action == "disable_log_tail" then
|
||||
red:set("logs_enabled", "0")
|
||||
red:set("logs_enabled:" .. arg['id'], "0")
|
||||
os.execute("> /var/www/html/chaoslogs.html")
|
||||
ngx.say("Disable Log Tail")
|
||||
return ngx.exit(ngx.status)
|
||||
|
||||
Reference in New Issue
Block a user