[feature request] add `postgres-instance` provisioner based on postgres provisioner
In some cases, the workload expects to receive an admin user credentials for a database host and the app will create its own database within the instance. We usually call this an -instance resource, and it has the same outputs except that it provides the root user and password and without the database/name output.
This should be based on the existing type=postgres default provisioner.
Good example with Backstage indeed, thanks for capturing this!
@astromechza, as a side note here, in the score-k8s's default provisioner, the implementation is different. I'm wondering in which direction we should go though:
- Like current
score-k8s(i.e. allowing thepostgresto create databases)? - Or like recommended in this current issue by adding a new
postgres-instancebut them have this consistent inscore-k8sfor consistency?
Also, quid of mysql, mssql, etc. where we should go with this approach too for consistency?
@mathieu-benoit For consistency I think we should make the score-k8s one more advanced and run as a non super user. And then the postgres-instance one can produce a super user and no explicit database field.
Bonjour @mathieu-benoit @astromechza Can I contribute to this issue ?
@rabelmervin sure. See the existing postgres provisioner here: https://github.com/score-spec/score-compose/blob/140cab02dcadb08bd0b8239cc00482d5080b35a9/internal/command/default.provisioners.yaml#L103. I suggest you copy that one, remove any database specific stuff from it and store its state in the local resource state rather than shared state.
I know in my initial issue description I mentioned that it should share state with the Postgres database provisioner, however, I think that might be too complex to be worth it right now — and quite hard to get right with just the existing template language.
Done in there https://github.com/score-spec/score-compose/pull/284, was also added in https://github.com/score-spec/score-k8s/pull/179. And these unblocked the implementation of https://medium.com/@mabenoit/deploy-backstage-with-score-45bb2d7c2d90.