-
Notifications
You must be signed in to change notification settings - Fork 74
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
base: main
Are you sure you want to change the base?
Conversation
@@ -8,6 +8,14 @@ | |||
{{- end -}} | |||
{{- end }} | |||
|
|||
{{- define "posthog.clusterName" }} |
There was a problem hiding this comment.
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
@@ -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) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
# -- Cluster name used for internal DNS resolution (svc.{{clusterName}}.local) | |
# -- Kubernetes cluster domain name |
@@ -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) | |||
clusterName: cluster |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
clusterName: cluster | |
clusterDomain: cluster.local |
@@ -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" \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"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" \ |
@@ -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); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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 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" . }}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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 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" . }}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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" . }}); |
@@ -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" . }}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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" . }}); |
@@ -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" \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"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" \ |
@bernljung I've made a couple of suggestions, let me know if they work for you. CI is running. Edit: unit tests are failing because we likely need to update the snapshots. Regarding the Edit #2: a bit related to this, I've opened #635 to add a PgBouncer service FQDN. We should likely do the same for all the services so that your change will be not needed. Let me know what do you think about it. |
@guidoiaquinti I like this, way cleaner! 👍 |
Do you want to take a stab at doing this @bernljung ? |
Description
Adding a configurable value for the name of the Kubernetes cluster. I need this because my hosting provider assigns custom cluster names and this breaks the internal communication in the initContainers snippet making in stay in a pending state forever.
I have made the change wherever I could find the pattern
svc.cluster.local
. (test code excluded)Type of change
How has this been tested?
Configured the correct cluster name in my custom values.yaml and was succesfully able to deploy. I have also tested the fallback to the default cluster name in the same way.
Checklist