Skip to content

Commit

Permalink
split post-process-forwarder
Browse files Browse the repository at this point in the history
  • Loading branch information
ntcong committed Oct 31, 2022
1 parent 0a64d95 commit b56397d
Show file tree
Hide file tree
Showing 6 changed files with 229 additions and 31 deletions.
2 changes: 1 addition & 1 deletion sentry/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ apiVersion: v2
name: sentry
description: A Helm chart for Kubernetes
type: application
version: 16.0.5
version: 16.0.6
appVersion: 22.9.0
dependencies:
- name: memcached
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ template "sentry.fullname" . }}-post-process-forward
name: {{ template "sentry.fullname" . }}-post-process-forward-errors
labels:
app: sentry
chart: "{{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}"
Expand All @@ -22,36 +22,36 @@ spec:
matchLabels:
app: sentry
release: "{{ .Release.Name }}"
role: sentry-post-process-forward
replicas: {{ .Values.sentry.postProcessForward.replicas }}
role: sentry-post-process-forward-errors
replicas: {{ .Values.sentry.postProcessForwardErrors.replicas }}
template:
metadata:
annotations:
checksum/configYml: {{ .Values.config.configYml | toYaml | toString | sha256sum }}
checksum/sentryConfPy: {{ .Values.config.sentryConfPy | sha256sum }}
checksum/config.yaml: {{ include (print $.Template.BasePath "/configmap-sentry.yaml") . | sha256sum }}
{{- if .Values.sentry.postProcessForward.annotations }}
{{ toYaml .Values.sentry.postProcessForward.annotations | indent 8 }}
{{- if .Values.sentry.postProcessForwardErrors.annotations }}
{{ toYaml .Values.sentry.postProcessForwardErrors.annotations | indent 8 }}
{{- end }}
labels:
app: sentry
release: "{{ .Release.Name }}"
role: sentry-post-process-forward
{{- if .Values.sentry.postProcessForward.podLabels }}
{{ toYaml .Values.sentry.postProcessForward.podLabels | indent 8 }}
role: sentry-post-process-forward-errors
{{- if .Values.sentry.postProcessForwardErrors.podLabels }}
{{ toYaml .Values.sentry.postProcessForwardErrors.podLabels | indent 8 }}
{{- end }}
spec:
affinity:
{{- if .Values.sentry.postProcessForward.affinity }}
{{ toYaml .Values.sentry.postProcessForward.affinity | indent 8 }}
{{- if .Values.sentry.postProcessForwardErrors.affinity }}
{{ toYaml .Values.sentry.postProcessForwardErrors.affinity | indent 8 }}
{{- end }}
{{- if .Values.sentry.postProcessForward.nodeSelector }}
{{- if .Values.sentry.postProcessForwardErrors.nodeSelector }}
nodeSelector:
{{ toYaml .Values.sentry.postProcessForward.nodeSelector | indent 8 }}
{{ toYaml .Values.sentry.postProcessForwardErrors.nodeSelector | indent 8 }}
{{- end }}
{{- if .Values.sentry.postProcessForward.tolerations }}
{{- if .Values.sentry.postProcessForwardErrors.tolerations }}
tolerations:
{{ toYaml .Values.sentry.postProcessForward.tolerations | indent 8 }}
{{ toYaml .Values.sentry.postProcessForwardErrors.tolerations | indent 8 }}
{{- end }}
{{- if .Values.images.sentry.imagePullSecrets }}
imagePullSecrets:
Expand All @@ -64,15 +64,22 @@ spec:
dnsConfig:
{{ toYaml .Values.dnsConfig | indent 8 }}
{{- end }}
{{- if .Values.sentry.postProcessForward.securityContext }}
{{- if .Values.sentry.postProcessForwardErrors.securityContext }}
securityContext:
{{ toYaml .Values.sentry.postProcessForward.securityContext | indent 8 }}
{{ toYaml .Values.sentry.postProcessForwardErrors.securityContext | indent 8 }}
{{- end }}
containers:
- name: {{ .Chart.Name }}-post-process-forward
- name: {{ .Chart.Name }}-post-process-forward-errors
image: "{{ template "sentry.image" . }}"
imagePullPolicy: {{ default "IfNotPresent" .Values.images.sentry.pullPolicy }}
command: ["sentry", "run", "post-process-forwarder", "--commit-batch-size", "{{ default "1" .Values.sentry.postProcessForward.commitBatchSize }}"]
command: ["sentry"]
args:
- "run"
- "post-process-forwarder"
- "--commit-batch-size"
- "{{ default "1" .Values.sentry.postProcessForwardErrors.commitBatchSize }}"
- "--entity"
- "errors"
env:
- name: SNUBA
value: http://{{ template "sentry.fullname" . }}-snuba:{{ template "snuba.port" }}
Expand Down Expand Up @@ -109,8 +116,8 @@ spec:
- name: GOOGLE_APPLICATION_CREDENTIALS
value: /var/run/secrets/google/{{ .Values.filestore.gcs.credentialsFile }}
{{ end }}
{{- if .Values.sentry.postProcessForward.env }}
{{ toYaml .Values.sentry.postProcessForward.env | indent 8 }}
{{- if .Values.sentry.postProcessForwardErrors.env }}
{{ toYaml .Values.sentry.postProcessForwardErrors.env | indent 8 }}
{{- end }}
volumeMounts:
- mountPath: /etc/sentry
Expand All @@ -123,12 +130,12 @@ spec:
mountPath: /var/run/secrets/google
{{ end }}
resources:
{{ toYaml .Values.sentry.postProcessForward.resources | indent 12 }}
{{- if .Values.sentry.postProcessForward.sidecars }}
{{ toYaml .Values.sentry.postProcessForward.sidecars | indent 6 }}
{{ toYaml .Values.sentry.postProcessForwardErrors.resources | indent 12 }}
{{- if .Values.sentry.postProcessForwardErrors.sidecars }}
{{ toYaml .Values.sentry.postProcessForwardErrors.sidecars | indent 6 }}
{{- end }}
{{- if .Values.serviceAccount.enabled }}
serviceAccountName: {{ .Values.serviceAccount.name }}-post-process-forwarder
serviceAccountName: {{ .Values.serviceAccount.name }}-post-process-forwarder-errors
{{- end }}
volumes:
- name: config
Expand All @@ -151,9 +158,9 @@ spec:
secret:
secretName: {{ .Values.filestore.gcs.secretName }}
{{ end }}
{{- if .Values.sentry.postProcessForward.volumes }}
{{ toYaml .Values.sentry.postProcessForward.volumes | indent 6 }}
{{- if .Values.sentry.postProcessForwardErrors.volumes }}
{{ toYaml .Values.sentry.postProcessForwardErrors.volumes | indent 6 }}
{{- end }}
{{- if .Values.sentry.postProcessForward.priorityClassName }}
priorityClassName: "{{ .Values.sentry.postProcessForward.priorityClassName }}"
{{- if .Values.sentry.postProcessForwardErrors.priorityClassName }}
priorityClassName: "{{ .Values.sentry.postProcessForwardErrors.priorityClassName }}"
{{- end }}
Original file line number Diff line number Diff line change
@@ -0,0 +1,169 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ template "sentry.fullname" . }}-post-process-forward-transactions
labels:
app: sentry
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": "10"
{{- end }}
spec:
revisionHistoryLimit: {{ .Values.revisionHistoryLimit }}
selector:
matchLabels:
app: sentry
release: "{{ .Release.Name }}"
role: sentry-post-process-forward-transactions
replicas: {{ .Values.sentry.postProcessForwardTransactions.replicas }}
template:
metadata:
annotations:
checksum/configYml: {{ .Values.config.configYml | toYaml | toString | sha256sum }}
checksum/sentryConfPy: {{ .Values.config.sentryConfPy | sha256sum }}
checksum/config.yaml: {{ include (print $.Template.BasePath "/configmap-sentry.yaml") . | sha256sum }}
{{- if .Values.sentry.postProcessForwardTransactions.annotations }}
{{ toYaml .Values.sentry.postProcessForwardTransactions.annotations | indent 8 }}
{{- end }}
labels:
app: sentry
release: "{{ .Release.Name }}"
role: sentry-post-process-forward-transactions
{{- if .Values.sentry.postProcessForwardTransactions.podLabels }}
{{ toYaml .Values.sentry.postProcessForwardTransactions.podLabels | indent 8 }}
{{- end }}
spec:
affinity:
{{- if .Values.sentry.postProcessForwardTransactions.affinity }}
{{ toYaml .Values.sentry.postProcessForwardTransactions.affinity | indent 8 }}
{{- end }}
{{- if .Values.sentry.postProcessForwardTransactions.nodeSelector }}
nodeSelector:
{{ toYaml .Values.sentry.postProcessForwardTransactions.nodeSelector | indent 8 }}
{{- end }}
{{- if .Values.sentry.postProcessForwardTransactions.tolerations }}
tolerations:
{{ toYaml .Values.sentry.postProcessForwardTransactions.tolerations | indent 8 }}
{{- end }}
{{- if .Values.images.sentry.imagePullSecrets }}
imagePullSecrets:
{{ toYaml .Values.images.sentry.imagePullSecrets | indent 8 }}
{{- end }}
{{- if .Values.dnsPolicy }}
dnsPolicy: {{ .Values.dnsPolicy | quote }}
{{- end }}
{{- if .Values.dnsConfig }}
dnsConfig:
{{ toYaml .Values.dnsConfig | indent 8 }}
{{- end }}
{{- if .Values.sentry.postProcessForwardTransactions.securityContext }}
securityContext:
{{ toYaml .Values.sentry.postProcessForwardTransactions.securityContext | indent 8 }}
{{- end }}
containers:
- name: {{ .Chart.Name }}-post-process-forward-transactions
image: "{{ template "sentry.image" . }}"
imagePullPolicy: {{ default "IfNotPresent" .Values.images.sentry.pullPolicy }}
command: ["sentry"]
args:
- "run"
- "post-process-forwarder"
- "--commit-batch-size"
- "{{ default "1" .Values.sentry.postProcessForwardTransactions.commitBatchSize }}"
- "--entity"
- "transactions"
- "--commit-log-topic=snuba-transactions-commit-log"
- "--synchronize-commit-group"
- "transactions_group"
env:
- name: SNUBA
value: http://{{ template "sentry.fullname" . }}-snuba:{{ template "snuba.port" }}
{{- if .Values.sentry.existingSecret }}
- name: SENTRY_SECRET_KEY
valueFrom:
secretKeyRef:
name: {{ .Values.sentry.existingSecret }}
key: {{ default "key" .Values.sentry.existingSecretKey }}
{{- else }}
- name: SENTRY_SECRET_KEY
valueFrom:
secretKeyRef:
name: {{ template "sentry.fullname" . }}-sentry-secret
key: "key"
{{- end }}
{{- if .Values.postgresql.enabled }}
- name: POSTGRES_PASSWORD
valueFrom:
secretKeyRef:
name: {{ default (include "sentry.postgresql.fullname" .) .Values.postgresql.existingSecret }}
key: {{ default "postgresql-password" .Values.postgresql.existingSecretKey }}
{{- else if .Values.externalPostgresql.password }}
- name: POSTGRES_PASSWORD
value: {{ .Values.externalPostgresql.password | quote }}
{{- else if .Values.externalPostgresql.existingSecret }}
- name: POSTGRES_PASSWORD
valueFrom:
secretKeyRef:
name: {{ .Values.externalPostgresql.existingSecret }}
key: {{ default "postgresql-password" .Values.externalPostgresql.existingSecretKey }}
{{- end }}
{{ if and (eq .Values.filestore.backend "gcs") .Values.filestore.gcs.secretName }}
- name: GOOGLE_APPLICATION_CREDENTIALS
value: /var/run/secrets/google/{{ .Values.filestore.gcs.credentialsFile }}
{{ end }}
{{- if .Values.sentry.postProcessForwardTransactions.env }}
{{ toYaml .Values.sentry.postProcessForwardTransactions.env | indent 8 }}
{{- end }}
volumeMounts:
- mountPath: /etc/sentry
name: config
readOnly: true
- mountPath: {{ .Values.filestore.filesystem.path }}
name: sentry-data
{{- if and (eq .Values.filestore.backend "gcs") .Values.filestore.gcs.secretName }}
- name: sentry-google-cloud-key
mountPath: /var/run/secrets/google
{{ end }}
resources:
{{ toYaml .Values.sentry.postProcessForwardTransactions.resources | indent 12 }}
{{- if .Values.sentry.postProcessForwardTransactions.sidecars }}
{{ toYaml .Values.sentry.postProcessForwardTransactions.sidecars | indent 6 }}
{{- end }}
{{- if .Values.serviceAccount.enabled }}
serviceAccountName: {{ .Values.serviceAccount.name }}-post-process-forwarder-transactions
{{- end }}
volumes:
- name: config
configMap:
name: {{ template "sentry.fullname" . }}-sentry
- name: sentry-data
{{- if and (eq .Values.filestore.backend "filesystem") .Values.filestore.filesystem.persistence.enabled (.Values.filestore.filesystem.persistence.persistentWorkers) }}
{{- if .Values.filestore.filesystem.persistence.existingClaim }}
persistentVolumeClaim:
claimName: {{ .Values.filestore.filesystem.persistence.existingClaim }}
{{- else }}
persistentVolumeClaim:
claimName: {{ template "sentry.fullname" . }}-data
{{- end }}
{{- else }}
emptyDir: {}
{{ end }}
{{- if and (eq .Values.filestore.backend "gcs") .Values.filestore.gcs.secretName }}
- name: sentry-google-cloud-key
secret:
secretName: {{ .Values.filestore.gcs.secretName }}
{{ end }}
{{- if .Values.sentry.postProcessForwardTransactions.volumes }}
{{ toYaml .Values.sentry.postProcessForwardTransactions.volumes | indent 6 }}
{{- end }}
{{- if .Values.sentry.postProcessForwardTransactions.priorityClassName }}
priorityClassName: "{{ .Values.sentry.postProcessForwardTransactions.priorityClassName }}"
{{- end }}
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
apiVersion: v1
kind: ServiceAccount
metadata:
name: {{ .Values.serviceAccount.name }}-post-process-forwarder
name: {{ .Values.serviceAccount.name }}-post-process-forwarder-errors
{{- if .Values.serviceAccount.annotations }}
annotations: {{ toYaml .Values.serviceAccount.annotations | nindent 4 }}
{{- end }}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{{- if .Values.serviceAccount.enabled }}
apiVersion: v1
kind: ServiceAccount
metadata:
name: {{ .Values.serviceAccount.name }}-post-process-forwarder-transactions
{{- if .Values.serviceAccount.annotations }}
annotations: {{ toYaml .Values.serviceAccount.annotations | nindent 4 }}
{{- end }}
automountServiceAccountToken: {{ .Values.serviceAccount.automountServiceAccountToken }}
{{- end }}
14 changes: 13 additions & 1 deletion sentry/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,19 @@ sentry:
sidecars: []
volumes: []
# noStrictOffsetReset: false
postProcessForward:
postProcessForwardErrors:
replicas: 1
env: []
resources: {}
affinity: {}
nodeSelector: {}
securityContext: {}
# tolerations: []
# podLabels: []
# commitBatchSize: 1
sidecars: []
volumes: []
postProcessForwardTransactions:
replicas: 1
env: []
resources: {}
Expand Down

0 comments on commit b56397d

Please sign in to comment.