-
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
Decide deployment services check #714
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
{{/* Common initContainers-decide-wait-for-service-dependencies definition */}} | ||
{{- define "_snippet-initContainers-decide-wait-for-service-dependencies" }} | ||
- name: decide-wait-for-service-dependencies | ||
image: {{ .Values.busybox.image }} | ||
imagePullPolicy: {{ .Values.busybox.pullPolicy }} | ||
env: | ||
{{- include "snippet.clickhouse-env" . | nindent 4 }} | ||
command: | ||
- /bin/sh | ||
- -c | ||
- > | ||
{{ 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" \ | ||
--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 }} | ||
); | ||
do | ||
echo "waiting for all ClickHouse nodes to be available"; 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" . }}); | ||
do | ||
echo "waiting for Redis"; sleep 1; | ||
done | ||
{{ end }} | ||
|
||
{{ if .Values.kafka.enabled }} | ||
|
||
KAFKA_BROKERS="{{ include "posthog.kafka.brokers" . }}" | ||
|
||
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); | ||
do | ||
echo "waiting for Kafka"; sleep 1; | ||
done | ||
{{ end }} | ||
{{- end }} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -170,6 +170,5 @@ spec: | |
securityContext: {{- omit .Values.decide.securityContext "enabled" | toYaml | nindent 12 }} | ||
{{- end }} | ||
initContainers: | ||
{{- include "_snippet-initContainers-wait-for-service-dependencies" . | indent 8 }} | ||
{{- include "_snippet-initContainers-wait-for-migrations" . | indent 8 }} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Decide still makes queries to PostgreSQL right? So we still need to wait for them to have been applied? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think I might have misunderstood earlier & mislead the ff team ... this would only apply on new container setup, not on restart? If that's true and considering we do rolling deploys this is fine to keep as is. Sorry. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah if you don't include the migration check, you'll end up with a There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. just confirmed that init containers only run when the pod is created pods never restart, only the containers within them There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ok, then we should investigate, why FF went down, when PG was unavailable (as this was the initial hypothesis iirc and based on what Frank said it's not the case) |
||
{{- include "_snippet-initContainers-decide-wait-for-service-dependencies" . | indent 8 }} | ||
{{- end }} |
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.
Don't need Clickhouse either?