Skip to content

[Feature]: Cluster without default user #3242

Description

@baurmatt

Is there an existing issue already for this feature request/idea?

  • I have searched for an existing issue, and could not find anything. I believe this is a new feature request to be evaluated.

What problem is this feature going to solve? Why should it be added?

We use the new declarative role management to create an admin user:

...
  managed:
    roles:
    - connectionLimit: -1
      createdb: true
      createrole: true
      ensure: present
      inherit: true
      login: true
      name: admin
      passwordSecret:
        name: cnpg-admin-secret

The user of the DB is supposed to handle user/db creation them self hence the default app user/db created by bootstrap.initdb isn't needed.

Describe the solution you'd like

We like to see an option where none of the bootstrap options (initdb/pg_basebackup/recovery) is used e.g. by configuring bootstrap: false.

Describe alternatives you've considered

I've checked, but couldn't find any option to disable the app db/user creation.

Additional context

No response

Backport?

No

Code of Conduct

  • I agree to follow this project's Code of Conduct

Activity

  1. added
    triage
    on Oct 30, 2023
  2. gbartolini commented on Oct 31, 2023

    @gbartolini
    Contributor

    We like to see an option where none of the bootstrap options (initdb/pg_basebackup/recovery)

    What does that even mean?

  3. gbartolini commented on Oct 31, 2023

    @gbartolini
    Contributor

    Oh ... I get it now. We cannot skip initdb as that's required by Postgres to create a cluster. You simply want, as part of the initdb bootstrap, to avoid creating an app user and database. Is this correct?

  4. baurmatt commented on Oct 31, 2023

    @baurmatt
    ContributorAuthor

    That's correct, yes. Sorry for being inaccurate about this!

  5. cterence commented on Feb 13, 2024

    @cterence

    We are having the same problem with clusters bootstrapped from external non-CNPG databases. The operator keeps trying to alter the app role after booting the base and fails with ERROR: role \"app\" does not exist.
    We don't use the app database and role so we would like them to be togglable.

  6. T1mK commented on Nov 22, 2024

    @T1mK

    I also get this error after using initdb.import from a non-cnpg deployment of cnpg that doesn't have an "app" anything. I'm importing one database and one role, which works flawlessly. The database, owner, and password all appear correct and work. However, the -app secret gets created nevertheless with the username as "app" and the Reconciler Error regularly appearing stating that <"error":"while updating database owner password: ERROR: role "app" does not exist (SQLSTATE 42704)"> .

    Is there a known documented solution to this that I'm missing, or some magic workaround other than manually creating the "app" role to make cnpg happy once again?

    Thanks a lot for you help!

  7. github-actions commented on Feb 15, 2025

    @github-actions
    Contributor

    This issue is stale because it has been open for 60 days with no activity.

  8. baurmatt commented on Feb 17, 2025

    @baurmatt
    ContributorAuthor

    Dear @github-actions, this issues might not have been touch in 60 days but is still a requested feature from 3 user which certainly still like to see it implemented.

  9. github-actions commented on May 8, 2025

    @github-actions
    Contributor

    This issue is stale because it has been open for 60 days with no activity.

  10. baurmatt commented on May 12, 2025

    @baurmatt
    ContributorAuthor

    Dear @github-actions, this issues might not have been touch in 60 days but is still a requested feature from 3 user which certainly still like to see it implemented.

  11. 14 remaining items

  12. pschichtel commented on Sep 15, 2025

    @pschichtel

    @dosubot I think @mnencia's change only partially implemented this.

  13. dosubot commented on Sep 15, 2025

    @dosubot

    You're correct—@mnencia's proposal to deprecate the default creation of the 'app' user/database is only partially implemented. The operator still defaults to creating the 'app' user, database, and the {cluster-name}-app secret unless you explicitly unset or remove the bootstrap database and owner fields in your cluster spec. This legacy behavior persists even after restore/import operations, except in some specialized cases like monolith imports, where improvements are underway but not fully resolved yet. There isn't a simple flag or configuration to globally suppress all legacy 'app' resource creation at this time, and the issue is recognized by maintainers for further discussion and resolution in future releases. For now, explicit configuration is required to avoid these defaults.
    Relevant code logic | Issue tracking monolith import bug

    To reply, just mention @dosu.


    Docs are dead. Just use Dosu.

    Leave Feedback Ask Dosu about cloudnative-pg Share Dosu with your team

  14. baurmatt commented on Sep 16, 2025

    @baurmatt
    ContributorAuthor

    @dosubot This feature request is still relevant.

  15. dosubot commented on Sep 16, 2025

    @dosubot

    You're right—this feature request is still open and only partially addressed. By default, CloudNativePG continues to create the 'app' user, database, and secret unless you explicitly set the bootstrap initdb database and owner to something else (like 'postgres') and manage users via secrets and post-init SQL. There is no global flag or option to fully suppress legacy 'app' resource creation yet, and the proposal to deprecate these defaults is still under discussion and not fully implemented. Declarative role and database management is recommended for explicit control, but it doesn't currently prevent the default 'app' resources from being created by default. For now, explicit configuration is required to avoid these defaults source.

    To reply, just mention @dosu.


    Share context across your team and agents. Try Dosu.

    Leave Feedback Learn about cloudnative-pg with Dosu Add Dosu to your team

  16. baurmatt commented on Sep 16, 2025

    @baurmatt
    ContributorAuthor

    @dosubot Then please remove the Stale label...

  17. dosubot commented on Sep 16, 2025

    @dosubot

    Sorry, I am not sure how to help. Please re-word your message and try again.

    To reply, just mention @dosu.


    Share context across your team and agents. Try Dosu.

    Leave Feedback Learn about cloudnative-pg with Dosu Add Dosu to your team

  18. baurmatt commented on Sep 16, 2025

    @baurmatt
    ContributorAuthor

    @dosu Please remove the Stale label on this issue. It has been added by you 18 hours ago.

  19. BjoernPetersen commented on Nov 12, 2025

    @BjoernPetersen

    @dosubot this issue is not stale

  20. dosubot commented on Nov 12, 2025

    @dosubot

    I don't have the ability to remove labels or perform repository actions. The "stale" label is managed by the GitHub Actions bot or repository maintainers. If you want the label removed, someone with write access to the repository will need to do it. The issue itself is still relevant and has been recognized by maintainers.

    To reply, just mention @dosu.


    Share context across your team and agents. Try Dosu.

    Leave Feedback Learn about cloudnative-pg with Dosu Add Dosu to your team

  21. acelinkio commented on Apr 16, 2026

    @acelinkio
    4. **Documentation**: Update all relevant documentation and examples to encourage the use of [Declarative Database Management](https://cloudnative-pg.io/documentation/1.26/declarative_database_management/) for databases and [Declarative Role Management](https://cloudnative-pg.io/documentation/1.26/declarative_role_management/) for roles, making database and user management explicit and fully declarative.
    

    Additional Considerations

    If you currently use postInitApplicationSQL or postInitApplicationSQLRef in your initialization strategy, please note that Declarative Database Management does not yet provide an equivalent mechanism for creating an application database as part of the bootstrap.

    Is there a issue/discussion/roadmap to watch these declarative database/schema management at? be interested in seeing what others thoughts are on:

    • use of public schema (would love to have the option to NOT create it by default)
    • handling database search_path
    • multi-tenant postgres opinionation
  22. gbartolini commented on Jun 19, 2026

    @gbartolini
    Contributor

    Is there a known documented solution to this that I'm missing, or some magic workaround other than manually creating the "app" role to make cnpg happy once again?

    See https://cloudnative-pg.io/docs/current/database_import#the-microservice-type

    Specifically:

    The microservice approach adheres to CloudNativePG conventions and defaults for the destination cluster. If you do not set initdb.database or initdb.owner for the destination cluster, both parameters will default to app.

  23. moved this to Todo in Roadmapon Jun 19, 2026
  24. added this to the Now milestone on Jun 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

Staleenhancement 🪄no-stale

Projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions