zalando / postgres-operator

Postgres operator creates and manages PostgreSQL clusters running in Kubernetes
https://postgres-operator.readthedocs.io/
MIT License
4.35k stars 980 forks source link

Unable to create pg_hba.conf config file #1430

Open bflance opened 3 years ago

bflance commented 3 years ago

Please, answer some short questions which should help us to understand your problem / question better?

Unable to create pg_hba.conf file on latest registry.opensource.zalan.do/acid/spilo-13:2.0-p5 based pods. no matter what i do, i always get the same file, and its not properly configured to allow application to connect to database.

# Do not edit this file manually!
# It will be overwritten by Patroni!
local   all             all                                   trust
hostssl all             +zalandos    127.0.0.1/32       pam
host    all             all                127.0.0.1/32       md5
hostssl all             +zalandos    ::1/128            pam
host    all             all                ::1/128            md5
hostssl replication     standby all                md5
hostnossl all           all                all                reject
hostssl all             +zalandos    all                pam
hostssl all             all                all                md5

and we need to add this line: host all all 0.0.0.0/0 md5

or at least edit this file somehow, probably via deployment k8s manifest. I have added this into yaml file, nothing helps

patroni:
  pg_hba: |
    local     all  all  trust
    host      all  all  0.0.0.0/0   md5
    host      all  all  ::1/128     md5
    hostssl   all  all  all  md5
    hostssl   all  +zalandos all        pam
    hostssl   all  +zalandos 0.0.0.0/0  pam
    hostssl   all  +zalandos ::1/128    pam
    hostssl  replication  standby  all md5
    hostnossl all  all  all  reject
FxKu commented 3 years ago

the pg_hba field is of type []string. Try:

patroni:
  pg_hba:
    - local     all  all  trust
    - host      all  all  0.0.0.0/0   md5
    - host      all  all  ::1/128     md5
    - hostssl   all  all  all  md5
    - hostssl   all  +zalandos all        pam
    - hostssl   all  +zalandos 0.0.0.0/0  pam
    - hostssl   all  +zalandos ::1/128    pam
    - hostssl  replication  standby  all md5
    - hostnossl all  all  all  reject