Azure/azure-service-operator

Feature: Support DBforPostgreSQL FlexibleServersDatabase to configure owner or user with permission to the database

Opened this issue · 4 comments

It would be helpful if the owner (user) of a FlexibleServersDatabase (PostgreSQL) could be specified. Additionally, it would be also helpful if additional users with can be specified with permissions to access the database.

Is this not already handled by User?

To my understanding you can create a database with RoleOptionsSpec by providing the createDb: true field. But I haven’t found an option to specify an owner or users who should have access to the database when creating a database with the FlexibleServersDatabase template.

Please correct me if I’m wrong but to my understanding the owner in the FlexibleServersDatabase template relates to the FlexibleServer itself.

I think you may be misunderstanding what the createDb option of RoleOptionsSpec is about. That section of the User is about what permissions the User has. So setting createDb means that the user you're creating will have the permission to create databases.

It doesn't actually create any databases. It just grants the perms for that user to do so.

You're correct that the owner of a FlexibleServersDatabase is the FlexibleServer. Not sure if you've read our article on ownership, but that describes what this "ownership" is about. It's not about what users are owners or permissions - it's about where (into which FlexibleServer) the database is being provisoned.

With all of the above said, I think your point is that we are lacking the ability to set permissions per database on the existing User object. Looking here, the line I think we don't support is:

GRANT ALL PRIVILEGES ON DATABASE TO <db_user>;

Is that what you're saying?

Thank you for the clarification. The summary of my request is correct. In addition, it would be nice to achieve this behaviour for multiple users.