diff --git a/charts/timescaledb-multinode/templates/statefulset-timescaledb-accessnode.yaml b/charts/timescaledb-multinode/templates/statefulset-timescaledb-accessnode.yaml index dd06740a..ba690782 100644 --- a/charts/timescaledb-multinode/templates/statefulset-timescaledb-accessnode.yaml +++ b/charts/timescaledb-multinode/templates/statefulset-timescaledb-accessnode.yaml @@ -79,6 +79,11 @@ spec: echo "*:*:*:postgres:${POSTGRES_PASSWORD_DATA_NODE}" > "${PGDATA}/../.pgpass" chown postgres:postgres "${PGDATA}/../.pgpass" "${PGDATA}/postgresql_helm_customizations.conf" chmod 0600 "${PGDATA}/../.pgpass" + {{- if .Values.internalIpRange }} + echo "Adding {{ .Values.internalIpRange }} in pg_hba.conf" + grep -qxF "host all all {{ .Values.internalIpRange }} trust" "pg_hba.conf" \ + || echo "host all all {{ .Values.internalIpRange }} trust" >> pg_hba.conf + {{- end }} volumeMounts: - name: storage-volume mountPath: "{{ .Values.persistentVolume.mountPath }}" diff --git a/charts/timescaledb-multinode/templates/statefulset-timescaledb-datanode.yaml b/charts/timescaledb-multinode/templates/statefulset-timescaledb-datanode.yaml index b1661168..f40a9cf4 100644 --- a/charts/timescaledb-multinode/templates/statefulset-timescaledb-datanode.yaml +++ b/charts/timescaledb-multinode/templates/statefulset-timescaledb-datanode.yaml @@ -71,6 +71,11 @@ spec: echo "Writing custom PostgreSQL Parameters to ${PGDATA}/postgresql_helm_customizations.conf" echo "cluster_name = '$(hostname)'" > "${PGDATA}/postgresql_helm_customizations.conf" echo "${POSTGRESQL_CUSTOM_PARAMETERS}" | sort >> "${PGDATA}/postgresql_helm_customizations.conf" + {{- if .Values.internalIpRange }} + echo "Adding {{ .Values.internalIpRange }} in pg_hba.conf" + grep -qxF "host all all {{ .Values.internalIpRange }} trust" "pg_hba.conf" \ + || echo "host all all {{ .Values.internalIpRange }} trust" >> pg_hba.conf + {{- end }} # The TimescaleDB extension should not be available by default, as this interferes with the bootstrapping # done by the access nodes. Therefore we drop the extensions from template1 echo "DROP EXTENSION timescaledb" | /docker-entrypoint.sh postgres --single -D "${PGDATA}" template1 diff --git a/charts/timescaledb-multinode/values.yaml b/charts/timescaledb-multinode/values.yaml index f991dbd3..ce65a6d2 100644 --- a/charts/timescaledb-multinode/values.yaml +++ b/charts/timescaledb-multinode/values.yaml @@ -121,3 +121,6 @@ serviceAccount: # The name of the ServiceAccount to use. # If not set and create is true, a name is generated using the fullname template name: + +# This allows to specify the internal ip range of your cluster to add them to pg_hba.conf +internalIpRange: