allow to run without checking out a repository

This commit is contained in:
Simon Belmas
2024-07-29 17:55:15 +02:00
parent 9efb2a0a15
commit 0b156f5b48
2 changed files with 25 additions and 10 deletions

View File

@@ -11,7 +11,7 @@ Ingress fqdn has to be configured by either:
*replicas* and *content-git-repo* in *config* folder can be customized by modifying files or applying kustomize patch
Connntent git will be displayed in an iframe with node name on top.
Content git will be displayed in an iframe with node name on top. If it's empty, it will display a blank page with node name.
Node name is displayed on the top of the page and also in kube-node.json and on kube-node.txt

View File

@@ -1,6 +1,7 @@
#!/bin/sh
git_retries=20
try=0
if [ -n "${CONTENT_GIT_REPO}" ] ; then
export GIT_SSH_COMMAND='ssh -o "StrictHostKeyChecking=no" -o "UserKnownHostsFile=/dev/null"'
until timeout 10 git clone --recurse-submodules ${CONTENT_GIT_REPO} /app ; do
echo "Retry git pull after error ($try / $git_retries)"
@@ -10,10 +11,13 @@ until timeout 10 git clone --recurse-submodules ${CONTENT_GIT_REPO} /app ; do
fi
sleep 1
done
fi
cd /app
if [ -e index.html ] ; then
mv index.html index-embedded.html
fi
cat <<EOF >index.html
<html>
<head>
@@ -24,15 +28,26 @@ cat <<EOF >index.html
From node ${KUBE_NODE_NAME}<br />
as <a href="./kube-node.json">json</a> - <a href="./kube-node.txt">text</a>
</p>
EOF
if [ -n "${CONTENT_GIT_REPO}" ] ; then
cat <<EOF >>index.html
<iframe
id="embeddedcontent"
title="embeddedcontent"
width="100%"
height="90%"
src="./index-embedded.html" />
EOF
fi
cat <<EOF >>index.html
</body>
</html>
EOF
ls -l
cat index.html
echo '{"node": "'${KUBE_NODE_NAME}'"}' > kube-node.json
echo -n ${KUBE_NODE_NAME} > kube-node.txt