-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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 database to preflight checks #9759
Conversation
d96f0d5
to
9b8a2d2
Compare
17feeab
to
4e94f59
Compare
aaaebe5
to
b79a580
Compare
/werft run no-preview publish-to-kots 👍 started the job as gitpod-build-sje-kots-config-check.10 |
/werft run no-preview publish-to-kots 👍 started the job as gitpod-build-sje-kots-config-check.11 |
b79a580
to
9271a07
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for adding this check. That is very useful! 🚀
Added a few comments. The question, of whether this will work for air-gap is the most important one. I would expect that is works. However, we need to make sure before we release it.
The other comments can be handled in follow-up issues and are no blockers, in my opinion.
@@ -70,6 +70,7 @@ packages: | |||
- components/ws-manager:docker | |||
- components/ws-proxy:docker | |||
- components/ide-proxy:docker | |||
- components/kots-config-check/database:docker |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Small optimization suggestion:
For deploying a preview env, we don't need to build this image. We need this only when we deploy a KOTS release. Building this only when the publish-to-kots
werft flag is set would help us to not extend the time to wait for a preview env for every dev.
Note: We can handle this in a follow up PR and create an issue and merge the PR as is.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, that would be a good optimisation. Is there an example I can use to follow as I didn't know this was possible?
@@ -7,6 +7,19 @@ metadata: | |||
name: gitpod | |||
spec: | |||
collectors: | |||
- run: | |||
collectorName: database | |||
image: eu.gcr.io/gitpod-core-dev/build/kots-config-check/database:sje-kots-config-check.9 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think, in .werft/jobs/build/build-and-publish.ts
we need to set the version tag in this file, right?
We could get the version with something like this:
const kotsConfigCheckDatabaseTag = exec(`docker run --rm eu.gcr.io/gitpod-core-dev/build/versions:${jobConfig.version} cat /versions.yaml | yq r - 'components.kots-config-check.database.version'`, { silent: true })
.stdout.trim();
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think so. My understanding is that this will only be built by Werft if it detects a change - as this is very unlikely to change, this won't be built on each push. I think this is more akin to our .gitpod.yml
image
@@ -7,6 +7,19 @@ metadata: | |||
name: gitpod | |||
spec: | |||
collectors: | |||
- run: | |||
collectorName: database | |||
image: eu.gcr.io/gitpod-core-dev/build/kots-config-check/database:sje-kots-config-check.9 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In .werft/jobs/build/build-and-publish.ts
we need to set the version tag in this file. (same as above)
--host="${DB_HOST}" \ | ||
--port="${DB_PORT}" \ | ||
--execute="SELECT VERSION();" \ | ||
--silent \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Random thought: Do we still get enough log data with the silent
flag for the support bundle or should we remove this flag?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes. The --silent
flag basically removes all the connection information. At this point, we're only interested in the version so we can assign it to the version_query
variable. It is therefore correct that we have the --silent
flag.
Also, there's actually no way of debugging a preflight check so we are limited to just putting the data in a known format so we can perform regex queries on it.
This checks the connection and the version is correct, based upon the configuration given.
9271a07
to
5f69faf
Compare
/werft run 👍 started the job as gitpod-build-sje-kots-config-check.14 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the clarifications. Ship it! 🚢 😆
🚢 🚢 🚢 🚢 🚢 🚢 🚢 🚢 🚢 🚢 🚢 🚢 |
Description
Add a database check to the KOTS preflight checks. This validates that the given configuration is able to make a connection to a MySQL database called
gitpod
and that the version is5.7.x
- this version check is considered a warning because it's possible that we get anomalies with the versionsFailed
Pass
Related Issue(s)
Fixes #9931
How to test
Install with KOTS - the version to use is
sje-kots-config-check.11
insje/kots-config-check
channelNow change the config values for database in KOTS:
0.0.0.0/0
)You can create a support bundle and look in the file explorer for
database/database.log
to see the database that's outputRelease Notes
Documentation