Skip to content

Commit b700b2a

Browse files
committed
feat(taskbroker): add deployment, service, and autoscaling configurations
1 parent 999e635 commit b700b2a

File tree

10 files changed

+843
-175
lines changed

10 files changed

+843
-175
lines changed

charts/sentry/templates/_helper.tpl

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,13 @@
5252
{{- default .Chart.AppVersion .Values.images.vroom.tag -}}
5353
{{- end -}}
5454

55+
56+
{{- define "taskbroker.image" -}}
57+
{{- default "getsentry/taskbroker" .Values.images.taskbroker.repository -}}
58+
:
59+
{{- default .Chart.AppVersion .Values.images.taskbroker.tag -}}
60+
{{- end -}}
61+
5562
{{/*
5663
Expand the name of the chart.
5764
*/}}
@@ -688,6 +695,22 @@ Set external Clickhouse password from existingSecret
688695
value: http://{{ template "sentry.fullname" . }}-snuba:{{ template "snuba.port" . }}
689696
{{- end -}}
690697

698+
{{- define "taskbroker.env" -}}
699+
- name: TASKBROKER_KAFKA_CLUSTER
700+
value: {{ include "sentry.kafka.bootstrap_servers_string" . | quote }}
701+
- name: TASKBROKER_KAFKA_DEADLETTER_CLUSTER
702+
value: {{ include "sentry.kafka.bootstrap_servers_string" . | quote }}
703+
- name: TASKBROKER_DB_PATH
704+
value: "/opt/sqlite/taskbroker-activations.sqlite"
705+
{{- end -}}
706+
707+
{{/*
708+
Return the taskbroker service host name
709+
*/}}
710+
{{- define "taskbroker.host" -}}
711+
{{- template "sentry.fullname" . }}-taskbroker
712+
{{- end -}}
713+
691714
{{/*
692715
Common Sentry environment variables
693716
*/}}
@@ -700,6 +723,10 @@ Common Sentry environment variables
700723
value: http://{{ template "sentry.fullname" . }}-snuba:{{ template "snuba.port" . }}
701724
- name: VROOM
702725
value: http://{{ template "sentry.fullname" . }}-vroom:{{ template "vroom.port" . }}
726+
- name: SENTRY_REDIS_HOST
727+
value: {{ $redisHost | quote }}
728+
- name: SENTRY_REDIS_PORT
729+
value: {{ $redisPort | quote }}
703730
{{- if .Values.sentry.existingSecret }}
704731
- name: SENTRY_SECRET_KEY
705732
valueFrom:

charts/sentry/templates/sentry/_helper-sentry.tpl

Lines changed: 337 additions & 175 deletions
Large diffs are not rendered by default.
Lines changed: 124 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,124 @@
1+
apiVersion: apps/v1
2+
kind: Deployment
3+
metadata:
4+
name: {{ template "sentry.fullname" . }}-taskbroker
5+
labels:
6+
app: {{ template "sentry.fullname" . }}
7+
chart: "{{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}"
8+
release: "{{ .Release.Name }}"
9+
heritage: "{{ .Release.Service }}"
10+
app.kubernetes.io/managed-by: "Helm"
11+
{{- if .Values.asHook }}
12+
{{- /* Add the Helm annotations so that deployment after asHook from true to false works */}}
13+
annotations:
14+
meta.helm.sh/release-name: "{{ .Release.Name }}"
15+
meta.helm.sh/release-namespace: "{{ .Release.Namespace }}"
16+
"helm.sh/hook": "post-install,post-upgrade"
17+
"helm.sh/hook-weight": "25"
18+
{{- end }}
19+
spec:
20+
selector:
21+
matchLabels:
22+
app: {{ template "sentry.fullname" . }}
23+
release: "{{ .Release.Name }}"
24+
role: taskbroker
25+
{{- if not .Values.taskbroker.autoscaling.enabled }}
26+
replicas: {{ .Values.taskbroker.replicas }}
27+
{{- end }}
28+
revisionHistoryLimit: {{ .Values.revisionHistoryLimit }}
29+
template:
30+
metadata:
31+
annotations:
32+
{{- if .Values.taskbroker.annotations }}
33+
{{ toYaml .Values.taskbroker.annotations | indent 8 }}
34+
{{- end }}
35+
labels:
36+
app: {{ template "sentry.fullname" . }}
37+
release: "{{ .Release.Name }}"
38+
role: taskbroker
39+
{{- if .Values.taskbroker.podLabels }}
40+
{{ toYaml .Values.taskbroker.podLabels | indent 8 }}
41+
{{- end }}
42+
spec:
43+
affinity:
44+
{{- if .Values.taskbroker.affinity }}
45+
{{ toYaml .Values.taskbroker.affinity | indent 8 }}
46+
{{- end }}
47+
{{- if .Values.taskbroker.nodeSelector }}
48+
nodeSelector:
49+
{{ toYaml .Values.taskbroker.nodeSelector | indent 8 }}
50+
{{- else if .Values.global.nodeSelector }}
51+
nodeSelector:
52+
{{ toYaml .Values.global.nodeSelector | indent 8 }}
53+
{{- end }}
54+
{{- if .Values.taskbroker.tolerations }}
55+
tolerations:
56+
{{ toYaml .Values.taskbroker.tolerations | indent 8 }}
57+
{{- else if .Values.global.tolerations }}
58+
tolerations:
59+
{{ toYaml .Values.global.tolerations | indent 8 }}
60+
{{- end }}
61+
{{- if .Values.taskbroker.topologySpreadConstraints }}
62+
topologySpreadConstraints:
63+
{{ toYaml .Values.taskbroker.topologySpreadConstraints | indent 8 }}
64+
{{- end }}
65+
{{- if .Values.images.taskbroker.imagePullSecrets }}
66+
imagePullSecrets:
67+
{{ toYaml .Values.images.taskbroker.imagePullSecrets | indent 8 }}
68+
{{- end }}
69+
{{- if .Values.taskbroker.securityContext }}
70+
securityContext:
71+
{{ toYaml .Values.taskbroker.securityContext | indent 8 }}
72+
{{- end }}
73+
containers:
74+
- name: {{ .Chart.Name }}-taskbroker
75+
{{- if .Values.taskbroker.args }}
76+
args:
77+
{{ toYaml .Values.taskbroker.args | indent 10 }}
78+
{{- end }}
79+
image: "{{ template "taskbroker.image" . }}"
80+
imagePullPolicy: {{ default "IfNotPresent" .Values.images.taskbroker.pullPolicy }}
81+
env:
82+
{{- include "taskbroker.env" . | nindent 8 }}
83+
{{- if .Values.taskbroker.env }}
84+
{{ toYaml .Values.taskbroker.env | indent 8 }}
85+
{{- end }}
86+
volumeMounts:
87+
- name: taskbroker-storage
88+
mountPath: /opt/sqlite
89+
{{- if .Values.taskbroker.volumeMounts }}
90+
{{ toYaml .Values.taskbroker.volumeMounts | indent 10 }}
91+
{{- end }}
92+
resources:
93+
{{ toYaml .Values.taskbroker.resources | indent 12 }}
94+
{{- if .Values.taskbroker.containerSecurityContext }}
95+
securityContext:
96+
{{ toYaml .Values.taskbroker.containerSecurityContext | indent 12 }}
97+
{{- end }}
98+
{{- if .Values.taskbroker.sidecars }}
99+
{{ toYaml .Values.taskbroker.sidecars | indent 6 }}
100+
{{- end }}
101+
{{- if .Values.global.sidecars }}
102+
{{ toYaml .Values.global.sidecars | indent 6 }}
103+
{{- end }}
104+
{{- if .Values.serviceAccount.enabled }}
105+
serviceAccountName: {{ .Values.serviceAccount.name }}-taskbroker
106+
{{- end }}
107+
volumes:
108+
{{- if .Values.taskbroker.persistence.enabled }}
109+
- name: taskbroker-storage
110+
persistentVolumeClaim:
111+
claimName: sentry-taskbroker-pvc
112+
{{- else }}
113+
- name: taskbroker-storage
114+
emptyDir: {}
115+
{{- end }}
116+
{{- if .Values.taskbroker.volumes }}
117+
{{ toYaml .Values.taskbroker.volumes | indent 6 }}
118+
{{- end }}
119+
{{- if .Values.global.volumes }}
120+
{{ toYaml .Values.global.volumes | indent 6 }}
121+
{{- end }}
122+
{{- if .Values.taskbroker.priorityClassName }}
123+
priorityClassName: "{{ .Values.taskbroker.priorityClassName }}"
124+
{{- end }}
Lines changed: 110 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,110 @@
1+
apiVersion: apps/v1
2+
kind: Deployment
3+
metadata:
4+
name: {{ template "sentry.fullname" . }}-taskscheduler
5+
labels:
6+
app: {{ template "sentry.fullname" . }}
7+
chart: "{{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}"
8+
release: "{{ .Release.Name }}"
9+
heritage: "{{ .Release.Service }}"
10+
app.kubernetes.io/managed-by: "Helm"
11+
{{- if .Values.asHook }}
12+
{{- /* Add the Helm annotations so that deployment after asHook from true to false works */}}
13+
annotations:
14+
meta.helm.sh/release-name: "{{ .Release.Name }}"
15+
meta.helm.sh/release-namespace: "{{ .Release.Namespace }}"
16+
"helm.sh/hook": "post-install,post-upgrade"
17+
"helm.sh/hook-weight": "25"
18+
{{- end }}
19+
spec:
20+
selector:
21+
matchLabels:
22+
app: {{ template "sentry.fullname" . }}
23+
release: "{{ .Release.Name }}"
24+
role: sentry
25+
replicas: {{ .Values.sentry.replicas }}
26+
revisionHistoryLimit: {{ .Values.revisionHistoryLimit }}
27+
template:
28+
metadata:
29+
annotations:
30+
checksum/configmap.yaml: {{ include "sentry.config" . | sha256sum }}
31+
{{- if .Values.sentry.annotations }}
32+
{{ toYaml .Values.sentry.annotations | indent 8 }}
33+
{{- end }}
34+
labels:
35+
app: {{ template "sentry.fullname" . }}
36+
release: "{{ .Release.Name }}"
37+
role: sentry
38+
{{- if .Values.sentry.podLabels }}
39+
{{ toYaml .Values.sentry.podLabels | indent 8 }}
40+
{{- end }}
41+
spec:
42+
affinity:
43+
{{- if .Values.sentry.affinity }}
44+
{{ toYaml .Values.sentry.affinity | indent 8 }}
45+
{{- end }}
46+
{{- if .Values.sentry.nodeSelector }}
47+
nodeSelector:
48+
{{ toYaml .Values.sentry.nodeSelector | indent 8 }}
49+
{{- else if .Values.global.nodeSelector }}
50+
nodeSelector:
51+
{{ toYaml .Values.global.nodeSelector | indent 8 }}
52+
{{- end }}
53+
{{- if .Values.sentry.tolerations }}
54+
tolerations:
55+
{{ toYaml .Values.sentry.tolerations | indent 8 }}
56+
{{- else if .Values.global.tolerations }}
57+
tolerations:
58+
{{ toYaml .Values.global.tolerations | indent 8 }}
59+
{{- end }}
60+
{{- if .Values.sentry.topologySpreadConstraints }}
61+
topologySpreadConstraints:
62+
{{ toYaml .Values.sentry.topologySpreadConstraints | indent 8 }}
63+
{{- end }}
64+
{{- if .Values.images.sentry.imagePullSecrets }}
65+
imagePullSecrets:
66+
{{ toYaml .Values.images.sentry.imagePullSecrets | indent 8 }}
67+
{{- end }}
68+
{{- if .Values.sentry.securityContext }}
69+
securityContext:
70+
{{ toYaml .Values.sentry.securityContext | indent 8 }}
71+
{{- end }}
72+
containers:
73+
- name: {{ .Chart.Name }}-sentry
74+
{{- if .Values.sentry.args }}
75+
args:
76+
{{ toYaml .Values.sentry.args | indent 10 }}
77+
{{- end }}
78+
command: ["sentry"]
79+
args:
80+
- run
81+
- taskworker-scheduler
82+
image: "{{ template "sentry.image" . }}"
83+
imagePullPolicy: {{ default "IfNotPresent" .Values.images.sentry.pullPolicy }}
84+
env:
85+
{{- include "sentry.env" . | nindent 8 }}
86+
{{- if .Values.sentry.env }}
87+
{{ toYaml .Values.sentry.env | indent 8 }}
88+
{{- end }}
89+
resources:
90+
{{ toYaml .Values.sentry.resources | indent 12 }}
91+
{{- if .Values.sentry.containerSecurityContext }}
92+
securityContext:
93+
{{ toYaml .Values.sentry.containerSecurityContext | indent 12 }}
94+
{{- end }}
95+
{{- if .Values.sentry.sidecars }}
96+
{{ toYaml .Values.sentry.sidecars | indent 6 }}
97+
{{- end }}
98+
{{- if .Values.global.sidecars }}
99+
{{ toYaml .Values.global.sidecars | indent 6 }}
100+
{{- end }}
101+
{{- if .Values.serviceAccount.enabled }}
102+
serviceAccountName: {{ .Values.serviceAccount.name }}-sentry
103+
{{- end }}
104+
{{- if .Values.sentry.priorityClassName }}
105+
priorityClassName: "{{ .Values.sentry.priorityClassName }}"
106+
{{- end }}
107+
volumes:
108+
- name: config
109+
configMap:
110+
name: {{ template "sentry.fullname" . }}-sentry
Lines changed: 112 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,112 @@
1+
apiVersion: apps/v1
2+
kind: Deployment
3+
metadata:
4+
name: {{ template "sentry.fullname" . }}-taskworker
5+
labels:
6+
app: {{ template "sentry.fullname" . }}
7+
chart: "{{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}"
8+
release: "{{ .Release.Name }}"
9+
heritage: "{{ .Release.Service }}"
10+
app.kubernetes.io/managed-by: "Helm"
11+
{{- if .Values.asHook }}
12+
{{- /* Add the Helm annotations so that deployment after asHook from true to false works */}}
13+
annotations:
14+
meta.helm.sh/release-name: "{{ .Release.Name }}"
15+
meta.helm.sh/release-namespace: "{{ .Release.Namespace }}"
16+
"helm.sh/hook": "post-install,post-upgrade"
17+
"helm.sh/hook-weight": "25"
18+
{{- end }}
19+
spec:
20+
selector:
21+
matchLabels:
22+
app: {{ template "sentry.fullname" . }}
23+
release: "{{ .Release.Name }}"
24+
role: taskworker
25+
replicas: {{ .Values.sentry.replicas }}
26+
revisionHistoryLimit: {{ .Values.revisionHistoryLimit }}
27+
template:
28+
metadata:
29+
annotations:
30+
checksum/configmap.yaml: {{ include "sentry.config" . | sha256sum }}
31+
{{- if .Values.sentry.annotations }}
32+
{{ toYaml .Values.sentry.annotations | indent 8 }}
33+
{{- end }}
34+
labels:
35+
app: {{ template "sentry.fullname" . }}
36+
release: "{{ .Release.Name }}"
37+
role: taskworker
38+
{{- if .Values.sentry.podLabels }}
39+
{{ toYaml .Values.sentry.podLabels | indent 8 }}
40+
{{- end }}
41+
spec:
42+
affinity:
43+
{{- if .Values.sentry.affinity }}
44+
{{ toYaml .Values.sentry.affinity | indent 8 }}
45+
{{- end }}
46+
{{- if .Values.sentry.nodeSelector }}
47+
nodeSelector:
48+
{{ toYaml .Values.sentry.nodeSelector | indent 8 }}
49+
{{- else if .Values.global.nodeSelector }}
50+
nodeSelector:
51+
{{ toYaml .Values.global.nodeSelector | indent 8 }}
52+
{{- end }}
53+
{{- if .Values.sentry.tolerations }}
54+
tolerations:
55+
{{ toYaml .Values.sentry.tolerations | indent 8 }}
56+
{{- else if .Values.global.tolerations }}
57+
tolerations:
58+
{{ toYaml .Values.global.tolerations | indent 8 }}
59+
{{- end }}
60+
{{- if .Values.sentry.topologySpreadConstraints }}
61+
topologySpreadConstraints:
62+
{{ toYaml .Values.sentry.topologySpreadConstraints | indent 8 }}
63+
{{- end }}
64+
{{- if .Values.images.sentry.imagePullSecrets }}
65+
imagePullSecrets:
66+
{{ toYaml .Values.images.sentry.imagePullSecrets | indent 8 }}
67+
{{- end }}
68+
{{- if .Values.sentry.securityContext }}
69+
securityContext:
70+
{{ toYaml .Values.sentry.securityContext | indent 8 }}
71+
{{- end }}
72+
containers:
73+
- name: {{ .Chart.Name }}-taskworker
74+
{{- if .Values.sentry.args }}
75+
args:
76+
{{ toYaml .Values.sentry.args | indent 10 }}
77+
{{- end }}
78+
command: ["sentry"]
79+
args:
80+
- run
81+
- taskworker
82+
- --concurrency=4
83+
- --rpc-host={{ include "taskbroker.host" . }}:50051
84+
image: "{{ template "sentry.image" . }}"
85+
imagePullPolicy: {{ default "IfNotPresent" .Values.images.sentry.pullPolicy }}
86+
env:
87+
{{- include "sentry.env" . | nindent 8 }}
88+
{{- if .Values.sentry.env }}
89+
{{ toYaml .Values.sentry.env | indent 8 }}
90+
{{- end }}
91+
resources:
92+
{{ toYaml .Values.sentry.resources | indent 12 }}
93+
{{- if .Values.sentry.containerSecurityContext }}
94+
securityContext:
95+
{{ toYaml .Values.sentry.containerSecurityContext | indent 12 }}
96+
{{- end }}
97+
{{- if .Values.sentry.sidecars }}
98+
{{ toYaml .Values.sentry.sidecars | indent 6 }}
99+
{{- end }}
100+
{{- if .Values.global.sidecars }}
101+
{{ toYaml .Values.global.sidecars | indent 6 }}
102+
{{- end }}
103+
{{- if .Values.serviceAccount.enabled }}
104+
serviceAccountName: {{ .Values.serviceAccount.name }}-taskworker
105+
{{- end }}
106+
{{- if .Values.sentry.priorityClassName }}
107+
priorityClassName: "{{ .Values.sentry.priorityClassName }}"
108+
{{- end }}
109+
volumes:
110+
- name: config
111+
configMap:
112+
name: {{ template "sentry.fullname" . }}-sentry

0 commit comments

Comments
 (0)