diff --git a/charts/posthog/templates/events-deployment.yaml b/charts/posthog/templates/events-deployment.yaml index a4a7d9355..50fcfe380 100644 --- a/charts/posthog/templates/events-deployment.yaml +++ b/charts/posthog/templates/events-deployment.yaml @@ -18,8 +18,8 @@ spec: metadata: annotations: checksum/secrets.yaml: {{ include (print $.Template.BasePath "/secrets.yaml") . | sha256sum }} - {{- if .Values.web.podAnnotations }} -{{ toYaml .Values.web.podAnnotations | indent 8 }} + {{- if .Values.events.podAnnotations }} +{{ toYaml .Values.events.podAnnotations | indent 8 }} {{- end }} labels: app: {{ template "posthog.fullname" . }} @@ -28,25 +28,24 @@ spec: {{- if (eq (default .Values.image.tag "none") "latest") }} date: "{{ now | unixEpoch }}" {{- end }} - {{- if .Values.web.podLabels }} + {{- if .Values.events.podLabels }} {{ toYaml .Values.web.podLabels | indent 8 }} {{- end }} spec: - serviceAccountName: {{ template "posthog.serviceAccountName" . }} - {{- if .Values.web.affinity }} - affinity: -{{ toYaml .Values.web.affinity | indent 8 }} + {{- if .Values.events.affinity }} + affinity: {{ toYaml .Values.events.affinity | nindent 12 }} {{- end }} - {{- if .Values.web.nodeSelector }} - nodeSelector: -{{ toYaml .Values.web.nodeSelector | indent 8 }} + {{- if .Values.events.tolerations }} + tolerations: {{ toYaml .Values.events.tolerations | nindent 12 }} {{- end }} - {{- if .Values.web.tolerations }} - tolerations: -{{ toYaml .Values.web.tolerations | indent 8 }} + {{- if .Values.events.nodeSelector }} + nodeSelector: {{ toYaml .Values.events.nodeSelector | nindent 12 }} {{- end }} - {{- if .Values.web.schedulerName }} - schedulerName: "{{ .Values.web.schedulerName }}" + + serviceAccountName: {{ template "posthog.serviceAccountName" . }} + + {{- if .Values.events.schedulerName }} + schedulerName: "{{ .Values.events.schedulerName }}" {{- end }} {{- if .Values.image.imagePullSecrets }} imagePullSecrets: @@ -70,6 +69,16 @@ spec: # statsd env variables {{- include "snippet.statsd-env" . | indent 8 }} + # Add common env variables + {{- if .Values.env }} + {{ toYaml .Values.env | indent 8 }} + {{- end }} + + # Add events specific env variables + {{- if .Values.events.env }} + {{ toYaml .Values.events.env | indent 8 }} + {{- end }} + - name: SITE_URL value: {{ template "posthog.site.url" . }} - name: DEPLOYMENT @@ -106,12 +115,7 @@ spec: {{- end }} - name: HELM_INSTALL_INFO value: {{ template "posthog.helmInstallInfo" . }} -{{- if .Values.env }} -{{ toYaml .Values.env | indent 8 }} -{{- end }} -{{- if .Values.web.env }} -{{ toYaml .Values.web.env | indent 8 }} -{{- end }} + livenessProbe: failureThreshold: {{ .Values.web.livenessProbe.failureThreshold }} httpGet: @@ -132,8 +136,7 @@ spec: periodSeconds: {{ .Values.web.readinessProbe.periodSeconds }} successThreshold: {{ .Values.web.readinessProbe.successThreshold }} timeoutSeconds: {{ .Values.web.readinessProbe.timeoutSeconds }} - resources: -{{ toYaml .Values.web.resources | indent 12 }} + resources: {{ toYaml .Values.events.resources | nindent 12 }} initContainers: {{- include "_snippet-initContainers-wait-for-service-dependencies" . | indent 8 }} {{- include "_snippet-initContainers-wait-for-migrations" . | indent 8 }} diff --git a/charts/posthog/templates/migrate.job.yaml b/charts/posthog/templates/migrate.job.yaml index f953040cb..ff1da6270 100644 --- a/charts/posthog/templates/migrate.job.yaml +++ b/charts/posthog/templates/migrate.job.yaml @@ -21,10 +21,16 @@ spec: {{ toYaml .Values.worker.podLabels | indent 8 }} {{- end }} spec: - {{- with .Values.hooks.affinity }} - affinity: -{{ toYaml . | indent 8 }} + {{- if .Values.migrate.affinity }} + affinity: {{ toYaml .Values.migrate.affinity | nindent 12 }} {{- end }} + {{- if .Values.migrate.tolerations }} + tolerations: {{ toYaml .Values.migrate.tolerations | nindent 12 }} + {{- end }} + {{- if .Values.migrate.nodeSelector }} + nodeSelector: {{ toYaml .Values.migrate.nodeSelector | nindent 12 }} + {{- end }} + restartPolicy: Never {{- if .Values.image.imagePullSecrets }} imagePullSecrets: @@ -42,17 +48,19 @@ spec: env: # Redis env variables {{- include "snippet.redis-env" . | indent 8 }} + + # Add common env variables + {{- if .Values.env }} + {{ toYaml .Values.env | indent 8 }} + {{- end }} + + # Add migrate specific env variables + {{- if .Values.migrate.env }} + {{ toYaml .Values.migrate.env | indent 8 }} + {{- end }} + - name: SENTRY_DSN value: {{ .Values.sentryDSN | quote }} -{{- if .Values.env }} -{{ toYaml .Values.env | indent 8 }} -{{- end }} -{{- if .Values.worker.env }} -{{ toYaml .Values.worker.env | indent 8 }} -{{- end }} -{{- if .Values.hooks.migrate.env }} -{{ toYaml .Values.hooks.migrate.env | indent 8 }} -{{- end }} - name: SITE_URL value: {{ template "posthog.site.url" . }} - name: DEPLOYMENT @@ -75,8 +83,7 @@ spec: {{- end }} - name: HELM_INSTALL_INFO value: {{ template "posthog.helmInstallInfo" . }} - resources: -{{ toYaml .Values.hooks.migrate.resources | indent 10 }} + resources: {{ toYaml .Values.migrate.migrate.resources | nindent 10 }} initContainers: {{- include "_snippet-initContainers-wait-for-service-dependencies" . | indent 8 }} {{- end }} diff --git a/charts/posthog/templates/pgbouncer-deployment.yaml b/charts/posthog/templates/pgbouncer-deployment.yaml index a7240fb53..e5434bce2 100644 --- a/charts/posthog/templates/pgbouncer-deployment.yaml +++ b/charts/posthog/templates/pgbouncer-deployment.yaml @@ -26,19 +26,17 @@ spec: {{ toYaml .Values.pgbouncer.podLabels | indent 8 }} {{- end }} spec: - serviceAccountName: {{ template "posthog.serviceAccountName" . }} {{- if .Values.pgbouncer.affinity }} - affinity: -{{ toYaml .Values.pgbouncer.affinity | indent 8 }} - {{- end }} - {{- if .Values.pgbouncer.nodeSelector }} - nodeSelector: -{{ toYaml .Values.pgbouncer.nodeSelector | indent 8 }} + affinity: {{ toYaml .Values.pgbouncer.affinity | nindent 12 }} {{- end }} {{- if .Values.pgbouncer.tolerations }} - tolerations: -{{ toYaml .Values.pgbouncer.tolerations | indent 8 }} + tolerations: {{ toYaml .Values.pgbouncer.tolerations | nindent 12 }} {{- end }} + {{- if .Values.pgbouncer.nodeSelector }} + nodeSelector: {{ toYaml .Values.pgbouncer.nodeSelector | nindent 12 }} + {{- end }} + + serviceAccountName: {{ template "posthog.serviceAccountName" . }} {{- if .Values.pgbouncer.schedulerName }} schedulerName: "{{ .Values.pgbouncer.schedulerName }}" {{- end }} diff --git a/charts/posthog/templates/plugins-deployment.yaml b/charts/posthog/templates/plugins-deployment.yaml index d1672d95b..64b2e226e 100644 --- a/charts/posthog/templates/plugins-deployment.yaml +++ b/charts/posthog/templates/plugins-deployment.yaml @@ -73,6 +73,16 @@ spec: # statsd env variables {{- include "snippet.statsd-env" . | indent 8 }} + # Add common env variables + {{- if .Values.env }} + {{ toYaml .Values.env | indent 8 }} + {{- end }} + + # Add plugins specific env variables + {{- if .Values.plugins.env }} + {{ toYaml .Values.plugins.env | indent 8 }} + {{- end }} + - name: SENTRY_DSN value: {{ .Values.sentryDSN | quote }} - name: DEPLOYMENT @@ -98,12 +108,7 @@ spec: {{- end }} - name: HELM_INSTALL_INFO value: {{ template "posthog.helmInstallInfo" . }} -{{- if .Values.env }} -{{ toYaml .Values.env | indent 8 }} -{{- end }} -{{- if .Values.plugins.env }} -{{ toYaml .Values.plugins.env | indent 8 }} -{{- end }} + resources: {{ toYaml .Values.plugins.resources | indent 12 }} initContainers: diff --git a/charts/posthog/templates/web-deployment.yaml b/charts/posthog/templates/web-deployment.yaml index 405368d9e..866fcab21 100644 --- a/charts/posthog/templates/web-deployment.yaml +++ b/charts/posthog/templates/web-deployment.yaml @@ -32,19 +32,18 @@ spec: {{ toYaml .Values.web.podLabels | indent 8 }} {{- end }} spec: - serviceAccountName: {{ template "posthog.serviceAccountName" . }} {{- if .Values.web.affinity }} - affinity: -{{ toYaml .Values.web.affinity | indent 8 }} - {{- end }} - {{- if .Values.web.nodeSelector }} - nodeSelector: -{{ toYaml .Values.web.nodeSelector | indent 8 }} + affinity: {{ toYaml .Values.web.affinity | nindent 12 }} {{- end }} {{- if .Values.web.tolerations }} - tolerations: -{{ toYaml .Values.web.tolerations | indent 8 }} + tolerations: {{ toYaml .Values.web.tolerations | nindent 12 }} + {{- end }} + {{- if .Values.web.nodeSelector }} + nodeSelector: {{ toYaml .Values.web.nodeSelector | nindent 12 }} {{- end }} + + serviceAccountName: {{ template "posthog.serviceAccountName" . }} + {{- if .Values.web.affinity }} {{- if .Values.web.schedulerName }} schedulerName: "{{ .Values.web.schedulerName }}" {{- end }} @@ -70,6 +69,16 @@ spec: # statsd env variables {{- include "snippet.statsd-env" . | indent 8 }} + # Add common env variables + {{- if .Values.env }} + {{ toYaml .Values.env | indent 8 }} + {{- end }} + + # Add web specific env variables + {{- if .Values.web.env }} + {{ toYaml .Values.web.env | indent 8 }} + {{- end }} + - name: SITE_URL value: {{ template "posthog.site.url" . }} - name: DEPLOYMENT @@ -128,12 +137,7 @@ spec: {{- end }} - name: HELM_INSTALL_INFO value: {{ template "posthog.helmInstallInfo" . }} -{{- if .Values.env }} -{{ toYaml .Values.env | indent 8 }} -{{- end }} -{{- if .Values.web.env }} -{{ toYaml .Values.web.env | indent 8 }} -{{- end }} + livenessProbe: failureThreshold: {{ .Values.web.livenessProbe.failureThreshold }} httpGet: diff --git a/charts/posthog/templates/worker-deployment.yaml b/charts/posthog/templates/worker-deployment.yaml index a25233a06..0d3e1acfc 100644 --- a/charts/posthog/templates/worker-deployment.yaml +++ b/charts/posthog/templates/worker-deployment.yaml @@ -32,19 +32,17 @@ spec: {{ toYaml .Values.worker.podLabels | indent 8 }} {{- end }} spec: - serviceAccountName: {{ template "posthog.serviceAccountName" . }} {{- if .Values.worker.affinity }} - affinity: -{{ toYaml .Values.worker.affinity | indent 8 }} - {{- end }} - {{- if .Values.worker.nodeSelector }} - nodeSelector: -{{ toYaml .Values.worker.nodeSelector | indent 8 }} + affinity: {{ toYaml .Values.worker.affinity | nindent 12 }} {{- end }} {{- if .Values.worker.tolerations }} - tolerations: -{{ toYaml .Values.worker.tolerations | indent 8 }} + tolerations: {{ toYaml .Values.worker.tolerations | nindent 12 }} {{- end }} + {{- if .Values.worker.nodeSelector }} + nodeSelector: {{ toYaml .Values.worker.nodeSelector | nindent 12 }} + {{- end }} + + serviceAccountName: {{ template "posthog.serviceAccountName" . }} {{- if .Values.worker.schedulerName }} schedulerName: "{{ .Values.worker.schedulerName }}" {{- end }} @@ -73,6 +71,16 @@ spec: # statsd env variables {{- include "snippet.statsd-env" . | indent 8 }} + # Add common env variables + {{- if .Values.env }} + {{ toYaml .Values.env | indent 8 }} + {{- end }} + + # Add worker specific env variables + {{- if .Values.worker.env }} + {{ toYaml .Values.worker.env | indent 8 }} + {{- end }} + - name: SITE_URL value: {{ template "posthog.site.url" . }} - name: DEPLOYMENT @@ -101,12 +109,7 @@ spec: {{- end }} - name: HELM_INSTALL_INFO value: {{ template "posthog.helmInstallInfo" . }} -{{- if .Values.env }} -{{ toYaml .Values.env | indent 8 }} -{{- end }} -{{- if .Values.worker.env }} -{{ toYaml .Values.worker.env | indent 8 }} -{{- end }} + resources: {{ toYaml .Values.worker.resources | indent 12 }} initContainers: diff --git a/charts/posthog/values.yaml b/charts/posthog/values.yaml index e20f22135..3ff94c7d5 100644 --- a/charts/posthog/values.yaml +++ b/charts/posthog/values.yaml @@ -23,10 +23,21 @@ env: - name: EVENT_PROPERTY_USAGE_INTERVAL_SECONDS value: "86400" + migrate: # -- Whether to install the PostHog migrate job or not. enabled: true + # -- Node labels for the migrate job. + nodeSelector: {} + + # -- Toleration labels the migrate job. + tolerations: [] + + # -- Affinity settings the migrate job. + affinity: {} + + events: # -- Whether to install the PostHog events stack or not. enabled: true @@ -44,6 +55,48 @@ events: # -- Max pods for the events stack HorizontalPodAutoscaler. maxpods: 10 + # -- Resource limits for events service. + resources: + {} + + # -- Additional env variables to inject into the events stack deployment. + env: + [] + + # -- Node labels for events stack deployment. + nodeSelector: {} + + # -- Toleration labels for events stack deployment. + tolerations: [] + + # -- Affinity settings for events stack deployment. + affinity: {} + + livenessProbe: + # -- The liveness probe failure threshold + failureThreshold: 5 + # -- The liveness probe initial delay seconds + initialDelaySeconds: 50 + # -- The liveness probe period seconds + periodSeconds: 10 + # -- The liveness probe success threshold + successThreshold: 1 + # -- The liveness probe timeout seconds + timeoutSeconds: 2 + + readinessProbe: + # -- The readiness probe failure threshold + failureThreshold: 10 + # -- The readiness probe initial delay seconds + initialDelaySeconds: 50 + # -- The readiness probe period seconds + periodSeconds: 10 + # -- The readiness probe success threshold + successThreshold: 1 + # -- The readiness probe timeout seconds + timeoutSeconds: 2 + + web: # -- Whether to install the PostHog web stack or not. enabled: true @@ -388,8 +441,19 @@ pgbouncer: replicacount: 1 # -- Additional env vars to be added to the pgbouncer deployment env: [] + + # -- Node labels for the pgbouncer stack deployment. + nodeSelector: {} + + # -- Toleration labels for the pgbouncer stack deployment. + tolerations: [] + + # -- Affinity settings for the pgbouncer stack deployment. + affinity: {} + # -- Additional volumeMounts to be added to the pgbouncer deployment extraVolumeMounts: [] + # -- Additional volumes to be added to the pgbouncer deployment extraVolumes: [] @@ -534,7 +598,7 @@ clickhouse: image: # -- ClickHouse image repository. repository: yandex/clickhouse-server - # -- ClickHouse image tag. Note: PostHog does not support all versions of ClickHouse. Please override the default only if you know what you are doing. + # -- ClickHouse image tag. Note: PostHog does not support all versions of ClickHouse. Please override the default only if you know what you are doing. tag: "21.6.5" # -- Toleration labels for clickhouse pod assignment @@ -625,16 +689,6 @@ cloudwatch: readTail: "Off" -# Provide affinity for hooks if needed -hooks: - # -- Affinity settings for hooks - affinity: {} - migrate: - # -- Env variables for migate hooks - env: [] - # -- Hook job resource limits/requests - resources: {} - serviceAccount: # -- Configures if a ServiceAccount with this name should be created create: true