[go: up one dir, main page]

Skip to content

Provide the container registry DB by default for our built Postgresql chart

Summary

We can't guarantee that a fresh install is really a fresh install due to the nature of Backup/Restores. But we can make sure our chart always deploys a separate logical registry database.

Proposal

  • DB, User and Extensions provisioning:
    • Use templates/initdb-configmap.yaml to create extra logical DBs, Users and extensions, as I can't find a way to provide DB/User initialization other than the auth: key of the Postgres Bitnamy chart, and it does not seem to support multiple DBs.
    • The global.psql.{main | ci} seem very much coupled to GitLab Rails implementation and configuration. I'm a bit reluctant to extend that. I believe the best approach is to expose global.registry.database to the templates/initdb-configmap.yaml to be able to initialize DB/User/Extensions.
    • We can merge the global into the local registry.database stuff. There's no real reason to deprecate the current configs.
    • Operator V2 relies on external DB anyway.
  • Migrations and SKIP_POST_DEPLOYMENT_MIGRATIONS
    • Already supported
    • We won't support automated post deploy migrations.

Implementation details

  • Provide new global.registry.database.{user, name} keys to the chart.
  • Default there values to whatever the container registry team prefers.
  • Within the registry chart templates functions, if registry.database.{user, name} is set, give preference to that, because it means that users have already configured that for an external instance. If it's not set, take the ones from global.
  • On the templates/initdb-configmap.yaml file, create a new data.init_registry.sh key, which executes psql commands to create the registry user and database, taking their names from the new global keys.
  • If certain DB extensions are required, also create them within the same script.

Relevant links

Edited by João Alexandre Cunha