Skip to content

Commit

Permalink
[kots]: add install delete job to remove existing stalled jobs
Browse files Browse the repository at this point in the history
  • Loading branch information
Simon Emms committed Apr 22, 2022
1 parent d16776c commit 2149ecb
Showing 1 changed file with 22 additions and 1 deletion.
23 changes: 22 additions & 1 deletion install/kots/manifests/gitpod-installer-job.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@
apiVersion: batch/v1
kind: Job
metadata:
name: installer
# Appending cursor allows us to replace with new versions
name: installer-{{repl Cursor }}
labels:
app: gitpod
component: gitpod-installer
Expand Down Expand Up @@ -50,6 +51,23 @@ spec:
- |
set -e
echo "Gitpod: Checking for any in-progress installations"
if [ "$(helm status -n {{repl Namespace }} gitpod -o json | jq '.info.status == "deployed"')" = "false" ];
then
echo "Gitpod: Deployment in-progress - clearing"
VERSION="$(helm status -n {{repl Namespace }} gitpod -o json | jq '.version')"
if [ "${VERSION}" -le 1 ];
then
echo "Gitpod: Uninstall application"
helm uninstall -n {{repl Namespace }} gitpod --wait || true
else
echo "Gitpod: Rolling back application"
helm rollback -n {{repl Namespace }} gitpod --wait || true
fi
fi
echo "Gitpod: Generate the base Installer config"
/app/installer init > "${CONFIG_FILE}"
Expand Down Expand Up @@ -215,6 +233,9 @@ spec:
echo "Gitpod: Restarting installation status job"
kubectl delete pod -n {{repl Namespace }} -l component=gitpod-installer-status || true
echo "Gitpod: Killing any outstanding installation jobs"
kubectl delete jobs.batch -n {{repl Namespace }} -l component=gitpod-installer || true
echo "Gitpod: Installer job finished - goodbye"
volumes:
- name: config-patch
Expand Down

0 comments on commit 2149ecb

Please sign in to comment.