-
Notifications
You must be signed in to change notification settings - Fork 0
/
task9.html
167 lines (135 loc) · 4.69 KB
/
task9.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
<html>
<head>
<title>Kubernetes Web-console</title>
</head>
<script>
function run(){
var i = document.getElementById("ds").value
var cmd_no="0";
var command="";
if (((i.includes("create")) || (i.includes("build")) || (i.includes("launch"))) && ((i.includes("deployments")) || (i.includes("deployment")))) {
var img_name = prompt("Enter Image name: ");
var deployment_name = prompt("Enter Deployment name: ");
var cmd_no = "1";
var command = cmd_no + " " + img_name + " " + deployment_name;
}
else if (((i.includes("create")) || (i.includes("build")) || (i.includes("launch"))) && ((i.includes("pods")) || (i.includes("pod")))) {
var img_name = prompt("Enter Image name: ");
var pod_name = prompt("Enter Pod name: ");
var cmd_no = "2";
var command = cmd_no + " " + img_name + " " + pod_name;
}
else if (((i.includes("delete")) || (i.includes("remove"))) && ((i.includes("pods")) || (i.includes("pod")))) {
var pod_name = prompt("Enter pod name: ");
var cmd_no = "3";
var command = cmd_no + " " + pod_name;
}
else if (((i.includes("delete")) || (i.includes("remove"))) && ((i.includes("deployments")) || (i.includes("deployment")))) {
var deployment_name = prompt("Enter Deployment name: ");
var cmd_no = "4";
var command = cmd_no + " " + deployment_name;
}
else if ((i.includes("expose")) && ((i.includes("deployments")) || (i.includes("deployment")))) {
var deployment_name = prompt("Enter Deployment name: ");
var port_no = prompt("Enter port no of your deploymrnt: ");
var type = prompt("Enter the type which you want to export(NodePort/ClusterIP/External): ");
var cmd_no = "5"
var command = cmd_no + " " + deployment_name + " " + port_no + " " + type;
}
else if (((i.includes("scale")) || (i.includes("increase")) || (i.includes("decrease")) || (i.includes("scale up")) || (i.includes("scale down"))) && ((i.includes("deployments")) || (i.includes("deployment")))) {
var deployment_name = prompt("Enter Deployment name: ");
var replica = prompt("Enter no. of replicas: ");
var cmd_no = "6";
var command = cmd_no + " " + deployment_name + " " + replica;
}
else if (((i.includes("show")) || (i.includes("get"))) && ((i.includes("pods")) || (i.includes("pod")))) {
var cmd_no = "7";
var command = cmd_no;
}
else if (((i.includes("show")) || (i.includes("get"))) && ((i.includes("service")) || (i.includes("services")) || (i.includes("svc")))) {
var cmd_no = "8";
var command = cmd_no;
}
else if (((i.includes("delete")) || (i.includes("remove")) || (i.includes("destroy"))) && ((i.includes("all")) || (i.includes("everything")))) {
var cmd_no = "9";
var command = cmd_no;
}
var xhr = new XMLHttpRequest();
xhr.open("GET", "http://192.168.56.101/cgi-bin/task9.py?x=" + command,true);
xhr.send();
xhr.onload=function(){
var output = xhr.responseText;
document.getElementById("d1").innerHTML = output;
}
}
</script>
<style>
body{ margin: 0;
padding:0;
}
div#hd{
height:100vh;
background-image: url("http://treasuresofinnocence.org/wp-content/uploads/2015/08/4.New-style-light-blue-color-Background-image-www.graphiclay.blogspot.com_.jpg") ;
background-size: cover;
background-position:center;
display: flex;
justify-content: center;
padding-left:20px;
font-family: sans-serif;
opacity: 150%;
}
h1{ color:#fff;
margin-bottom:40px;
font-size: 45px;
letter-spacing: 2px;
}
div#cmdbox { width:710px;
height:70px;
background-color:#82CAFA;
padding:20px;
}
input#ds{ width:450px;
height:30px;
padding:10px;
border:none;
border-radius:25px;
outline:none;
}
button { height:40px;
width:100px;
background: #ffeb3b;
border:none;
color: #000;
border-radius: 25px;
}
pre{ width:1400px;
height:400px;
background:rgba(0,0,0,0.5);
padding:20px;
font-size:15px;
color:#fff
}
button:hover{ background:#ffc107;
cursor: pointer; }
img {margin-right:30px; width:200px; height:186px }
</style>
<body>
<div id="hd">
<form>
<div id="box">
<img align=right src="https://miro.medium.com/max/625/1*rQuaLXlDy1-gqEPKBshcwA.gif">
<h1 style="background-color:tomato;">KUBERNETES WEB-CONSOLE</h1>
<div id="cmdbox">
Pass Your Requirement Here:
<input type="text" id="ds" placeholder="Type here..">
<button onclick="run()" id="run-cmd" type="button">Execute</button>
<br>
</div>
<pre>
<div id="d1">Output...</div>
</pre>
</div>
</form>
</div>
</body>
</html>