Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[kots]: add an installation status pod #9455

Merged
merged 1 commit into from
Apr 22, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 });
Copy link
Contributor Author

@mrsimonemms mrsimonemms Apr 22, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will replace with a job in the KOTS Makefile in separate PR


// 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
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Question: (I haven't tested this yet) when an upgrade is happening wouldn't a new deployment be created of the installation-status deployment too? wouldn't KOTS UI show its status as Ready referring from the old deployment?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Theoretically yes, but only for 10 seconds whilst the sleep waits for the next try. I think that's an acceptable compromise.

In practice, I've not found that to be the case though

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