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

Conversation

mrsimonemms
Copy link
Contributor

@mrsimonemms mrsimonemms commented Apr 21, 2022

Description

Under normal circumstances, a KOTS application is able to manage the status of a deployment - presumably through checking an annotation exists on a pod. As we are using the Installer rather than Kustomize/Helm and we cannot add the required annotations, the status will simply check that the resource exists which means that upgrades will find the old resource rather than the new, falsely reporting that the application is deployed.

This uses the Helm status to find out the status of the Helm installation and crashes if it is not "deployed". This gives a KOTS user feedback as to the status of the Gitpod installation job. Unfortunately, it's a little bit brute-force so it show "unavailable" rather than "upgrading", but we're limited by what KOTS provides us.

image

When the Helm deployment has been successfully completed, it deletes the pod. This is important as the Kubernetes job works on an exponential back-off time - if the installation takes a while, this can result in many minutes until it's marked as "deployed". This makes the feedback as fast as possible.

This is the first of various tasks to make KOTS a more reliable and enjoyable experience, especially when not following the Happy Path.

Related Issue(s)

Fixes #9195

How to test

Deploy via KOTS and check the status

Release Notes

[kots]: add an installation status pod

Documentation

@mrsimonemms
Copy link
Contributor Author

mrsimonemms commented Apr 21, 2022

/werft run no-preview publish-to-kots

👍 started the job as gitpod-build-sje-kots-install-checker.2

@mrsimonemms mrsimonemms force-pushed the sje/kots-install-checker branch 2 times, most recently from 0bf712d to 917f5d7 Compare April 21, 2022 13:10
@mrsimonemms
Copy link
Contributor Author

mrsimonemms commented Apr 21, 2022

/werft run no-preview publish-to-kots

👍 started the job as gitpod-build-sje-kots-install-checker.5

@mrsimonemms mrsimonemms force-pushed the sje/kots-install-checker branch from 917f5d7 to 3c3531c Compare April 21, 2022 14:49
@mrsimonemms
Copy link
Contributor Author

mrsimonemms commented Apr 21, 2022

/werft run no-preview publish-to-kots

👍 started the job as gitpod-build-sje-kots-install-checker.7

@mrsimonemms mrsimonemms force-pushed the sje/kots-install-checker branch 2 times, most recently from 060f2fb to 4f603cf Compare April 21, 2022 15:31
@mrsimonemms
Copy link
Contributor Author

mrsimonemms commented Apr 21, 2022

/werft run no-preview publish-to-kots

👍 started the job as gitpod-build-sje-kots-install-checker.10

This uses the Helm status to find out the status of the Helm installation
and crashes if it is not "deployed"
@mrsimonemms mrsimonemms force-pushed the sje/kots-install-checker branch from 4f603cf to 9a33625 Compare April 21, 2022 16:20
@mrsimonemms mrsimonemms marked this pull request as ready for review April 21, 2022 16:21
@mrsimonemms mrsimonemms requested a review from a team April 21, 2022 16:21
@github-actions github-actions bot added the team: delivery Issue belongs to the self-hosted team label Apr 21, 2022
@mrsimonemms mrsimonemms changed the title WIP: [kots]: add an installation status pod [kots]: add an installation status pod Apr 21, 2022
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

@@ -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

Copy link
Contributor

@nandajavarma nandajavarma left a comment

Choose a reason for hiding this comment

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

LGTM! :shipit:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
release-note size/M team: delivery Issue belongs to the self-hosted team
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Configure a full status checker for installations
3 participants