Skip to content

Commit 096bac6

Browse files
authored
feat(ingress): Add native Traefik IngressRoute support (#1972)
1 parent becd03c commit 096bac6

File tree

3 files changed

+138
-0
lines changed

3 files changed

+138
-0
lines changed
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# Add this to templates/_helpers.tpl if not already present
2+
3+
{{/*
4+
Relay port
5+
*/}}
6+
{{- define "relay.port" -}}
7+
{{- default 3000 .Values.relay.service.port -}}
8+
{{- end -}}
Lines changed: 100 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,100 @@
1+
{{- if .Values.traefikIngressRoute.enabled }}
2+
apiVersion: traefik.io/v1alpha1
3+
kind: IngressRoute
4+
metadata:
5+
name: {{ template "sentry.fullname" . }}-relay
6+
namespace: {{ .Release.Namespace }}
7+
labels:
8+
app: {{ template "sentry.fullname" . }}
9+
chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
10+
release: "{{ .Release.Name }}"
11+
heritage: "{{ .Release.Service }}"
12+
{{- with .Values.traefikIngressRoute.labels }}
13+
{{- toYaml . | nindent 4 }}
14+
{{- end }}
15+
{{- with .Values.traefikIngressRoute.annotations }}
16+
annotations:
17+
{{- toYaml . | nindent 4 }}
18+
{{- end }}
19+
spec:
20+
{{- with .Values.traefikIngressRoute.entryPoints }}
21+
entryPoints:
22+
{{- toYaml . | nindent 4 }}
23+
{{- end }}
24+
routes:
25+
# Route for project-specific API endpoints (e.g., /api/2/store/, /api/123/envelope/)
26+
# This handles SDK event ingestion
27+
- match: Host(`{{ .Values.traefikIngressRoute.hostname | default .Values.ingress.hostname }}`) && PathRegexp(`/api/[0-9]+/`)
28+
kind: Rule
29+
priority: {{ .Values.traefikIngressRoute.priority | default 100 }}
30+
services:
31+
- name: {{ template "sentry.fullname" . }}-relay
32+
port: {{ template "relay.port" . }}
33+
34+
# Route for /api/store (legacy endpoint)
35+
- match: Host(`{{ .Values.traefikIngressRoute.hostname | default .Values.ingress.hostname }}`) && PathPrefix(`/api/store`)
36+
kind: Rule
37+
priority: {{ .Values.traefikIngressRoute.priority | default 100 }}
38+
services:
39+
- name: {{ template "sentry.fullname" . }}-relay
40+
port: {{ template "relay.port" . }}
41+
42+
# Route for relay-to-relay communication
43+
- match: Host(`{{ .Values.traefikIngressRoute.hostname | default .Values.ingress.hostname }}`) && PathPrefix(`/api/0/relays`)
44+
kind: Rule
45+
priority: {{ .Values.traefikIngressRoute.priority | default 100 }}
46+
services:
47+
- name: {{ template "sentry.fullname" . }}-relay
48+
port: {{ template "relay.port" . }}
49+
{{- if .Values.traefikIngressRoute.tls }}
50+
tls:
51+
{{- with .Values.traefikIngressRoute.tls.secretName }}
52+
secretName: {{ . }}
53+
{{- end }}
54+
{{- with .Values.traefikIngressRoute.tls.options }}
55+
options:
56+
{{- toYaml . | nindent 6 }}
57+
{{- end }}
58+
{{- end }}
59+
---
60+
apiVersion: traefik.io/v1alpha1
61+
kind: IngressRoute
62+
metadata:
63+
name: {{ template "sentry.fullname" . }}-web
64+
namespace: {{ .Release.Namespace }}
65+
labels:
66+
app: {{ template "sentry.fullname" . }}
67+
chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
68+
release: "{{ .Release.Name }}"
69+
heritage: "{{ .Release.Service }}"
70+
{{- with .Values.traefikIngressRoute.labels }}
71+
{{- toYaml . | nindent 4 }}
72+
{{- end }}
73+
{{- with .Values.traefikIngressRoute.annotations }}
74+
annotations:
75+
{{- toYaml . | nindent 4 }}
76+
{{- end }}
77+
spec:
78+
{{- with .Values.traefikIngressRoute.entryPoints }}
79+
entryPoints:
80+
{{- toYaml . | nindent 4 }}
81+
{{- end }}
82+
routes:
83+
# Catch-all route for Sentry web UI and API
84+
- match: Host(`{{ .Values.traefikIngressRoute.hostname | default .Values.ingress.hostname }}`)
85+
kind: Rule
86+
priority: {{ sub (.Values.traefikIngressRoute.priority | default 100) 10 }}
87+
services:
88+
- name: {{ template "sentry.fullname" . }}-web
89+
port: {{ .Values.service.externalPort }}
90+
{{- if .Values.traefikIngressRoute.tls }}
91+
tls:
92+
{{- with .Values.traefikIngressRoute.tls.secretName }}
93+
secretName: {{ . }}
94+
{{- end }}
95+
{{- with .Values.traefikIngressRoute.tls.options }}
96+
options:
97+
{{- toYaml . | nindent 6 }}
98+
{{- end }}
99+
{{- end }}
100+
{{- end }}

charts/sentry/values.yaml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2401,6 +2401,36 @@ ingress:
24012401
# - secretName:
24022402
# hosts:
24032403

2404+
traefikIngressRoute:
2405+
# -- Enable Traefik IngressRoute instead of standard Ingress
2406+
# Use this when running Traefik as your ingress controller for proper regex path matching
2407+
enabled: false
2408+
2409+
# -- Traefik entrypoints to use
2410+
entryPoints:
2411+
- web
2412+
- websecure
2413+
2414+
# -- Hostname for the IngressRoute
2415+
# hostname: sentry.example.com
2416+
2417+
# -- TLS configuration (optional, omit if TLS is terminated upstream)
2418+
tls: {}
2419+
# secretName: sentry-tls
2420+
# options:
2421+
# name: default
2422+
# namespace: default
2423+
2424+
# -- Additional route annotations
2425+
annotations: {}
2426+
2427+
# -- Additional route labels
2428+
labels: {}
2429+
2430+
# -- Route priority (higher = matched first)
2431+
priority: 100
2432+
2433+
24042434
filestore:
24052435
# Set to one of filesystem, gcs or s3 as supported by Sentry.
24062436
backend: filesystem

0 commit comments

Comments
 (0)