Database Check Job
A database check job added to an application's manifests repository can be used to validate the following:
- An application's RDS database has been provisioned.
- The necessary credentials and environment variables have been made available in the application's namespace.
- Admin, read-write, and read-only user privileges have been set correctly.
Step-by-Step Guide
To add a database check to an application's manifests repository, follow the instructions below.
- Copy one of the below configuration trees into the application's manifests repository from mission-tools
- Postgres
- MySQL
- Reference the contents of the
debug-pods/< postgres/mysql >
directory in the repository's mainkustomization.yaml
.
That's it! There is no additional, per-application configuration required.
Application Manifests Directory Tree Within Database Check:
PostgreSQL | MySQL |
---|---|
![]() | ![]() |
FAQ
How does the database check job work?
The job includes a main bash script, used as a Docker entry point, along with a set of SQL test scripts.
First, the bash script (named postgresql-check.sh
or mysql-check.sh
) generates a password file (named .pgpass
or .mysql_admin_auth
) with entries for admin, read-write, and read-only users. The script then runs each of the SQL tests using its run_sql_file
function. The job prints test results to STDOUT, making them available to the application team through ArgoCD.
How can I add new SQL queries to test?
To test additional SQL queries not included in the trees above, follow these steps:
- Add a new file containing the SQL query to test to the repository's tests folder (i.e.,
debug-pods/<postgres/mysql>/tests
). - In
debug-pods/<postgres/mysql>/kustomization.yaml
, update the configMapGenerator to include the new file. - In
debug-pods<postgres/mysql>/job.yaml
, update the volumes.configMap.items section to include a key and path for the new file. - In
debug-pods/<postgres/mysql>/scripts/<postgresql-check.sh/mysql-check.sh>
, add calls to the new SQL file in whichever user sections are appropriate.