helm-charts icon indicating copy to clipboard operation
helm-charts copied to clipboard

Pgadmin error while doing backup with pgpass file

Open aver33 opened this issue 1 year ago • 0 comments

Describe the bug I am using pgadmin4 chart version 1.15.2. Helm version: 3.10.1. Kubernetes version: 1.25. In my configuration I am using pgpassfile. It works for connect to any databases. But if I am trying to do backup database via context menu in UI, I get the error:

Backing up an object on the server 'someServer1 (someHost1:5432)' from database 'someDb1' Running command: /usr/local/pgsql-14/pg_dump --file "/var/lib/pgadmin/storage/pgadmin123/test" --host "someHost1" --port "5432" --username "someUser1" --no-password --verbose --role "someUser1" --format=c --blobs "someDb1"

My values seems like that (I am using pgadmin4 via dependency):

pgadmin4:
  serverDefinitions:
    enabled: true
    servers:
      firstServer:
        Name: "someServer1"
        Group: "Servers"
        Host: "someHost1"
        PassFile: "../../pgpass"
        Port: 5432
        MaintenanceDB: "someDb1"
        Username: "someUser1"
        SSLMode: "disable"
      secondServer:
        Name: "someServer2"
        Group: "Servers"
        Host: "someHost2"
        PassFile: "../../pgpass"
        Port: 5432
        MaintenanceDB: "someDb2"
        Username: "someUser2"
        SSLMode: "disable"
        ...
  env:
    email: "someValue"
    password: "somePassword"
  extraSecretMounts:
    - name: passfile-pgadmin
      secret: passfile-pgadmin
      mountPath: /pgpass
  extraInitContainers: |
    - name: prepare-pgpass
      image: docker.io/dpage/pgadmin4:6.2
      command: [ 'sh', '-c', "cp /pgpass /var/lib/pgadmin/pgpass && chown pgadmin:pgadmin /var/lib/pgadmin/pgpass && chmod 600 /var/lib/pgadmin/pgpass " ]
      volumeMounts:
        - name: pgadmin-data
          mountPath: /var/lib/pgadmin
        - name: passfile-pgadmin
          subPath: pgpass
          mountPath: /pgpass
      securityContext:
        runAsUser: 0

If I do this without pgpassfile, backup is successful. Also this problem occurs when I'm trying to execute script (for example, materialized view) via context menu. I am getting the error:

psql: error: connection to server at "someHost1" (someIP1), port 5432 failed: fe_sendauth: no password supplied.

Looks like this is a problem with all commands that using psql. Psql is not seeing passwords from pgpassfile and return the errors.

aver33 avatar Jun 12 '23 11:06 aver33