mirror of
https://github.com/lucky-sideburn/kubeinvaders.git
synced 2026-08-23 21:46:21 +00:00
fix
This commit is contained in:
+24
-20
@@ -167,7 +167,7 @@
|
||||
<label for="presetLangText">Programing Language</label>
|
||||
<input type="text" id="presetLang" value="Python3" readonly="true" style="margin-bottom: 1%;">
|
||||
|
||||
<textarea class="form-control" id="currentLoadTest" rows="20" style="color: #161616; font-weight: bold; font-family: 'Courier New', Courier, monospace;"></textarea>
|
||||
<textarea class="form-control" id="currentLoadTest" rows="20" style="color: #161616; font-family: 'Courier New', Courier, monospace;"></textarea>
|
||||
|
||||
</div>
|
||||
<div class="form-group">
|
||||
@@ -285,24 +285,26 @@
|
||||
<span style="color: #000000">Latest Replicas State Delay: <span id="latest_fewer_replicas_seconds" style="color: #8f00bb">0</span><font color="#4f4f4f"> sec</font> </span>
|
||||
|
||||
</div>
|
||||
<div class="custom-btn-group">
|
||||
<div class="row">
|
||||
<div class="">
|
||||
<div class="row" style="margin-top: 2%;">
|
||||
<font size="2">Load Testing Presets</font>
|
||||
</div>
|
||||
<div class="btn-group" id="loadButtonGroup" role="group" aria-label="Basic example" style="overflow-x: scroll; width: 680px; padding-bottom: 2%; padding-top: 2%; scrollbar-color: dark;">
|
||||
<button type="button" id="loadConsul" class="btn btn-light btn-sm" onclick="loadPreset('consul', 'python')">Consul</button>
|
||||
<button type="button" id="loadElasticsearch" class="btn btn-light btn-sm" onclick="loadPreset('elasticsearch', 'python')">Elasticsearch</button>
|
||||
<button type="button" id="loadEtcd3" class="btn btn-light btn-sm" onclick="loadPreset('etcd3', 'python')">Etcd3</button>
|
||||
<button type="button" id="loadHttp" class="btn btn-light btn-sm" onclick="loadPreset('http', 'python')">Http</button>
|
||||
<button type="button" id="loadJira" class="btn btn-light btn-sm" onclick="loadPreset('jira', 'python')">Jira</button>
|
||||
<button type="button" id="loadKafka" class="btn btn-light btn-sm" onclick="loadPreset('kafka', 'python')">Kafka</button>
|
||||
<button type="button" id="loadKubernetes" class="btn btn-light btn-sm" onclick="loadPreset('kubernetes', 'python')">Kubernetes</button>
|
||||
<button type="button" id="loadMongodb" class="btn btn-light btn-sm" onclick="loadPreset('mongodb', 'python')">Mongodb</button>
|
||||
<button type="button" id="loadMysql" class="btn btn-light btn-sm" onclick="loadPreset('mysql', 'python')">Mysql</button>
|
||||
<button type="button" id="loadNomad" class="btn btn-light btn-sm" onclick="loadPreset('nomad', 'python')">Nomad</button>
|
||||
<button type="button" id="loadPostgresql" class="btn btn-light btn-sm" onclick="loadPreset('postgresql', 'python')">Postgresql</button>
|
||||
<button type="button" id="loadPrometheus" class="btn btn-light btn-sm" onclick="loadPreset('prometheus', 'python')">Prometheus</button>
|
||||
<button type="button" id="loadVault" class="btn btn-light btn-sm" onclick="loadPreset('vault', 'python')">Vault</button>
|
||||
<div class="row">
|
||||
<div class="btn-group" id="loadButtonGroup" role="group" aria-label="Basic example" style="overflow-x: scroll; width: 100%; padding-bottom: 2%; padding-top: 2%; scrollbar-color: dark;">
|
||||
<button type="button" id="loadConsul" class="btn btn-light btn-sm" onclick="loadPreset('consul', 'python')">Consul</button>
|
||||
<button type="button" id="loadElasticsearch" class="btn btn-light btn-sm" onclick="loadPreset('elasticsearch', 'python')">Elasticsearch</button>
|
||||
<button type="button" id="loadEtcd3" class="btn btn-light btn-sm" onclick="loadPreset('etcd3', 'python')">Etcd3</button>
|
||||
<button type="button" id="loadHttp" class="btn btn-light btn-sm" onclick="loadPreset('http', 'python')">Http</button>
|
||||
<button type="button" id="loadJira" class="btn btn-light btn-sm" onclick="loadPreset('jira', 'python')">Jira</button>
|
||||
<button type="button" id="loadKafka" class="btn btn-light btn-sm" onclick="loadPreset('kafka', 'python')">Kafka</button>
|
||||
<button type="button" id="loadKubernetes" class="btn btn-light btn-sm" onclick="loadPreset('kubernetes', 'python')">Kubernetes</button>
|
||||
<button type="button" id="loadMongodb" class="btn btn-light btn-sm" onclick="loadPreset('mongodb', 'python')">Mongodb</button>
|
||||
<button type="button" id="loadMysql" class="btn btn-light btn-sm" onclick="loadPreset('mysql', 'python')">Mysql</button>
|
||||
<button type="button" id="loadNomad" class="btn btn-light btn-sm" onclick="loadPreset('nomad', 'python')">Nomad</button>
|
||||
<button type="button" id="loadPostgresql" class="btn btn-light btn-sm" onclick="loadPreset('postgresql', 'python')">Postgresql</button>
|
||||
<button type="button" id="loadPrometheus" class="btn btn-light btn-sm" onclick="loadPreset('prometheus', 'python')">Prometheus</button>
|
||||
<button type="button" id="loadVault" class="btn btn-light btn-sm" onclick="loadPreset('vault', 'python')">Vault</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -311,9 +313,9 @@
|
||||
<!-- START CHAOS PROGRAMMING MODE SCREEN -->
|
||||
<div id="chaos-program-screen" style="display: none;">
|
||||
<div class="row" style="margin-top: 1%;">
|
||||
<div id="alert_placeholder4" style="margin-top: 1%;"></div>
|
||||
<div class="col">
|
||||
<form>
|
||||
<div id="alert_placeholder" style="margin-top: 1%;"></div>
|
||||
<div class="form-group">
|
||||
<label for="chaosProgramTextArea"></label>
|
||||
<textarea class="form-control chaos-prog-area" id="chaosProgramTextArea" rows="50" style="min-width: 100%; font-family: Courier, monospace;">
|
||||
@@ -457,8 +459,7 @@ experiments:
|
||||
|
||||
function loadPreset(tool, lang) {
|
||||
let decodedStringAtoB = "";
|
||||
console.log("Loaded preset for " + tool);
|
||||
startProgrammingMode();
|
||||
console.log("Loaded preset for " + tool);
|
||||
loadPresetsCodeParsed = JSON.parse(loadPresetsCodeJson);
|
||||
decodedStringAtoB = atob(loadPresetsCodeParsed[tool]);
|
||||
loadSavedPreset(tool, lang, decodedStringAtoB);
|
||||
@@ -472,6 +473,9 @@ experiments:
|
||||
log_tail_div.style.display = "none";
|
||||
log_tail_screen.style.display = "none"
|
||||
$("#logConsoleButton").text("Start Logs Tail");
|
||||
if (programming_mode_switch == false) {
|
||||
startProgrammingMode();
|
||||
}
|
||||
}
|
||||
|
||||
function changeRandomFactor() {
|
||||
|
||||
+12
-11
@@ -96,9 +96,9 @@ function loadSavedPreset(tool, lang, defaultpreset) {
|
||||
var oReq = new XMLHttpRequest();
|
||||
oReq.onreadystatechange = function () {
|
||||
if (this.readyState === XMLHttpRequest.DONE && this.status === 200) {
|
||||
console.log("response of loadSavedPreset: " + this.responseText);
|
||||
if (this.responseText != "nil") {
|
||||
$("#currentLoadTest").val(this.responseText);
|
||||
console.log("response of loadSavedPreset: ||" + this.responseText + "||");
|
||||
if (this.responseText.trim() != "nil") {
|
||||
$("#currentLoadTest").val(this.responseText.trim());
|
||||
} else {
|
||||
$("#currentLoadTest").val(defaultpreset);
|
||||
}
|
||||
@@ -122,16 +122,17 @@ function savePreset(action) {
|
||||
oReq.onreadystatechange = function () {
|
||||
if (this.readyState === XMLHttpRequest.DONE && this.status === 200 && action == "apply") {
|
||||
// console.log(this.responseText);
|
||||
$('#alert_placeholder').replaceWith(this.responseText);
|
||||
// $('#alert_placeholder').replaceWith(this.responseText);
|
||||
presetBody = $('#chaosProgramTextArea').text(`jobs:
|
||||
${presetName}:
|
||||
additional-labels:
|
||||
create-by: kubeinvaders
|
||||
load-preset: ${presetName}
|
||||
preset-lang: ${presetLang}
|
||||
created-by: kubeinvaders
|
||||
lang: ${presetLang}
|
||||
type: loadtest
|
||||
image: docker.io/luckysideburn/chaos-exec:latest
|
||||
command: ./start.sh
|
||||
args:
|
||||
- http://kubeinvaders
|
||||
- http://kubeinvaders:8080
|
||||
- ${presetName}
|
||||
experiments:
|
||||
- name: ${presetName}
|
||||
@@ -144,7 +145,7 @@ experiments:
|
||||
oReq.send(presetBody);
|
||||
closeSetLoadTestModal();
|
||||
|
||||
if (action == "apply"){
|
||||
if (action == "apply" && programming_mode_switch == false){
|
||||
startProgrammingMode();
|
||||
}
|
||||
}
|
||||
@@ -371,7 +372,7 @@ function setChaosContainer() {
|
||||
|
||||
function runChaosProgram() {
|
||||
|
||||
$('#alert_placeholder').replaceWith(alert_div + 'Loading chaos program...</div>');
|
||||
$('#alert_placeholder4').replaceWith(alert_div + 'Loading chaos program...</div>');
|
||||
|
||||
var oReq = new XMLHttpRequest();
|
||||
oReq.open("POST", "https://" + clu_endpoint + "/kube/chaos/programming_mode?id=" + random_code, true);
|
||||
@@ -379,7 +380,7 @@ function runChaosProgram() {
|
||||
if (this.readyState === XMLHttpRequest.DONE && this.status === 200) {
|
||||
//console.log(this.responseText);
|
||||
now = new Date().toLocaleString().replace(',','')
|
||||
$('#alert_placeholder').replaceWith(alert_div + 'Executed Chaos Program at ' + now + ' </div>');
|
||||
$('#alert_placeholder4').replaceWith(alert_div + 'Executed Chaos Program at ' + now + ' </div>');
|
||||
}
|
||||
};;
|
||||
oReq.setRequestHeader("Content-Type", "application/json");
|
||||
|
||||
@@ -7,10 +7,15 @@ COPY requirements.txt requirements.txt
|
||||
COPY requirements.txt requirements.txt
|
||||
|
||||
RUN /usr/local/bin/python -m pip install --upgrade pip
|
||||
RUN pip3 install -r requirements.txt
|
||||
|
||||
RUN pip3 install "setuptools<58.0"
|
||||
RUN pip3 install opster==4.2
|
||||
#RUN pip3 install -r requirements.txt
|
||||
|
||||
RUN apt-get update -y && apt-get install -y curl
|
||||
|
||||
COPY . .
|
||||
|
||||
RUN chmod 777 start.sh
|
||||
|
||||
CMD [ "bash", "start.sh" ]
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
#!/bin/bash
|
||||
|
||||
docker build . -t docker.io/kubeinvaders/chaos_exec:latest
|
||||
docker build . -t docker.io/luckysideburn/chaos-exec:latest
|
||||
docker push docker.io/luckysideburn/chaos-exec:latest
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
setuptools<58.0
|
||||
atlassian-api-py
|
||||
python-consul
|
||||
elasticsearch
|
||||
@@ -11,4 +12,5 @@ prometheus_client
|
||||
psycopg2
|
||||
pymongo
|
||||
requests
|
||||
kafka
|
||||
confluent-kafka
|
||||
kafka-python
|
||||
|
||||
@@ -91,8 +91,7 @@ server {
|
||||
namespace = string.gsub(res, "deleted_pods_total_on_", "")
|
||||
metric = "deleted_namespace_pods_count{namespace=\"".. namespace .."\"}"
|
||||
ngx.say(metric .. " " .. red:get(res))
|
||||
else
|
||||
ngx.say(res .. " " .. red:get(res))
|
||||
|
||||
end
|
||||
end
|
||||
}
|
||||
@@ -158,8 +157,7 @@ server {
|
||||
local okredis, errredis = red:connect("unix:/tmp/redis.sock")
|
||||
local key_name = args["lang"] .. ":" .. args["name"]
|
||||
|
||||
if not data == nil and not data == "" and not data == " " then
|
||||
|
||||
if data ~= nil then
|
||||
ngx.log(ngx.ERR, "[save loadpreset] lang:" .. args["lang"] .. ", name:" .. args["name"] .. ", payload:" .. data)
|
||||
red:set(key_name, data)
|
||||
local res, err = red:get(key_name)
|
||||
@@ -169,7 +167,6 @@ server {
|
||||
else
|
||||
ngx.say(args["name"] .. " has been saved.")
|
||||
end
|
||||
|
||||
else
|
||||
ngx.say("Error in payload sent by web interface.")
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user