Skip to content

Commit 2dc3af7

Browse files
author
Simon Emms
committed
[installer]: move the installation status script to the Installer
1 parent 7461ace commit 2dc3af7

File tree

2 files changed

+78
-19
lines changed

2 files changed

+78
-19
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
#!/bin/sh
2+
# Copyright (c) 2022 Gitpod GmbH. All rights reserved.
3+
# Licensed under the MIT License. See License-MIT.txt in the project root for license information.
4+
5+
set -e
6+
7+
cat <<EOF
8+
==================================
9+
=== Gitpod Installation Status ===
10+
==================================
11+
12+
This deployment checks if Gitpod has been installed to your
13+
cluster successfully. If this deployment is running then
14+
Gitpod has installed successfully.
15+
16+
If this deployment is in a failed state, it means that
17+
either your Gitpod installation is still in progress or
18+
that the installation job has failed.
19+
20+
If this deployment is in a failed state, it is almost
21+
certainly a symptom of a problem elsewhere and not the
22+
root cause.
23+
24+
==================================
25+
26+
27+
EOF
28+
29+
DISPLAY_MESSAGE="1"
30+
31+
while true
32+
do
33+
if [ "$(helm status -n "${NAMESPACE}" gitpod -o json | jq '.info.status == "deployed"')" != "true" ]; then
34+
# We are now in a failed state
35+
if [ "${DISPLAY_MESSAGE}" = "1" ]; then
36+
# Don't display a message if it's already shown success - this could confuse users
37+
if [ "$(kubectl get jobs.batch -n "${NAMESPACE}" -l component=gitpod-installer -o json | jq '.items | length')" = "0" ]; then
38+
# The Installer has crashed
39+
cat <<EOF
40+
The Gitpod installation job has failed. You can either:
41+
- go to the "Troubleshoot" section in the KOTS
42+
dashboard and run through the tests in there
43+
- redeploy Gitpod in the KOTS dashboard and watch
44+
the logs. The command for that is:
45+
"kubectl logs -f -n ${NAMESPACE} -l component=gitpod-installer --tail=-1"
46+
47+
To access the KOTS dashboard, you may need to run
48+
"kubectl kots admin-console -n ${NAMESPACE}"
49+
EOF
50+
else
51+
# Installation is still in progress
52+
echo "Your Gitpod installation is in progress. Please wait."
53+
fi
54+
fi
55+
56+
# Exit with error code
57+
exit 1
58+
fi
59+
60+
# Gitpod is currently successfully installed
61+
if [ "${DISPLAY_MESSAGE}" = "1" ]; then
62+
# Once we've displayed this message, never show any more status messages
63+
DISPLAY_MESSAGE="0"
64+
65+
cat <<EOF
66+
Gitpod is installed successfully. Your installation
67+
should be available at https://${DOMAIN}.
68+
EOF
69+
fi
70+
71+
# Check installation status again in 10 seconds
72+
# This status may change in future which is why we keep checking
73+
sleep 10
74+
done

install/kots/manifests/gitpod-installation-status.yaml

+4-19
Original file line numberDiff line numberDiff line change
@@ -31,26 +31,11 @@ spec:
3131
- name: installation-status
3232
# This will normally be the release tag
3333
image: "eu.gcr.io/gitpod-core-dev/build/installer:sje-move-kots-bash-script.28"
34+
envFrom:
35+
- configMapRef:
36+
name: gitpod-kots-config
3437
command:
35-
- /bin/sh
36-
- -c
37-
args:
38-
- |
39-
set -e
40-
41-
while true
42-
do
43-
echo "Checking installation status"
44-
45-
if [ "$(helm status -n {{repl Namespace }} gitpod -o json | jq '.info.status == "deployed"')" != "true" ];
46-
then
47-
echo "Gitpod: Installation not complete"
48-
exit 1
49-
fi
50-
51-
echo "Sleeping for 10 seconds"
52-
sleep 10
53-
done
38+
- /app/scripts/kots-installation-status.sh
5439
resources:
5540
limits:
5641
memory: "128Mi"

0 commit comments

Comments
 (0)