Skip to content

[Feature]: Allow use of Custom Username and Password keys from secret #8758

@mananpreetsingh

Description

@mananpreetsingh

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 custom secrets key value pair to fetch postgres username and password. Usually helm charts provider has the ability to have this in the custom config along with which secret you want to use to pull credentials and also keys and values from that secret.

Describe the solution you'd like

currently this is how cluster is setup, during initdb we can specify a secrets from where it will pull username and password. I needs to have that secrets contain username and password keys that secret should have. But I cannot use if I want to use say these keys from taht secretPOSTGRES_USERNAME and POSTGRES PASSWORD

apiVersion: postgresql.cnpg.io/v1
kind: Cluster
metadata:
  name: cluster-example-initdb
spec:
  instances: 3

  bootstrap:
    initdb:
      database: app
      owner: app
      secret:
        name: app-secret

  storage:
    size: 1Gi

Describe alternatives you've considered

May we we can have config like this so it can support custom keys as well:

apiVersion: postgresql.cnpg.io/v1
kind: Cluster
metadata:
  name: cluster-example-initdb
spec:
  instances: 3

  bootstrap:
    initdb:
      database: app
      owner: app
      secret:
        name: app-secret
        userKey: POSTGRES_USERNAME
        passwordKey: POSTGRES_PASSWORD


  storage:
    size: 1Gi

Additional context

No response

Backport?

Yes

Are you willing to actively contribute to this feature?

No

Code of Conduct

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

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions