Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add value for Kubernetes cluster name #628

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
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
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.{{ .Values.clusterName }}.local:8123" \
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
"http://$CLICKHOUSE_USER:$CLICKHOUSE_PASSWORD@{{ include "posthog.clickhouse.fullname" . }}.$(cat /var/run/secrets/kubernetes.io/serviceaccount/namespace).svc.{{ .Values.clusterName }}.local:8123" \
"http://$CLICKHOUSE_USER:$CLICKHOUSE_PASSWORD@{{ include "posthog.clickhouse.fullname" . }}.$(cat /var/run/secrets/kubernetes.io/serviceaccount/namespace).svc.{{ .Values.clusterDomain }}: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.{{ .Values.clusterName }}.local" {{ include "posthog.pgbouncer.port" . }});
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
until (nc -vz "{{ include "posthog.pgbouncer.host" . }}.$(cat /var/run/secrets/kubernetes.io/serviceaccount/namespace).svc.{{ .Values.clusterName }}.local" {{ include "posthog.pgbouncer.port" . }});
until (nc -vz "{{ include "posthog.pgbouncer.host" . }}.$(cat /var/run/secrets/kubernetes.io/serviceaccount/namespace).svc.{{ .Values.clusterDomain}}" {{ 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.{{ .Values.clusterName }}.local" {{ include "posthog.postgresql.port" . }});
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
until (nc -vz "{{ include "posthog.postgresql.host" . }}.$(cat /var/run/secrets/kubernetes.io/serviceaccount/namespace).svc.{{ .Values.clusterName }}.local" {{ include "posthog.postgresql.port" . }});
until (nc -vz "{{ include "posthog.postgresql.host" . }}.$(cat /var/run/secrets/kubernetes.io/serviceaccount/namespace).svc.{{ .Values.clusterDomain }}" {{ 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.{{ .Values.clusterName }}.local" {{ include "posthog.redis.port" . }});
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
until (nc -vz "{{ include "posthog.redis.host" . }}.$(cat /var/run/secrets/kubernetes.io/serviceaccount/namespace).svc.{{ .Values.clusterName }}.local" {{ include "posthog.redis.port" . }});
until (nc -vz "{{ include "posthog.redis.host" . }}.$(cat /var/run/secrets/kubernetes.io/serviceaccount/namespace).svc.{{ .Values.clusterDomain }}" {{ 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.{{ .Values.clusterName }}.local" $KAFKA_PORT);
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
until (nc -vz "$KAFKA_HOST.$(cat /var/run/secrets/kubernetes.io/serviceaccount/namespace).svc.{{ .Values.clusterName }}.local" $KAFKA_PORT);
until (nc -vz "$KAFKA_HOST.$(cat /var/run/secrets/kubernetes.io/serviceaccount/namespace).svc.{{ .Values.clusterDomain }}" $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.{{ .Values.clusterName }}.local:8123" \
Copy link
Contributor

@guidoiaquinti guidoiaquinti Nov 23, 2022

Choose a reason for hiding this comment

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

Suggested change
"http://$CLICKHOUSE_USER:$CLICKHOUSE_PASSWORD@clickhouse-posthog.$(cat /var/run/secrets/kubernetes.io/serviceaccount/namespace).svc.{{ .Values.clusterName }}.local:8123" \
"http://$CLICKHOUSE_USER:$CLICKHOUSE_PASSWORD@clickhouse-posthog.$(cat /var/run/secrets/kubernetes.io/serviceaccount/namespace).svc.{{ .Values.clusterDomain }}: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