Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions charts/posthog/templates/_posthog.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,14 @@
{{- end -}}
{{- end }}

{{- define "posthog.clusterName" }}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't see much value of having this if we anyway specify a default in the values

{{- if .Values.clusterName -}}
{{- .Values.clusterName -}}
{{- else -}}
cluster
{{- end -}}
{{- end }}

{{- define "snippet.posthog-env" }}
- name: SECRET_KEY
valueFrom:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
{{ if .Values.clickhouse.enabled }}
until (
NODES_COUNT=$(wget -qO- \
"http://$CLICKHOUSE_USER:$CLICKHOUSE_PASSWORD@{{ include "posthog.clickhouse.fullname" . }}.$(cat /var/run/secrets/kubernetes.io/serviceaccount/namespace).svc.cluster.local:8123" \
"http://$CLICKHOUSE_USER:$CLICKHOUSE_PASSWORD@{{ include "posthog.clickhouse.fullname" . }}.$(cat /var/run/secrets/kubernetes.io/serviceaccount/namespace).svc.{{ include "posthog.clusterName" . }}.local:8123" \
--post-data "SELECT count() FROM clusterAllReplicas('{{ .Values.clickhouse.cluster }}', system, one)"
)
test ! -z $NODES_COUNT && test $NODES_COUNT -eq {{ mul .Values.clickhouse.layout.shardsCount .Values.clickhouse.layout.replicasCount }}
Expand All @@ -22,20 +22,20 @@
done
{{ end }}

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

{{ if .Values.postgresql.enabled }}
until (nc -vz "{{ include "posthog.postgresql.host" . }}.$(cat /var/run/secrets/kubernetes.io/serviceaccount/namespace).svc.cluster.local" {{ include "posthog.postgresql.port" . }});
until (nc -vz "{{ include "posthog.postgresql.host" . }}.$(cat /var/run/secrets/kubernetes.io/serviceaccount/namespace).svc.{{ include "posthog.clusterName" . }}.local" {{ include "posthog.postgresql.port" . }});
do
echo "waiting for PostgreSQL"; sleep 1;
done
{{ end }}

{{ if .Values.redis.enabled }}
until (nc -vz "{{ include "posthog.redis.host" . }}.$(cat /var/run/secrets/kubernetes.io/serviceaccount/namespace).svc.cluster.local" {{ include "posthog.redis.port" . }});
until (nc -vz "{{ include "posthog.redis.host" . }}.$(cat /var/run/secrets/kubernetes.io/serviceaccount/namespace).svc.{{ include "posthog.clusterName" . }}.local" {{ include "posthog.redis.port" . }});
do
echo "waiting for Redis"; sleep 1;
done
Expand All @@ -48,7 +48,7 @@
KAFKA_HOST=$(echo $KAFKA_BROKERS | cut -f1 -d:)
KAFKA_PORT=$(echo $KAFKA_BROKERS | cut -f2 -d:)

until (nc -vz "$KAFKA_HOST.$(cat /var/run/secrets/kubernetes.io/serviceaccount/namespace).svc.cluster.local" $KAFKA_PORT);
until (nc -vz "$KAFKA_HOST.$(cat /var/run/secrets/kubernetes.io/serviceaccount/namespace).svc.{{ include "posthog.clusterName" . }}.local" $KAFKA_PORT);
do
echo "waiting for Kafka"; sleep 1;
done
Expand Down
2 changes: 1 addition & 1 deletion charts/posthog/templates/clickhouse-backup-cronjob.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ spec:
- |
until (
wget -qO- \
"http://$CLICKHOUSE_USER:$CLICKHOUSE_PASSWORD@clickhouse-posthog.$(cat /var/run/secrets/kubernetes.io/serviceaccount/namespace).svc.cluster.local:8123" \
"http://$CLICKHOUSE_USER:$CLICKHOUSE_PASSWORD@clickhouse-posthog.$(cat /var/run/secrets/kubernetes.io/serviceaccount/namespace).svc.{{ include "posthog.clusterName" . }}.local:8123" \
--post-data "SELECT count() FROM clusterAllReplicas('posthog', system, one)"
); do
echo "waiting for ClickHouse cluster to become available"; sleep 1;
Expand Down
3 changes: 3 additions & 0 deletions charts/posthog/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ notificationEmail:
# This is used to e.g. generate shareable links to Dashboards.
siteUrl:

# -- Cluster name used for internal DNS resolution (svc.{{clusterName}}.local)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
# -- Cluster name used for internal DNS resolution (svc.{{clusterName}}.local)
# -- Kubernetes cluster domain name

clusterName: cluster
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
clusterName: cluster
clusterDomain: cluster.local


image:
# -- PostHog image repository to use.
repository: posthog/posthog
Expand Down