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 23, 2022
1 parent d16776c commit 52ebc12
Showing 1 changed file with 26 additions and 3 deletions.
29 changes: 26 additions & 3 deletions install/kots/manifests/gitpod-installer-job.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,24 +7,27 @@
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
cursor: "{{repl Cursor }}"
spec:
ttlSecondsAfterFinished: 60
ttlSecondsAfterFinished: 0
template:
metadata:
labels:
app: gitpod
component: gitpod-installer
cursor: "{{repl Cursor }}"
spec:
serviceAccountName: installer
restartPolicy: OnFailure
containers:
- name: installer
# This will normally be the release tag
image: 'eu.gcr.io/gitpod-core-dev/build/installer:main.2968'
image: "eu.gcr.io/gitpod-core-dev/build/installer:main.2968"
volumeMounts:
- mountPath: /config-patch
name: config-patch
Expand All @@ -50,6 +53,26 @@ spec:
- |
set -e
echo "Gitpod: Killing any in-progress installations"
kubectl delete jobs.batch -n {{repl Namespace }} -l component=gitpod-installer,cursor!={{repl Cursor }} --force --grace-period 0 || true
kubectl delete pod -n {{repl Namespace }} -l component=gitpod-installer,cursor!={{repl Cursor }} --force --grace-period 0 || true
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

0 comments on commit 52ebc12

Please sign in to comment.