lwolf / stolon-chart

Kubernetes Helm chart to deploy HA Postgresql cluster based on Stolon
MIT License
105 stars 39 forks source link

cannot set STKEEPER_PG_LISTEN_ADDRESS to * #42

Open samene opened 4 years ago

samene commented 4 years ago

What happened: I am deploying the stolon helm chart with istio proxy sidecar injection enabled. As per istio documentation here we need to set the listen address to so that clients can connect to the database. To do that I set the environment variable ```STKEEPER_PG_LISTEN_ADDRESS ``` The keeper however still continues to listen to the $POD_IP.

    Ports:         8080/TCP, 5432/TCP
    Host Ports:    0/TCP, 0/TCP
    Command:
      /bin/bash
      -ec
      # Generate our keeper uid using the pod index
      IFS='-' read -ra ADDR <<< "$(hostname)"
      export STKEEPER_UID="keeper${ADDR[-1]}"
      export POD_IP=$(hostname -i)
      export STKEEPER_PG_LISTEN_ADDRESS=$POD_IP
      export STOLON_DATA=/stolon-data
      chown stolon:stolon $STOLON_DATA
      exec gosu stolon stolon-keeper --data-dir $STOLON_DATA

    State:          Running
      Started:      Wed, 14 Oct 2020 16:26:12 +0530
    Ready:          True
    Restart Count:  0
    Environment:
      POD_NAME:                         empirix-stolon-keeper-0 (v1:metadata.name)
      STKEEPER_CLUSTER_NAME:            empirix-stolon
      STKEEPER_STORE_BACKEND:           kubernetes
      STKEEPER_KUBE_RESOURCE_KIND:      configmap
      STKEEPER_PG_REPL_USERNAME:        <set to the key 'pg_repl_username' in secret 'db-replica'>  Optional: false
      STKEEPER_PG_REPL_PASSWORDFILE:    /etc/secrets/stolon-db-replica/pg_repl_password
      STKEEPER_PG_SU_USERNAME:          <set to the key 'pg_su_username' in secret 'db-admin'>  Optional: false
      STKEEPER_PG_SU_PASSWORDFILE:      /etc/secrets/stolon-db-admin/pg_su_password
      STKEEPER_METRICS_LISTEN_ADDRESS:  0.0.0.0:8080
      STKEEPER_DEBUG:                   false
      STKEEPER_PG_LISTEN_ADDRESS:       *
    Mounts:
      /etc/secrets/stolon-db-admin from stolon-secret-db-admin (rw)
      /etc/secrets/stolon-db-replica from stolon-secret-db-replica (rw)
      /stolon-data from data (rw)

What you expected to happen: Setting the STKEEPER_PG_LISTEN_ADDRESS to * should be honoured and not be overwritten by the command

Without this working the database cannot work with istio sidecar injection enabled.

I need to set these two variables, but they are not possible

    - name: STKEEPER_PG_LISTEN_ADDRESS
      value: "*"
    - name: STKEEPER_PG_ADVERTISE_ADDRESS
      value: "$POD_IP"

How to reproduce it (as minimally and precisely as possible):

Anything else we need to know?:

Environment:

lwolf commented 4 years ago

thanks for the detailed issue. sounds like a right thing to do.

samene commented 4 years ago

any chance of having a fix?

lwolf commented 4 years ago

Can't provide any ETA, but feel free to create a PR