prepare new release

This commit is contained in:
Eugenio Marzo
2020-12-26 12:44:43 +01:00
parent e0b8e169ab
commit c1143bc595
25 changed files with 588 additions and 24 deletions
+1
View File
@@ -3,6 +3,7 @@ COPY ./js-web/KubeInvaders /var/www/html
RUN sed -i.bak 's/^user/#user/' /etc/nginx/nginx.conf
RUN sed -i.bak 's/listen\(.*\)80;/listen 8081;/' /etc/nginx/conf.d/default.conf
COPY nginx/KubeInvaders.templ /etc/nginx/conf.d/KubeInvaders.templ
COPY nginx/KubeInvaders_dev.templ /etc/nginx/conf.d/KubeInvaders_dev.templ
RUN chmod g+rwx /var/cache/nginx /var/run /var/log/nginx /var/www/html /etc/nginx/conf.d/KubeInvaders.templ /etc/nginx/conf.d
EXPOSE 8080
COPY ./temporary_hack.sh /
+3
View File
@@ -0,0 +1,3 @@
animations {
animation: "/assets/press.animationset"
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 3.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.1 KiB

BIN
View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 957 B

+30
View File
@@ -0,0 +1,30 @@
images {
image: "/assets/start.png"
sprite_trim_mode: SPRITE_TRIM_MODE_OFF
}
animations {
id: "press"
images {
image: "/assets/start-pressed.png"
sprite_trim_mode: SPRITE_TRIM_MODE_OFF
}
images {
image: "/assets/start.png"
sprite_trim_mode: SPRITE_TRIM_MODE_OFF
}
images {
image: "/assets/start-pressed.png"
sprite_trim_mode: SPRITE_TRIM_MODE_OFF
}
images {
image: "/assets/start.png"
sprite_trim_mode: SPRITE_TRIM_MODE_OFF
}
playback: PLAYBACK_ONCE_FORWARD
fps: 20
flip_horizontal: 0
flip_vertical: 0
}
margin: 1
extrude_borders: 2
inner_padding: 0
+30
View File
@@ -0,0 +1,30 @@
images {
image: "/assets/start-k3s.png"
sprite_trim_mode: SPRITE_TRIM_MODE_OFF
}
animations {
id: "New press"
images {
image: "/assets/start-k3s-pressed.png"
sprite_trim_mode: SPRITE_TRIM_MODE_OFF
}
images {
image: "/assets/start-k3s.png"
sprite_trim_mode: SPRITE_TRIM_MODE_OFF
}
images {
image: "/assets/start-k3s-pressed.png"
sprite_trim_mode: SPRITE_TRIM_MODE_OFF
}
images {
image: "/assets/start-k3s.png"
sprite_trim_mode: SPRITE_TRIM_MODE_OFF
}
playback: PLAYBACK_LOOP_FORWARD
fps: 40
flip_horizontal: 0
flip_vertical: 0
}
margin: 0
extrude_borders: 2
inner_padding: 0
+8
View File
@@ -46,10 +46,18 @@ key_trigger {
input: KEY_R
action: "refresh_pod_log"
}
key_trigger {
input: KEY_S
action: "stop"
}
mouse_trigger {
input: MOUSE_BUTTON_1
action: "click"
}
touch_trigger {
input: TOUCH_MULTI
action: "touch"
}
text_trigger {
input: TEXT
action: "type"
View File
+1 -1
View File
@@ -24,9 +24,9 @@ function on_message(self, message_id, message, sender)
print ("on_message] position of pod to be deleted is " .. old_pos)
current_pods[i] = { id = value["id"] , color = "red", collision = true, old_position = old_pos, pod_name = value["pod_name"] }
go.delete(value["id"])
go.delete()
end
end
go.delete()
end
print "[on_message] end of on_message function"
end
+210 -2
View File
@@ -45,8 +45,9 @@ embedded_instances {
"mass: 0.0\\n"
"friction: 0.1\\n"
"restitution: 0.5\\n"
"group: \\\"bullet\\\"\\n"
"group: \\\"spaceship\\\"\\n"
"mask: \\\"pod\\\"\\n"
"mask: \\\"bullet\\\"\\n"
"embedded_collision_shape {\\n"
" shapes {\\n"
" shape_type: TYPE_SPHERE\\n"
@@ -64,7 +65,7 @@ embedded_instances {
" index: 0\\n"
" count: 1\\n"
" }\\n"
" data: 15.0\\n"
" data: 50.0\\n"
"}\\n"
"linear_damping: 0.0\\n"
"angular_damping: 0.0\\n"
@@ -205,6 +206,7 @@ embedded_instances {
"restitution: 0.5\\n"
"group: \\\"pod\\\"\\n"
"mask: \\\"bullet\\\"\\n"
"mask: \\\"spaceship\\\"\\n"
"embedded_collision_shape {\\n"
" shapes {\\n"
" shape_type: TYPE_SPHERE\\n"
@@ -523,3 +525,209 @@ embedded_instances {
z: 1.0
}
}
embedded_instances {
id: "start_chaos"
data: "components {\n"
" id: \"start_chaos\"\n"
" component: \"/main/start_chaos.script\"\n"
" position {\n"
" x: 0.0\n"
" y: 0.0\n"
" z: 0.0\n"
" }\n"
" rotation {\n"
" x: 0.0\n"
" y: 0.0\n"
" z: 0.0\n"
" w: 1.0\n"
" }\n"
"}\n"
"embedded_components {\n"
" id: \"sprite\"\n"
" type: \"sprite\"\n"
" data: \"tile_set: \\\"/assets/start_chaos.atlas\\\"\\n"
"default_animation: \\\"start\\\"\\n"
"material: \\\"/builtins/materials/sprite.material\\\"\\n"
"blend_mode: BLEND_MODE_ALPHA\\n"
"\"\n"
" position {\n"
" x: 600.0\n"
" y: 725.0\n"
" z: 0.0\n"
" }\n"
" rotation {\n"
" x: 0.0\n"
" y: 0.0\n"
" z: 0.0\n"
" w: 1.0\n"
" }\n"
"}\n"
"embedded_components {\n"
" id: \"collisionobject\"\n"
" type: \"collisionobject\"\n"
" data: \"collision_shape: \\\"\\\"\\n"
"type: COLLISION_OBJECT_TYPE_KINEMATIC\\n"
"mass: 0.0\\n"
"friction: 0.1\\n"
"restitution: 0.5\\n"
"group: \\\"pod\\\"\\n"
"mask: \\\"bullet\\\"\\n"
"mask: \\\"spaceship\\\"\\n"
"embedded_collision_shape {\\n"
" shapes {\\n"
" shape_type: TYPE_BOX\\n"
" position {\\n"
" x: 600.0\\n"
" y: 725.0\\n"
" z: 0.0\\n"
" }\\n"
" rotation {\\n"
" x: 0.0\\n"
" y: 0.0\\n"
" z: 0.0\\n"
" w: 1.0\\n"
" }\\n"
" index: 0\\n"
" count: 3\\n"
" }\\n"
" data: 150.0\\n"
" data: 50.0\\n"
" data: 18.032\\n"
"}\\n"
"linear_damping: 0.0\\n"
"angular_damping: 0.0\\n"
"locked_rotation: false\\n"
"\"\n"
" position {\n"
" x: 0.0\n"
" y: 0.0\n"
" z: 0.0\n"
" }\n"
" rotation {\n"
" x: 0.0\n"
" y: 0.0\n"
" z: 0.0\n"
" w: 1.0\n"
" }\n"
"}\n"
""
position {
x: 0.0
y: 0.0
z: 0.0
}
rotation {
x: 0.0
y: 0.0
z: 0.0
w: 1.0
}
scale3 {
x: 1.0
y: 1.0
z: 1.0
}
}
embedded_instances {
id: "start_k3s"
data: "components {\n"
" id: \"start_k3s\"\n"
" component: \"/main/start_k3s.script\"\n"
" position {\n"
" x: 0.0\n"
" y: 0.0\n"
" z: 0.0\n"
" }\n"
" rotation {\n"
" x: 0.0\n"
" y: 0.0\n"
" z: 0.0\n"
" w: 1.0\n"
" }\n"
"}\n"
"embedded_components {\n"
" id: \"collisionobject\"\n"
" type: \"collisionobject\"\n"
" data: \"collision_shape: \\\"\\\"\\n"
"type: COLLISION_OBJECT_TYPE_KINEMATIC\\n"
"mass: 0.0\\n"
"friction: 0.1\\n"
"restitution: 0.5\\n"
"group: \\\"k3s\\\"\\n"
"mask: \\\"bullet\\\"\\n"
"mask: \\\"spaceship\\\"\\n"
"embedded_collision_shape {\\n"
" shapes {\\n"
" shape_type: TYPE_BOX\\n"
" position {\\n"
" x: 950.0\\n"
" y: 725.0\\n"
" z: 0.0\\n"
" }\\n"
" rotation {\\n"
" x: 0.0\\n"
" y: 0.0\\n"
" z: 0.0\\n"
" w: 1.0\\n"
" }\\n"
" index: 0\\n"
" count: 3\\n"
" }\\n"
" data: 150.0\\n"
" data: 50.0\\n"
" data: 18.032\\n"
"}\\n"
"linear_damping: 0.0\\n"
"angular_damping: 0.0\\n"
"locked_rotation: false\\n"
"\"\n"
" position {\n"
" x: 0.0\n"
" y: 0.0\n"
" z: 0.0\n"
" }\n"
" rotation {\n"
" x: 0.0\n"
" y: 0.0\n"
" z: 0.0\n"
" w: 1.0\n"
" }\n"
"}\n"
"embedded_components {\n"
" id: \"sprite\"\n"
" type: \"sprite\"\n"
" data: \"tile_set: \\\"/assets/start_k3s.atlas\\\"\\n"
"default_animation: \\\"start-k3s\\\"\\n"
"material: \\\"/builtins/materials/sprite.material\\\"\\n"
"blend_mode: BLEND_MODE_ALPHA\\n"
"\"\n"
" position {\n"
" x: 950.0\n"
" y: 725.0\n"
" z: 0.0\n"
" }\n"
" rotation {\n"
" x: 0.0\n"
" y: 0.0\n"
" z: 0.0\n"
" w: 1.0\n"
" }\n"
"}\n"
""
position {
x: 0.0
y: 0.0
z: 0.0
}
rotation {
x: 0.0
y: 0.0
z: 0.0
w: 1.0
}
scale3 {
x: 1.0
y: 1.0
z: 1.0
}
}
+2
View File
@@ -0,0 +1,2 @@
script: ""
adjust_reference: ADJUST_REFERENCE_PARENT
+11
View File
@@ -0,0 +1,11 @@
local M = {}
function M.node_metrics(pod_name)
http.request(endpoint .. "/apis/metrics.k8s.io/v1beta1/nodes", "GET", M.http_node_metrics_result, headers)
end
function M.http_node_metrics_result(self, _, response)
print(response.response)
end
return M
+17
View File
@@ -0,0 +1,17 @@
local M = {}
local h_size = hash("size")
local no_padding = {
left = 0,
right = 0,
bottom = 0,
top = 0,
}
function M.press_play(sprite_url)
go.get_position(sprite_url)
msg.post(sprite_url, "play_animation", {id = hash("press")})
end
return M
+31 -20
View File
@@ -16,7 +16,7 @@ pod_update_time = 0.5
kubernetes_pods = {}
last_pod_log = false
last_pod_log_time = false
start_chaos = false
local COLLISION_RESPONSE = hash("collision_response")
local timer = require "main.mymodules.timer"
@@ -24,22 +24,15 @@ local spaceship = require "main.mymodules.spaceship"
local help = require "main.mymodules.help"
local pod_mod = require "main.mymodules.pod"
local pod_api = require "main.mymodules.pod_api"
local press_play = require "main.mymodules.press_play"
function reverse(tbl)
for i=1, math.floor(#tbl / 2) do
local tmp = tbl[i]
tbl[i] = tbl[#tbl - i + 1]
tbl[#tbl - i + 1] = tmp
end
end
function init(self)
function start_chaos()
msg.post("ui#gui", "mode",{ mode = "Press \"a\" to use automatic pilot" })
local path = os.getenv("HOME") .. "/.KubeInv.json"
local contents = ""
conf = {}
local file = io.open( path, "r" )
if file then
if file then
local contents = file:read( "*a" )
conf = json.decode(contents);
io.close(file)
@@ -79,10 +72,10 @@ function init(self)
namespace_total = table.getn(namespace_list)
namespace_cnt = 0
namespace = namespace_list[0]
info = "Endpoint: " .. conf["endpoint"] .. "\n\n" .. "Namespace: " .. namespace
msg.post("ui#gui", "info",{ infomessage = info })
msg.post(".", "acquire_input_focus")
headers = {
@@ -102,6 +95,21 @@ function init(self)
end)
pod_api.set_pods()
end
started_chaos = true
go.delete('/start_chaos')
go.delete('/start_k3s')
end
function reverse(tbl)
for i=1, math.floor(#tbl / 2) do
local tmp = tbl[i]
tbl[i] = tbl[#tbl - i + 1]
tbl[#tbl - i + 1] = tmp
end
end
function init(self)
msg.post(".", "acquire_input_focus")
end
function update(self, dt)
@@ -109,7 +117,7 @@ function update(self, dt)
end
function on_input(self, action_id, action)
local p = go.get_position()
p = go.get_position()
if action_id == hash("up") then
msg.post("ui#gui","pod_log",{infomessage = ''})
last_pod_log = false
@@ -160,7 +168,7 @@ function on_input(self, action_id, action)
-- Returns an approximation of the amount in seconds of CPU time used by the program.
current_time = os.clock()
if last_namespace_change ~= false then
diff_time = current_time - last_namespace_change
print ("[change_namespace] diff_time ".. diff_time)
@@ -183,11 +191,11 @@ function on_input(self, action_id, action)
namespace = namespace_list[namespace_cnt]
end
end
last_namespace_change = os.clock()
info = "Endpoint: " .. conf["endpoint"] .. "\n\n" .. "Namespace: " .. namespace
msg.post("ui#gui", "info",{ infomessage = info })
elseif action_id == hash("space") and action.pressed then
msg.post("ui#gui", "error",{ errormessage = "" })
-- Returns an approximation of the amount in seconds of CPU time used by the program.
@@ -207,12 +215,13 @@ function on_input(self, action_id, action)
last_hit_time = os.clock()
end
end
end
end
end
function on_message(self, message_id, message, sender)
current_time = os.clock()
if message_id == COLLISION_RESPONSE then
print('DEBUG' .. message_id)
if message_id == COLLISION_RESPONSE and started_chaos then
for i,value in ipairs(current_pods) do
if (message["other_id"] == value["id"]) then
pod_name = value["pod_name"]
@@ -224,12 +233,14 @@ function on_message(self, message_id, message, sender)
else
diff_time = 99
end
if last_pod_log ~= pod_name and diff_time > 0.2 then
last_pod_log = pod_mod.print_pod_log(message["other_id"])
print("last_pod_log " .. last_pod_log)
print("pod_name " .. pod_name)
last_pod_log_time = os.clock()
end
elseif message_id == hash('start_chaos') then
start_chaos()
end
end
+80
View File
@@ -0,0 +1,80 @@
components {
id: "bullet"
component: "/main/bullet.script"
position {
x: 0.0
y: 0.0
z: 0.0
}
rotation {
x: 0.0
y: 0.0
z: 0.0
w: 1.0
}
}
embedded_components {
id: "sprite"
type: "sprite"
data: "tile_set: \"/assets/bullet.atlas\"\n"
"default_animation: \"bulletkube\"\n"
"material: \"/builtins/materials/sprite.material\"\n"
"blend_mode: BLEND_MODE_ALPHA\n"
""
position {
x: 0.0
y: 0.0
z: 0.0
}
rotation {
x: 0.0
y: 0.0
z: 0.0
w: 1.0
}
}
embedded_components {
id: "collisionobject"
type: "collisionobject"
data: "collision_shape: \"\"\n"
"type: COLLISION_OBJECT_TYPE_KINEMATIC\n"
"mass: 0.0\n"
"friction: 0.1\n"
"restitution: 0.5\n"
"group: \"bullet\"\n"
"mask: \"pod\"\n"
"embedded_collision_shape {\n"
" shapes {\n"
" shape_type: TYPE_SPHERE\n"
" position {\n"
" x: 0.0\n"
" y: 0.0\n"
" z: 0.0\n"
" }\n"
" rotation {\n"
" x: 0.0\n"
" y: 0.0\n"
" z: 0.0\n"
" w: 1.0\n"
" }\n"
" index: 0\n"
" count: 1\n"
" }\n"
" data: 15.0\n"
"}\n"
"linear_damping: 0.0\n"
"angular_damping: 0.0\n"
"locked_rotation: false\n"
""
position {
x: 0.0
y: 0.0
z: 0.0
}
rotation {
x: 0.0
y: 0.0
z: 0.0
w: 1.0
}
}
+40
View File
@@ -0,0 +1,40 @@
local COLLISION_RESPONSE = hash("collision_response")
local timer = require "main.mymodules.timer"
local spaceship = require "main.mymodules.spaceship"
local help = require "main.mymodules.help"
local pod_mod = require "main.mymodules.pod"
local pod_api = require "main.mymodules.pod_api"
local press_play = require "main.mymodules.press_play"
local COLLISION_RESPONSE = hash("collision_response")
function init(self)
-- Add initialization code here
-- Remove this function if not needed
end
function final(self)
-- Add finalization code here
-- Remove this function if not needed
end
function update(self, dt)
end
function on_message(self, message_id, message, sender)
if message_id == COLLISION_RESPONSE then
press_play.press_play('/start_chaos#sprite')
msg.post('/spaceship', "start_chaos", { action = 'start_chaos'})
--go.delete()
end
end
function on_input(self, action_id, action)
end
function on_reload(self)
-- Add reload-handling code here
-- Remove this function if not needed
end
+27
View File
@@ -0,0 +1,27 @@
function init(self)
-- Add initialization code here
-- Remove this function if not needed
end
function final(self)
-- Add finalization code here
-- Remove this function if not needed
end
function update(self, dt)
end
function on_message(self, message_id, message, sender)
end
function on_input(self, action_id, action)
end
function on_reload(self)
-- Add reload-handling code here
-- Remove this function if not needed
end
+1
View File
@@ -28,6 +28,7 @@ embedded_components {
"restitution: 0.5\n"
"group: \"pod\"\n"
"mask: \"bullet\"\n"
"mask: \"spaceship\"\n"
"embedded_collision_shape {\n"
" shapes {\n"
" shape_type: TYPE_SPHERE\n"
+25
View File
@@ -0,0 +1,25 @@
server {
listen 8080 default_server;
root /var/www/html/;
index index.html;
location / {
try_files $uri $uri/ =404;
add_header Last-Modified $date_gmt;
add_header Cache-Control 'no-store, no-cache, must-revalidate, proxy-revalidate, max-age=0';
if_modified_since off;
expires off;
etag off;
}
location /kube {
rewrite ^/kube(.*)$ /api$1 break;
proxy_pass ${ENDPOINT};
}
location /kube/api {
rewrite ^/kube/api(.*)$ /api$1 break;
proxy_pass ${ENDPOINT};
}
}
+50
View File
@@ -0,0 +1,50 @@
# Set a spefic KUBECONFIG if you have different contexts
# export KUBECONFIG=<path>
NAMESPACES="default,namespace1"
K8S_ENDPOINT="https://91A9752B6718D1E61824994D466EB574.gr7.eu-central-1.eks.amazonaws.com"
SERVICE_ACCOUNT="kubeinvaders"
kubectl --insecure-skip-tls-verify create sa kubeinvaders -n default
cat <<EOF > ./kubeinvader-rbac.yaml
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
name: kubeinvaders
labels:
app: kubeinvaders
rules:
- apiGroups: [""]
resources: ["pods","pods/log"]
verbs: ["get", "watch", "list", "delete"]
---
kind: ClusterRoleBinding
apiVersion: rbac.authorization.k8s.io/v1
metadata:
name: kubeinvaders
labels:
app: kubeinvaders
subjects:
- kind: ServiceAccount
name: kubeinvaders
namespace: default
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: kubeinvaders
EOF
kubectl --insecure-skip-tls-verify create -f ./kubeinvader-rbac.yaml -n default
SECRET=$(kubectl --insecure-skip-tls-verify get serviceaccount ${SERVICE_ACCOUNT} -n default -o json | jq -Mr '.secrets[].name | select(contains("token"))')
TOKEN=$(kubectl --insecure-skip-tls-verify get secret ${SECRET} -n default -o json | jq -Mr '.data.token' | base64 -d)
JSON_STRING=$( jq -n \
--arg token "$TOKEN" \
--arg endpoint "$K8S_ENDPOINT" \
--arg namespace "$NAMESPACES" \
'{token: $token, endpoint: $endpoint, namespace: $namespace}' )
echo $JSON_STRING > ~/.KubeInv.json
+4
View File
@@ -0,0 +1,4 @@
APISERVER=https://91A9752B6718D1E61824994D466EB574.gr7.eu-central-1.eks.amazonaws.com
TOKEN="eyJhbGciOiJSUzI1NiIsImtpZCI6InBEd2ZWU3AyZjhwUWpqVmZtWU5iVkdMYWdhaUFwUll3SU5tQlRxbFdWRmcifQ.eyJpc3MiOiJrdWJlcm5ldGVzL3NlcnZpY2VhY2NvdW50Iiwia3ViZXJuZXRlcy5pby9zZXJ2aWNlYWNjb3VudC9uYW1lc3BhY2UiOiJkZWZhdWx0Iiwia3ViZXJuZXRlcy5pby9zZXJ2aWNlYWNjb3VudC9zZWNyZXQubmFtZSI6Imt1YmVpbnZhZGVyczItdG9rZW4tbWtqemciLCJrdWJlcm5ldGVzLmlvL3NlcnZpY2VhY2NvdW50L3NlcnZpY2UtYWNjb3VudC5uYW1lIjoia3ViZWludmFkZXJzMiIsImt1YmVybmV0ZXMuaW8vc2VydmljZWFjY291bnQvc2VydmljZS1hY2NvdW50LnVpZCI6ImJkMjlhMTUyLTY0ODAtNDY2MS04YTdmLWMwNWZkNzg0ZmIwMiIsInN1YiI6InN5c3RlbTpzZXJ2aWNlYWNjb3VudDpkZWZhdWx0Omt1YmVpbnZhZGVyczIifQ.OwoRF8eA8a_8hrMilbPLsbdGz_4jqV7epLAte_Tg692rhu75Mw3JFeRqKvN-tK9JZSx5pKZDNYbafrosvvCpZWbdDIGrwCQ_XHCbHSKdLqgYnB-WYXCerAve_M9vyOT-2yKnlQ_7_UNJKNFLTmERwbsYFDxKUSEaCvIYT7z5Ojv1y1L6wOxDvU_paclIDvjLePq-WwwOWkrbkEO9Yohidc49L2J4gjtYtFxNmMta5gXEo1cunC18Txe92kaeHKPJcCGWJ9Ym9Q-sGqgtD3YIY8qu-VX2PdqQJd9LUBksVgZHzrJ-c9sC6QgGn1urI-thpm9IfWgfnyCqBfM1Q5QZaw"
curl $APISERVER/api --header "Authorization: Bearer $TOKEN" --insecure
+5 -1
View File
@@ -5,13 +5,17 @@ ENDPOINT=$(echo "https://${ROUTE_HOST}" | sed "s/\//\\\\\//g")
if [ ! -z $DEVELOPMENT ];
then
sed -i "s/___buildEnvironment.called=true/___buildEnvironment.called=true;ENV[\"TOKEN\"]=\"$TOKEN\";ENV[\"ENDPOINT\"]=\"$ENDPOINT\";ENV[\"NAMESPACE\"]=\"$NAMESPACE\";ENV[\"HITSLIMIT\"]=\"$HITSLIMIT\";ENV[\"ALIENPROXIMITY\"]=\"$ALIENPROXIMITY\";ENV[\"UPDATETIME\"]=\"$UPDATETIME\"/g" /var/www/html/KubeInvaders_wasm.js
envsubst '${KUBERNETES_SERVICE_HOST}:${KUBERNETES_SERVICE_PORT_HTTPS}' < "/etc/nginx/conf.d/KubeInvaders.templ" > "/etc/nginx/conf.d/KubeInvaders.conf"
else
sed -i "s/___buildEnvironment.called=true/___buildEnvironment.called=true;ENV[\"TOKEN\"]=\"$TOKEN\";ENV[\"ENDPOINT\"]=\"$ENDPOINT\/kube\";ENV[\"NAMESPACE\"]=\"$NAMESPACE\";ENV[\"HITSLIMIT\"]=\"$HITSLIMIT\";ENV[\"ALIENPROXIMITY\"]=\"$ALIENPROXIMITY\";ENV[\"UPDATETIME\"]=\"$UPDATETIME\"/g" /var/www/html/KubeInvaders_wasm.js
envsubst '${KUBERNETES_SERVICE_HOST}:${KUBERNETES_SERVICE_PORT_HTTPS}' < "/etc/nginx/conf.d/KubeInvaders_dev.templ" > "/etc/nginx/conf.d/KubeInvaders.conf"
fi
sed -i "s/TOTAL_ENV_SIZE=1024/TOTAL_ENV_SIZE=2048/g" /var/www/html/KubeInvaders_wasm.js
sed -i "s/TOTAL_ENV_SIZE=1024/TOTAL_ENV_SIZE=2048/g" /var/www/html/KubeInvaders_asmjs.js
envsubst '${KUBERNETES_SERVICE_HOST}:${KUBERNETES_SERVICE_PORT_HTTPS}' < "/etc/nginx/conf.d/KubeInvaders.templ" > "/etc/nginx/conf.d/KubeInvaders.conf"
nginx -g 'daemon off;'
+12
View File
@@ -0,0 +1,12 @@
#!/bin/sh
ENDPOINT=$(echo "https://${ROUTE_HOST}" | sed "s/\//\\\\\//g")
sed -i "s/___buildEnvironment.called=true/___buildEnvironment.called=true;ENV[\"TOKEN\"]=\"$TOKEN\";ENV[\"ENDPOINT\"]=\"$ENDPOINT\/kube\";ENV[\"NAMESPACE\"]=\"$NAMESPACE\";ENV[\"HITSLIMIT\"]=\"$HITSLIMIT\";ENV[\"ALIENPROXIMITY\"]=\"$ALIENPROXIMITY\";ENV[\"UPDATETIME\"]=\"$UPDATETIME\"/g" /var/www/html/KubeInvaders_wasm.js
sed -i "s/TOTAL_ENV_SIZE=1024/TOTAL_ENV_SIZE=2048/g" /var/www/html/KubeInvaders_wasm.js
sed -i "s/TOTAL_ENV_SIZE=1024/TOTAL_ENV_SIZE=2048/g" /var/www/html/KubeInvaders_asmjs.js
envsubst '${KUBERNETES_SERVICE_HOST}:${KUBERNETES_SERVICE_PORT_HTTPS}' < "/etc/nginx/conf.d/KubeInvaders.templ" > "/etc/nginx/conf.d/KubeInvaders.conf"
nginx -g 'daemon off;'