-
Notifications
You must be signed in to change notification settings - Fork 74
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
76 additions
and
59 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,141 +1,155 @@ | ||
{{- if .Values.worker.enabled -}} | ||
{{- range .Values.worker.workers }} | ||
apiVersion: apps/v1 | ||
kind: Deployment | ||
metadata: | ||
name: {{ template "posthog.fullname" . }}-worker | ||
labels: {{- include "_snippet-metadata-labels-common" . | nindent 4 }} | ||
annotations: {{- include "_snippet-metadata-annotations-common" . | nindent 4 }} | ||
name: {{ template "posthog.fullname" $ }}-{{ .name }}-worker | ||
labels: {{- include "_snippet-metadata-labels-common" $ | nindent 4 }} | ||
annotations: {{- include "_snippet-metadata-annotations-common" $ | nindent 4 }} | ||
spec: | ||
selector: | ||
matchLabels: | ||
app: {{ template "posthog.fullname" . }} | ||
release: "{{ .Release.Name }}" | ||
app: {{ template "posthog.fullname" $ }} | ||
release: "{{ $.Release.Name }}" | ||
role: worker | ||
{{- if not .Values.worker.hpa.enabled }} | ||
replicas: {{ .Values.worker.replicacount }} | ||
{{- if not $.Values.worker.hpa.enabled }} | ||
replicas: {{ $.Values.worker.replicacount }} | ||
{{- end }} | ||
|
||
strategy: | ||
type: RollingUpdate | ||
rollingUpdate: | ||
maxSurge: {{ .Values.worker.rollout.maxSurge }} | ||
maxUnavailable: {{ .Values.worker.rollout.maxUnavailable }} | ||
maxSurge: {{ $.Values.worker.rollout.maxSurge }} | ||
maxUnavailable: {{ $.Values.worker.rollout.maxUnavailable }} | ||
|
||
template: | ||
metadata: | ||
annotations: | ||
checksum/secrets.yaml: {{ include (print $.Template.BasePath "/secrets.yaml") . | sha256sum }} | ||
{{- if .Values.worker.podAnnotations }} | ||
{{ toYaml .Values.worker.podAnnotations | indent 8 }} | ||
checksum/secrets.yaml: {{ include (print $.Template.BasePath "/secrets.yaml") $ | sha256sum }} | ||
{{- if $.Values.worker.podAnnotations }} | ||
{{ toYaml $.Values.worker.podAnnotations | indent 8 }} | ||
{{- end }} | ||
labels: | ||
app: {{ template "posthog.fullname" . }} | ||
release: "{{ .Release.Name }}" | ||
app: {{ template "posthog.fullname" $ }} | ||
release: "{{ $.Release.Name }}" | ||
role: worker | ||
{{- if (eq (default .Values.image.tag "none") "latest") }} | ||
{{- if (eq (default $.Values.image.tag "none") "latest") }} | ||
date: "{{ now | unixEpoch }}" | ||
{{- end }} | ||
{{- if .Values.worker.podLabels }} | ||
{{ toYaml .Values.worker.podLabels | indent 8 }} | ||
{{- if $.Values.worker.podLabels }} | ||
{{ toYaml $.Values.worker.podLabels | indent 8 }} | ||
{{- end }} | ||
spec: | ||
serviceAccountName: {{ template "posthog.serviceAccountName" . }} | ||
{{- include "_snippet-topologySpreadConstraints" . | nindent 6 }} | ||
serviceAccountName: {{ template "posthog.serviceAccountName" $ }} | ||
{{- include "_snippet-topologySpreadConstraints" $ | nindent 6 }} | ||
|
||
{{- if .Values.worker.affinity }} | ||
{{- if $.Values.worker.affinity }} | ||
affinity: | ||
{{ toYaml .Values.worker.affinity | indent 8 }} | ||
{{ toYaml $.Values.worker.affinity | indent 8 }} | ||
{{- end }} | ||
|
||
{{- if .Values.worker.nodeSelector }} | ||
{{- if $.Values.worker.nodeSelector }} | ||
nodeSelector: | ||
{{ toYaml .Values.worker.nodeSelector | indent 8 }} | ||
{{ toYaml $.Values.worker.nodeSelector | indent 8 }} | ||
{{- end }} | ||
|
||
{{- if .Values.worker.tolerations }} | ||
{{- if $.Values.worker.tolerations }} | ||
tolerations: | ||
{{ toYaml .Values.worker.tolerations | indent 8 }} | ||
{{ toYaml $.Values.worker.tolerations | indent 8 }} | ||
{{- end }} | ||
|
||
{{- if .Values.worker.schedulerName }} | ||
schedulerName: "{{ .Values.worker.schedulerName }}" | ||
{{- if $.Values.worker.schedulerName }} | ||
schedulerName: "{{ $.Values.worker.schedulerName }}" | ||
{{- end }} | ||
|
||
{{- if .Values.worker.priorityClassName }} | ||
priorityClassName: "{{ .Values.worker.priorityClassName }}" | ||
{{- if $.Values.worker.priorityClassName }} | ||
priorityClassName: "{{ $.Values.worker.priorityClassName }}" | ||
{{- end }} | ||
|
||
{{- if .Values.image.imagePullSecrets }} | ||
{{- if $.Values.image.imagePullSecrets }} | ||
imagePullSecrets: | ||
{{ toYaml .Values.image.imagePullSecrets | indent 8 }} | ||
{{ toYaml $.Values.image.imagePullSecrets | indent 8 }} | ||
{{- end }} | ||
|
||
# I do not know for sure if the old one has been used anywhere, so do both :( | ||
{{- if .Values.image.pullSecrets }} | ||
{{- if $.Values.image.pullSecrets }} | ||
imagePullSecrets: | ||
{{- range .Values.image.pullSecrets }} | ||
{{- range $.Values.image.pullSecrets }} | ||
- name: {{ . }} | ||
{{- end }} | ||
{{- end }} | ||
|
||
{{- if .Values.worker.podSecurityContext.enabled }} | ||
securityContext: {{- omit .Values.worker.podSecurityContext "enabled" | toYaml | nindent 8 }} | ||
{{- if $.Values.worker.podSecurityContext.enabled }} | ||
securityContext: {{- omit $.Values.worker.podSecurityContext "enabled" | toYaml | nindent 8 }} | ||
{{- end }} | ||
containers: | ||
- name: {{ .Chart.Name }}-workers | ||
image: {{ template "posthog.image.fullPath" . }} | ||
imagePullPolicy: {{ .Values.image.pullPolicy }} | ||
- name: {{ $.Chart.Name }}-workers | ||
image: {{ template "posthog.image.fullPath" $ }} | ||
imagePullPolicy: {{ $.Values.image.pullPolicy }} | ||
command: | ||
- ./bin/docker-worker-celery | ||
- --with-scheduler | ||
ports: | ||
- containerPort: {{ .Values.service.internalPort }} | ||
- containerPort: {{ $.Values.service.internalPort }} | ||
# Expose the port on which Prometheus /metrics endpoint resides | ||
- containerPort: 8001 | ||
env: | ||
# Kafka env variables | ||
{{- include "snippet.kafka-env" . | indent 8 }} | ||
{{- include "snippet.kafka-env" $ | indent 8 }} | ||
|
||
# Object Storage env variables | ||
{{- include "snippet.objectstorage-env" . | indent 8 }} | ||
{{- include "snippet.objectstorage-env" $ | indent 8 }} | ||
|
||
# Redis env variables | ||
{{- include "snippet.redis-env" . | indent 8 }} | ||
{{- include "snippet.redis-env" $ | indent 8 }} | ||
|
||
# statsd env variables | ||
{{- include "snippet.statsd-env" . | indent 8 }} | ||
{{- include "snippet.statsd-env" $ | indent 8 }} | ||
|
||
# prometheus pushgateway if enabled internally | ||
{{- if index .Values "prometheus-pushgateway" "enabled" }} | ||
{{- if index $.Values "prometheus-pushgateway" "enabled" }} | ||
- name: PROM_PUSHGATEWAY_ADDRESS | ||
value: "posthog-prometheus-pushgateway:9091" | ||
{{- end }} | ||
|
||
# prometheus pushgateway if enabled externally | ||
{{- if index .Values "external-prometheus-pushgateway" "enabled" }} | ||
{{- if index $.Values "external-prometheus-pushgateway" "enabled" }} | ||
- name: PROM_PUSHGATEWAY_ADDRESS | ||
value: {{ ".Values.external-prometheus-pushgateway.address" }} | ||
{{- end }} | ||
|
||
- name: PRIMARY_DB | ||
value: clickhouse | ||
{{- include "snippet.posthog-env" . | indent 8 }} | ||
{{- include "snippet.posthog-sentry-env" . | indent 8 }} | ||
{{- include "snippet.postgresql-env" . | nindent 8 }} | ||
{{- include "snippet.clickhouse-env" . | nindent 8 }} | ||
{{- include "snippet.email-env" . | nindent 8 }} | ||
{{- if .Values.env }} | ||
{{ toYaml .Values.env | indent 8 }} | ||
{{- include "snippet.posthog-env" $ | indent 8 }} | ||
{{- include "snippet.posthog-sentry-env" $ | indent 8 }} | ||
{{- include "snippet.postgresql-env" $ | nindent 8 }} | ||
{{- include "snippet.clickhouse-env" $ | nindent 8 }} | ||
{{- include "snippet.email-env" $ | nindent 8 }} | ||
{{- if .queues }} | ||
- name: CELERY_WORKER_QUEUES | ||
value: "{{ .queues | join ',' }}" | ||
{{- end }} | ||
{{- if .concurrency }} | ||
- name: CELERY_WORKER_CONCURRENCY | ||
value: "{{ .concurrency }}" | ||
{{- end }} | ||
{{- if .pool }} | ||
- name: CELERY_WORKER_POOL | ||
value: "{{ .pool }}" | ||
{{- end }} | ||
{{- if $.Values.env }} | ||
{{ toYaml $.Values.env | indent 8 }} | ||
{{- end }} | ||
{{- if .Values.worker.env }} | ||
{{ toYaml .Values.worker.env | indent 8 }} | ||
{{- if $.Values.worker.env }} | ||
{{ toYaml $.Values.worker.env | indent 8 }} | ||
{{- end }} | ||
resources: | ||
{{ toYaml .Values.worker.resources | indent 12 }} | ||
{{- if .Values.worker.securityContext.enabled }} | ||
securityContext: {{- omit .Values.worker.securityContext "enabled" | toYaml | nindent 12 }} | ||
{{ toYaml $.Values.worker.resources | indent 12 }} | ||
{{- if $.Values.worker.securityContext.enabled }} | ||
securityContext: {{- omit $.Values.worker.securityContext "enabled" | toYaml | nindent 12 }} | ||
{{- end }} | ||
initContainers: | ||
{{- include "_snippet-initContainers-wait-for-service-dependencies" . | indent 8 }} | ||
{{- include "_snippet-initContainers-wait-for-migrations" . | indent 8 }} | ||
{{- include "_snippet-initContainers-wait-for-service-dependencies" $ | indent 8 }} | ||
{{- include "_snippet-initContainers-wait-for-migrations" $ | indent 8 }} | ||
{{- end }} | ||
{{- end }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters