Skip to content
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
27 changes: 27 additions & 0 deletions charts/sentry/templates/_helper.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,13 @@
{{- default .Chart.AppVersion .Values.images.vroom.tag -}}
{{- end -}}


{{- define "taskbroker.image" -}}
{{- default "getsentry/taskbroker" .Values.images.taskbroker.repository -}}
:
{{- default .Chart.AppVersion .Values.images.taskbroker.tag -}}
{{- end -}}

{{/*
Expand the name of the chart.
*/}}
Expand Down Expand Up @@ -688,6 +695,22 @@ Set external Clickhouse password from existingSecret
value: http://{{ template "sentry.fullname" . }}-snuba:{{ template "snuba.port" . }}
{{- end -}}

{{- define "taskbroker.env" -}}
- name: TASKBROKER_KAFKA_CLUSTER
value: {{ include "sentry.kafka.bootstrap_servers_string" . | quote }}
- name: TASKBROKER_KAFKA_DEADLETTER_CLUSTER
value: {{ include "sentry.kafka.bootstrap_servers_string" . | quote }}
- name: TASKBROKER_DB_PATH
value: "/opt/sqlite/taskbroker-activations.sqlite"
{{- end -}}

{{/*
Return the taskbroker service host name
*/}}
{{- define "taskbroker.host" -}}
{{- template "sentry.fullname" . }}-taskbroker
{{- end -}}

{{/*
Common Sentry environment variables
*/}}
Expand All @@ -700,6 +723,10 @@ Common Sentry environment variables
value: http://{{ template "sentry.fullname" . }}-snuba:{{ template "snuba.port" . }}
- name: VROOM
value: http://{{ template "sentry.fullname" . }}-vroom:{{ template "vroom.port" . }}
- name: SENTRY_REDIS_HOST
value: {{ $redisHost | quote }}
- name: SENTRY_REDIS_PORT
value: {{ $redisPort | quote }}
{{- if .Values.sentry.existingSecret }}
- name: SENTRY_SECRET_KEY
valueFrom:
Expand Down
512 changes: 337 additions & 175 deletions charts/sentry/templates/sentry/_helper-sentry.tpl

Large diffs are not rendered by default.

124 changes: 124 additions & 0 deletions charts/sentry/templates/sentry/taskbroker/deployment-taskbroker.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,124 @@
apiVersion: apps/v1
Copy link

@manishrawat1992 manishrawat1992 Oct 25, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should ideally be a statefulset because, embedded sqlite might require pvc also.

Take example of symbolicator statefulset

kind: Deployment
metadata:
name: {{ template "sentry.fullname" . }}-taskbroker
labels:
app: {{ template "sentry.fullname" . }}
chart: "{{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}"
release: "{{ .Release.Name }}"
heritage: "{{ .Release.Service }}"
app.kubernetes.io/managed-by: "Helm"
{{- if .Values.asHook }}
{{- /* Add the Helm annotations so that deployment after asHook from true to false works */}}
annotations:
meta.helm.sh/release-name: "{{ .Release.Name }}"
meta.helm.sh/release-namespace: "{{ .Release.Namespace }}"
"helm.sh/hook": "post-install,post-upgrade"
"helm.sh/hook-weight": "25"
{{- end }}
spec:
selector:
matchLabels:
app: {{ template "sentry.fullname" . }}
release: "{{ .Release.Name }}"
role: taskbroker
{{- if not .Values.taskbroker.autoscaling.enabled }}
replicas: {{ .Values.taskbroker.replicas }}
{{- end }}
revisionHistoryLimit: {{ .Values.revisionHistoryLimit }}
template:
metadata:
annotations:
{{- if .Values.taskbroker.annotations }}
{{ toYaml .Values.taskbroker.annotations | indent 8 }}
{{- end }}
labels:
app: {{ template "sentry.fullname" . }}
release: "{{ .Release.Name }}"
role: taskbroker
{{- if .Values.taskbroker.podLabels }}
{{ toYaml .Values.taskbroker.podLabels | indent 8 }}
{{- end }}
spec:
affinity:
{{- if .Values.taskbroker.affinity }}
{{ toYaml .Values.taskbroker.affinity | indent 8 }}
{{- end }}
{{- if .Values.taskbroker.nodeSelector }}
nodeSelector:
{{ toYaml .Values.taskbroker.nodeSelector | indent 8 }}
{{- else if .Values.global.nodeSelector }}
nodeSelector:
{{ toYaml .Values.global.nodeSelector | indent 8 }}
{{- end }}
{{- if .Values.taskbroker.tolerations }}
tolerations:
{{ toYaml .Values.taskbroker.tolerations | indent 8 }}
{{- else if .Values.global.tolerations }}
tolerations:
{{ toYaml .Values.global.tolerations | indent 8 }}
{{- end }}
{{- if .Values.taskbroker.topologySpreadConstraints }}
topologySpreadConstraints:
{{ toYaml .Values.taskbroker.topologySpreadConstraints | indent 8 }}
{{- end }}
{{- if .Values.images.taskbroker.imagePullSecrets }}
imagePullSecrets:
{{ toYaml .Values.images.taskbroker.imagePullSecrets | indent 8 }}
{{- end }}
{{- if .Values.taskbroker.securityContext }}
securityContext:
{{ toYaml .Values.taskbroker.securityContext | indent 8 }}
{{- end }}
containers:
- name: {{ .Chart.Name }}-taskbroker
{{- if .Values.taskbroker.args }}
args:
{{ toYaml .Values.taskbroker.args | indent 10 }}
{{- end }}
image: "{{ template "taskbroker.image" . }}"
imagePullPolicy: {{ default "IfNotPresent" .Values.images.taskbroker.pullPolicy }}
env:
{{- include "taskbroker.env" . | nindent 8 }}
{{- if .Values.taskbroker.env }}
{{ toYaml .Values.taskbroker.env | indent 8 }}
{{- end }}
volumeMounts:
- name: taskbroker-storage
mountPath: /opt/sqlite
{{- if .Values.taskbroker.volumeMounts }}
{{ toYaml .Values.taskbroker.volumeMounts | indent 10 }}
{{- end }}
resources:
{{ toYaml .Values.taskbroker.resources | indent 12 }}
{{- if .Values.taskbroker.containerSecurityContext }}
securityContext:
{{ toYaml .Values.taskbroker.containerSecurityContext | indent 12 }}
{{- end }}
{{- if .Values.taskbroker.sidecars }}
{{ toYaml .Values.taskbroker.sidecars | indent 6 }}
{{- end }}
{{- if .Values.global.sidecars }}
{{ toYaml .Values.global.sidecars | indent 6 }}
{{- end }}
{{- if .Values.serviceAccount.enabled }}
serviceAccountName: {{ .Values.serviceAccount.name }}-taskbroker
{{- end }}
volumes:
{{- if .Values.taskbroker.persistence.enabled }}
- name: taskbroker-storage
persistentVolumeClaim:
claimName: sentry-taskbroker-pvc
{{- else }}
- name: taskbroker-storage
emptyDir: {}
{{- end }}
{{- if .Values.taskbroker.volumes }}
{{ toYaml .Values.taskbroker.volumes | indent 6 }}
{{- end }}
{{- if .Values.global.volumes }}
{{ toYaml .Values.global.volumes | indent 6 }}
{{- end }}
{{- if .Values.taskbroker.priorityClassName }}
priorityClassName: "{{ .Values.taskbroker.priorityClassName }}"
{{- end }}
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ template "sentry.fullname" . }}-taskscheduler
labels:
app: {{ template "sentry.fullname" . }}
chart: "{{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}"
release: "{{ .Release.Name }}"
heritage: "{{ .Release.Service }}"
app.kubernetes.io/managed-by: "Helm"
{{- if .Values.asHook }}
{{- /* Add the Helm annotations so that deployment after asHook from true to false works */}}
annotations:
meta.helm.sh/release-name: "{{ .Release.Name }}"
meta.helm.sh/release-namespace: "{{ .Release.Namespace }}"
"helm.sh/hook": "post-install,post-upgrade"
"helm.sh/hook-weight": "25"
{{- end }}
spec:
selector:
matchLabels:
app: {{ template "sentry.fullname" . }}
release: "{{ .Release.Name }}"
role: sentry
replicas: {{ .Values.sentry.replicas }}
revisionHistoryLimit: {{ .Values.revisionHistoryLimit }}
template:
metadata:
annotations:
checksum/configmap.yaml: {{ include "sentry.config" . | sha256sum }}
{{- if .Values.sentry.annotations }}
{{ toYaml .Values.sentry.annotations | indent 8 }}
{{- end }}
labels:
app: {{ template "sentry.fullname" . }}
release: "{{ .Release.Name }}"
role: sentry
{{- if .Values.sentry.podLabels }}
{{ toYaml .Values.sentry.podLabels | indent 8 }}
{{- end }}
spec:
affinity:
{{- if .Values.sentry.affinity }}
{{ toYaml .Values.sentry.affinity | indent 8 }}
{{- end }}
{{- if .Values.sentry.nodeSelector }}
nodeSelector:
{{ toYaml .Values.sentry.nodeSelector | indent 8 }}
{{- else if .Values.global.nodeSelector }}
nodeSelector:
{{ toYaml .Values.global.nodeSelector | indent 8 }}
{{- end }}
{{- if .Values.sentry.tolerations }}
tolerations:
{{ toYaml .Values.sentry.tolerations | indent 8 }}
{{- else if .Values.global.tolerations }}
tolerations:
{{ toYaml .Values.global.tolerations | indent 8 }}
{{- end }}
{{- if .Values.sentry.topologySpreadConstraints }}
topologySpreadConstraints:
{{ toYaml .Values.sentry.topologySpreadConstraints | indent 8 }}
{{- end }}
{{- if .Values.images.sentry.imagePullSecrets }}
imagePullSecrets:
{{ toYaml .Values.images.sentry.imagePullSecrets | indent 8 }}
{{- end }}
{{- if .Values.sentry.securityContext }}
securityContext:
{{ toYaml .Values.sentry.securityContext | indent 8 }}
{{- end }}
containers:
- name: {{ .Chart.Name }}-sentry
{{- if .Values.sentry.args }}
args:
{{ toYaml .Values.sentry.args | indent 10 }}
{{- end }}
command: ["sentry"]
args:
- run
- taskworker-scheduler
image: "{{ template "sentry.image" . }}"
imagePullPolicy: {{ default "IfNotPresent" .Values.images.sentry.pullPolicy }}
env:
{{- include "sentry.env" . | nindent 8 }}
{{- if .Values.sentry.env }}
{{ toYaml .Values.sentry.env | indent 8 }}
{{- end }}
resources:
{{ toYaml .Values.sentry.resources | indent 12 }}
{{- if .Values.sentry.containerSecurityContext }}
securityContext:
{{ toYaml .Values.sentry.containerSecurityContext | indent 12 }}
{{- end }}
{{- if .Values.sentry.sidecars }}
{{ toYaml .Values.sentry.sidecars | indent 6 }}
{{- end }}
{{- if .Values.global.sidecars }}
{{ toYaml .Values.global.sidecars | indent 6 }}
{{- end }}
{{- if .Values.serviceAccount.enabled }}
serviceAccountName: {{ .Values.serviceAccount.name }}-sentry
{{- end }}
{{- if .Values.sentry.priorityClassName }}
priorityClassName: "{{ .Values.sentry.priorityClassName }}"
{{- end }}
volumes:
- name: config
configMap:
name: {{ template "sentry.fullname" . }}-sentry
112 changes: 112 additions & 0 deletions charts/sentry/templates/sentry/taskbroker/deployment-taskworker.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
apiVersion: apps/v1

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@TartanLeGrand Thanks for taking this initiative,
I will also try to contribute to this PR.

But the way this should be implemented is as follows.
We need statfulset for taskbroker, as it will require disk

the way this file should be is

for each taskbroker
{{- range $name, $config := .Values.taskbroker }}
taskworker deployment with n replicas yaml pointing to this taskbroker(n can be 1-32)
{{-end}}

kind: Deployment
metadata:
name: {{ template "sentry.fullname" . }}-taskworker
labels:
app: {{ template "sentry.fullname" . }}
chart: "{{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}"
release: "{{ .Release.Name }}"
heritage: "{{ .Release.Service }}"
app.kubernetes.io/managed-by: "Helm"
{{- if .Values.asHook }}
{{- /* Add the Helm annotations so that deployment after asHook from true to false works */}}
annotations:
meta.helm.sh/release-name: "{{ .Release.Name }}"
meta.helm.sh/release-namespace: "{{ .Release.Namespace }}"
"helm.sh/hook": "post-install,post-upgrade"
"helm.sh/hook-weight": "25"
{{- end }}
spec:
selector:
matchLabels:
app: {{ template "sentry.fullname" . }}
release: "{{ .Release.Name }}"
role: taskworker
replicas: {{ .Values.sentry.replicas }}
revisionHistoryLimit: {{ .Values.revisionHistoryLimit }}
template:
metadata:
annotations:
checksum/configmap.yaml: {{ include "sentry.config" . | sha256sum }}
{{- if .Values.sentry.annotations }}
{{ toYaml .Values.sentry.annotations | indent 8 }}
{{- end }}
labels:
app: {{ template "sentry.fullname" . }}
release: "{{ .Release.Name }}"
role: taskworker
{{- if .Values.sentry.podLabels }}
{{ toYaml .Values.sentry.podLabels | indent 8 }}
{{- end }}
spec:
affinity:
{{- if .Values.sentry.affinity }}
{{ toYaml .Values.sentry.affinity | indent 8 }}
{{- end }}
{{- if .Values.sentry.nodeSelector }}
nodeSelector:
{{ toYaml .Values.sentry.nodeSelector | indent 8 }}
{{- else if .Values.global.nodeSelector }}
nodeSelector:
{{ toYaml .Values.global.nodeSelector | indent 8 }}
{{- end }}
{{- if .Values.sentry.tolerations }}
tolerations:
{{ toYaml .Values.sentry.tolerations | indent 8 }}
{{- else if .Values.global.tolerations }}
tolerations:
{{ toYaml .Values.global.tolerations | indent 8 }}
{{- end }}
{{- if .Values.sentry.topologySpreadConstraints }}
topologySpreadConstraints:
{{ toYaml .Values.sentry.topologySpreadConstraints | indent 8 }}
{{- end }}
{{- if .Values.images.sentry.imagePullSecrets }}
imagePullSecrets:
{{ toYaml .Values.images.sentry.imagePullSecrets | indent 8 }}
{{- end }}
{{- if .Values.sentry.securityContext }}
securityContext:
{{ toYaml .Values.sentry.securityContext | indent 8 }}
{{- end }}
containers:
- name: {{ .Chart.Name }}-taskworker
{{- if .Values.sentry.args }}
args:
{{ toYaml .Values.sentry.args | indent 10 }}
{{- end }}
command: ["sentry"]
args:
- run
- taskworker
- --concurrency=4
- --rpc-host={{ include "taskbroker.host" . }}:50051
image: "{{ template "sentry.image" . }}"
imagePullPolicy: {{ default "IfNotPresent" .Values.images.sentry.pullPolicy }}
env:
{{- include "sentry.env" . | nindent 8 }}
{{- if .Values.sentry.env }}
{{ toYaml .Values.sentry.env | indent 8 }}
{{- end }}
resources:
{{ toYaml .Values.sentry.resources | indent 12 }}
{{- if .Values.sentry.containerSecurityContext }}
securityContext:
{{ toYaml .Values.sentry.containerSecurityContext | indent 12 }}
{{- end }}
{{- if .Values.sentry.sidecars }}
{{ toYaml .Values.sentry.sidecars | indent 6 }}
{{- end }}
{{- if .Values.global.sidecars }}
{{ toYaml .Values.global.sidecars | indent 6 }}
{{- end }}
{{- if .Values.serviceAccount.enabled }}
serviceAccountName: {{ .Values.serviceAccount.name }}-taskworker
{{- end }}
{{- if .Values.sentry.priorityClassName }}
priorityClassName: "{{ .Values.sentry.priorityClassName }}"
{{- end }}
volumes:
- name: config
configMap:
name: {{ template "sentry.fullname" . }}-sentry
Loading
Loading