Skip to content

Commit

Permalink
[kots]: add an installation status pod
Browse files Browse the repository at this point in the history
This uses the Helm status to find out the status of the Helm installation
and crashes if it is not "deployed"
  • Loading branch information
Simon Emms authored and roboquat committed Apr 22, 2022
1 parent beaf1b4 commit 02a04a7
Show file tree
Hide file tree
Showing 5 changed files with 65 additions and 3 deletions.
1 change: 1 addition & 0 deletions .werft/jobs/build/build-and-publish.ts
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ function publishKots(werft: Werft, jobConfig: JobConfig) {

// Set the tag to the current version
exec(`yq w -i ${REPLICATED_YAML_DIR}/gitpod-installer-job.yaml ${INSTALLER_JOB_IMAGE} ${image}:${jobConfig.version}`, { slice: phases.PUBLISH_KOTS });
exec(`yq w -i ${REPLICATED_YAML_DIR}/gitpod-installation-status.yaml ${INSTALLER_JOB_IMAGE} ${image}:${jobConfig.version}`, { slice: phases.PUBLISH_KOTS });

// Generate the logo
exec(`make logo -C ${REPLICATED_DIR}`, { slice: phases.PUBLISH_KOTS });
Expand Down
2 changes: 1 addition & 1 deletion install/installer/leeway.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
FROM alpine:3.15
COPY --from=alpine/helm:3.8.0 /usr/bin/helm /usr/bin/helm
COPY install-installer--app/installer install-installer--app/provenance-bundle.jsonl /app/
RUN apk add --no-cache curl yq \
RUN apk add --no-cache curl jq yq \
&& curl -L "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl" -o /usr/local/bin/kubectl \
&& chmod +x /usr/local/bin/kubectl
ENTRYPOINT [ "/app/installer" ]
Expand Down
57 changes: 57 additions & 0 deletions install/kots/manifests/gitpod-installation-status.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
# Copyright (c) 2022 Gitpod GmbH. All rights reserved.
# Licensed under the MIT License. See License-MIT.txt in the project root for license information.

apiVersion: apps/v1
kind: Deployment
metadata:
name: installation-status
labels:
app: gitpod
component: gitpod-installer-status
spec:
replicas: 1
selector:
matchLabels:
app: gitpod
component: gitpod-installer-status
strategy:
rollingUpdate:
maxSurge: 1
maxUnavailable: 0
type: RollingUpdate
template:
metadata:
labels:
app: gitpod
component: gitpod-installer-status
spec:
restartPolicy: Always
serviceAccountName: installer
containers:
- name: installation-status
# This will normally be the release tag
image: "eu.gcr.io/gitpod-core-dev/build/installer:main.2968"
command:
- /bin/sh
- -c
args:
- |
set -e
while true
do
echo "Checking installation status"
if [ "$(helm status -n {{repl Namespace }} gitpod -o json | jq '.info.status == "deployed"')" != "true" ];
then
echo "Gitpod: Installation not complete"
exit 1
fi
echo "Sleeping for 10 seconds"
sleep 10
done
resources:
limits:
memory: "128Mi"
cpu: "500m"
7 changes: 5 additions & 2 deletions install/kots/manifests/gitpod-installer-job.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ spec:
restartPolicy: OnFailure
containers:
- name: installer
# This will normally be the release tag - using this tag as need the license evaluator
image: 'eu.gcr.io/gitpod-core-dev/build/installer:sje-airgapped.0'
# This will normally be the release tag
image: 'eu.gcr.io/gitpod-core-dev/build/installer:main.2968'
volumeMounts:
- mountPath: /config-patch
name: config-patch
Expand Down Expand Up @@ -212,6 +212,9 @@ spec:
gitpod \
"${GITPOD_OBJECTS}"
echo "Gitpod: Restarting installation status job"
kubectl delete pod -n {{repl Namespace }} -l component=gitpod-installer-status || true
echo "Gitpod: Installer job finished - goodbye"
volumes:
- name: config-patch
Expand Down
1 change: 1 addition & 0 deletions install/kots/manifests/kots-app.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ spec:
- deployment/dashboard
- deployment/ide-proxy
- deployment/image-builder-mk3
- deployment/installation-status
- deployment/proxy
- deployment/server
- deployment/ws-manager
Expand Down

0 comments on commit 02a04a7

Please sign in to comment.