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

Unify nodeSelector and env variables #312

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft
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
49 changes: 26 additions & 23 deletions charts/posthog/templates/events-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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" . }}
Expand All @@ -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:
Expand All @@ -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
Expand Down Expand Up @@ -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:
Expand All @@ -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 }}
Expand Down
35 changes: 21 additions & 14 deletions charts/posthog/templates/migrate.job.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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
Expand All @@ -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 }}
16 changes: 7 additions & 9 deletions charts/posthog/templates/pgbouncer-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
Expand Down
17 changes: 11 additions & 6 deletions charts/posthog/templates/plugins-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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:
Expand Down
34 changes: 19 additions & 15 deletions charts/posthog/templates/web-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
Expand All @@ -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
Expand Down Expand Up @@ -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:
Expand Down
33 changes: 18 additions & 15 deletions charts/posthog/templates/worker-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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:
Expand Down
Loading