Skip to content

Commit e3a03bf

Browse files
PgBouncer: use service FQDN (#635)
1 parent d764aaf commit e3a03bf

File tree

3 files changed

+19
-4
lines changed

3 files changed

+19
-4
lines changed

charts/posthog/templates/_pgbouncer.tpl

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,25 @@
1-
{{/* Common pgbouncer helpers used by PostHog */}}
1+
{{/* Common PgBouncer helpers used by PostHog */}}
22

33
{{/*
4-
Set pgbouncer host
4+
Set PgBouncer FQDN
5+
*/}}
6+
{{- define "posthog.pgbouncer.fqdn" -}}
7+
{{- $fullname := include "posthog.fullname" . -}}
8+
{{- $serviceName := printf "%s-pgbouncer" $fullname -}}
9+
{{- $releaseNamespace := .Release.Namespace -}}
10+
{{- $clusterDomain := .Values.clusterDomain -}}
11+
{{- printf "%s.%s.svc.%s" $serviceName $releaseNamespace $clusterDomain -}}
12+
{{- end -}}
13+
14+
{{/*
15+
Set PgBouncer host
516
*/}}
617
{{- define "posthog.pgbouncer.host" -}}
718
{{- template "posthog.fullname" . }}-pgbouncer
819
{{- end -}}
920

1021
{{/*
11-
Set pgbouncer port
22+
Set PgBouncer port
1223
*/}}
1324
{{- define "posthog.pgbouncer.port" -}}
1425
6543

charts/posthog/templates/_snippet-initContainers-wait-for-service-dependencies.tpl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
done
2323
{{ end }}
2424

25-
until (nc -vz "{{ include "posthog.pgbouncer.host" . }}.$(cat /var/run/secrets/kubernetes.io/serviceaccount/namespace).svc.cluster.local" {{ include "posthog.pgbouncer.port" . }});
25+
until (nc -vz "{{ include "posthog.pgbouncer.fqdn" . }}" {{ include "posthog.pgbouncer.port" . }});
2626
do
2727
echo "waiting for PgBouncer"; sleep 1;
2828
done

charts/posthog/values.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2579,3 +2579,7 @@ busybox:
25792579
## - myRegistryKeySecretName
25802580
##
25812581
pullSecrets: []
2582+
2583+
2584+
# -- Kubernetes cluster domain name
2585+
clusterDomain: cluster.local

0 commit comments

Comments
 (0)