Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add the ability to load PG password from a secret #22

Closed
xvilo opened this issue Oct 21, 2023 · 2 comments
Closed

Add the ability to load PG password from a secret #22

xvilo opened this issue Oct 21, 2023 · 2 comments

Comments

@xvilo
Copy link

xvilo commented Oct 21, 2023

I'm currently trying to set up a test instance of Uptrace with the helm chart. As I'm not statisfied with the supplied Postgres config, I'm configuring it to work with Zalando's Postgres Operator. Postgres Operator uses CRDs to define Postgres Clusters, Databases, Users, and access. In this case it will create a secret per user with the password. It would be very helpful if one is able to specifiy a secret for reference.

Kubectl example:

kubectl -n uptrace get secret
NAME                                                                     TYPE     DATA   AGE
postgres.uptrace-postgres-cluster.credentials.postgresql.acid.zalan.do   Opaque   2      4m47s
root.uptrace-postgres-cluster.credentials.postgresql.acid.zalan.do       Opaque   2      4m47s
standby.uptrace-postgres-cluster.credentials.postgresql.acid.zalan.do    Opaque   2      4m46s
uptrace.uptrace-postgres-cluster.credentials.postgresql.acid.zalan.do    Opaque   2      4m47s

Secret contents example:

apiVersion: v1
data:
  password: 64 bytes
  username: 7 bytes
kind: Secret
metadata:
  creationTimestamp: '2023-10-21T20:17:33Z'
  labels:
    application: spilo
    cluster-name: uptrace-postgres-cluster
    team: acid
[...]

Ideally, one wants to configure the secret name and the used key in the values. I created this issue for reference for now, might create a PR later 👍

@maxboone
Copy link

As an intermediate solution you could do something like:

env:
  - name: POSTGRES_USER
    valueFrom:
      secretKeyRef:
        name: uptrace.uptrace-postgres-cluster.credentials.postgresql.acid.zalan.do
        key: username
  - name: POSTGRES_PASS
    valueFrom:
      secretKeyRef:
        name: uptrace.uptrace-postgres-cluster.credentials.postgresql.acid.zalan.do
        key: password

config:
    pg:
      addr: postgresql:5432
      user: $POSTGRES_USER
      password: $POSTGRES_PASS
      database: uptrace

However, agreed that it would be better to allow more fine-grained helm templating of the configuration file and only use the config -> toYaml for stuff that needs to be hardcoded per se.

@vmihailenco
Copy link
Member

Closing in favor of #29

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants