Skip to content

Commit 32ff4e0

Browse files
committed
feat: allow additional ingress definitions
Adds a method for supplying additional ingress definitions, which allows users to expose any other helm chart resources outside of the cluster. Ref: HDX-1843
1 parent cec5983 commit 32ff4e0

File tree

4 files changed

+137
-6
lines changed

4 files changed

+137
-6
lines changed

charts/hdx-oss-v2/templates/ingress.yaml

Lines changed: 47 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,4 +35,50 @@ spec:
3535
name: {{ include "hdx-oss.fullname" . }}-app
3636
port:
3737
number: {{ .Values.hyperdx.appPort }}
38-
{{- end }}
38+
{{- range .Values.hyperdx.ingress.additionalIngresses}}
39+
---
40+
apiVersion: networking.k8s.io/v1
41+
kind: Ingress
42+
metadata:
43+
name: {{ printf "%s-%s" (include "hdx-oss.fullname" $) .name }}
44+
labels:
45+
{{- include "hdx-oss.labels" $ | nindent 4 }}
46+
{{- if .annotations }}
47+
annotations:
48+
{{- range $key, $value := .annotations }}
49+
{{- printf "%s: %s" $key (tpl $value $ | quote) | nindent 4 }}
50+
{{- end }}
51+
{{- end }}
52+
spec:
53+
{{- if .ingressClassName }}
54+
ingressClassName: {{ .ingressClassName }}
55+
{{- end -}}
56+
{{- if .tls }}
57+
tls:
58+
{{- range .tls }}
59+
- hosts:
60+
{{- range .hosts }}
61+
- {{ tpl . $ | quote }}
62+
{{- end }}
63+
{{- with .secretName }}
64+
secretName: {{ . }}
65+
{{- end }}
66+
{{- end }}
67+
{{- end }}
68+
rules:
69+
{{- range .hosts }}
70+
- host: {{ tpl .host $ | quote }}
71+
http:
72+
paths:
73+
{{- range .paths }}
74+
- path: {{ .path }}
75+
pathType: {{ .pathType }}
76+
backend:
77+
service:
78+
name: {{ include "hdx-oss.fullname" $ }}
79+
port:
80+
number: {{ .port }}
81+
{{- end }}
82+
{{- end }}
83+
{{- end }}
84+
{{- end }}
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
should support additional ingress definitions:
2+
1: |
3+
apiVersion: networking.k8s.io/v1
4+
kind: Ingress
5+
metadata:
6+
annotations:
7+
nginx.ingress.kubernetes.io/proxy-body-size: 100m
8+
nginx.ingress.kubernetes.io/proxy-connect-timeout: "60"
9+
nginx.ingress.kubernetes.io/proxy-read-timeout: "60"
10+
nginx.ingress.kubernetes.io/proxy-send-timeout: "60"
11+
nginx.ingress.kubernetes.io/rewrite-target: /$1
12+
nginx.ingress.kubernetes.io/use-regex: "true"
13+
labels:
14+
app.kubernetes.io/instance: RELEASE-NAME
15+
app.kubernetes.io/managed-by: Helm
16+
app.kubernetes.io/name: hdx-oss-v2
17+
app.kubernetes.io/version: 1.0.0
18+
helm.sh/chart: hdx-oss-v2-0.5.2
19+
name: RELEASE-NAME-hdx-oss-v2-app-ingress
20+
spec:
21+
ingressClassName: nginx
22+
rules:
23+
- host: hyperdx.example.com
24+
http:
25+
paths:
26+
- backend:
27+
service:
28+
name: RELEASE-NAME-hdx-oss-v2-app
29+
port:
30+
number: 3000
31+
path: /(.*)
32+
pathType: Prefix
33+
2: |
34+
apiVersion: networking.k8s.io/v1
35+
kind: Ingress
36+
metadata:
37+
labels:
38+
app.kubernetes.io/instance: RELEASE-NAME
39+
app.kubernetes.io/managed-by: Helm
40+
app.kubernetes.io/name: hdx-oss-v2
41+
app.kubernetes.io/version: 1.0.0
42+
helm.sh/chart: hdx-oss-v2-0.5.2
43+
name: RELEASE-NAME-hdx-oss-v2-otel-collector
44+
spec:
45+
ingressClassName: nginx
46+
rules:
47+
- host: collector.example.com
48+
http:
49+
paths:
50+
- backend:
51+
service:
52+
name: RELEASE-NAME-hdx-oss-v2
53+
port:
54+
number: 4318
55+
path: /
56+
pathType: Prefix

charts/hdx-oss-v2/tests/ingress_test.yaml

Lines changed: 29 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ tests:
1010
asserts:
1111
- hasDocuments:
1212
count: 0
13-
13+
1414
- it: should render ingress correctly when enabled without TLS
1515
set:
1616
hyperdx:
@@ -52,7 +52,7 @@ tests:
5252
- matchRegex:
5353
path: metadata.labels["helm.sh/chart"]
5454
pattern: ^hdx-oss-v2-\d+\.\d+\.\d+$
55-
55+
5656
- it: should render ingress with TLS when enabled
5757
set:
5858
hyperdx:
@@ -70,4 +70,30 @@ tests:
7070
value: hyperdx.example.com
7171
- equal:
7272
path: spec.tls[0].secretName
73-
value: hyperdx-tls
73+
value: hyperdx-tls
74+
75+
- it: should support additional ingress definitions
76+
set:
77+
hyperdx:
78+
ingress:
79+
enabled: true
80+
host: hyperdx.example.com
81+
proxyBodySize: 100m
82+
proxyConnectTimeout: "60"
83+
proxySendTimeout: "60"
84+
proxyReadTimeout: "60"
85+
tls:
86+
enabled: false
87+
additionalIngresses:
88+
- name: otel-collector
89+
ingressClassName: nginx
90+
hosts:
91+
- host: collector.example.com
92+
paths:
93+
- path: /
94+
pathType: Prefix
95+
port: 4318
96+
asserts:
97+
- hasDocuments:
98+
count: 2
99+
- matchSnapshot: {}

charts/hdx-oss-v2/values.yaml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ hyperdx:
136136
"metricSourceId": "Metrics"
137137
}
138138
]
139-
139+
140140
# See https://github.com/hyperdxio/hyperdx/blob/v2/packages/api/docs/auto_provision/AUTO_PROVISION.md
141141
# for detailed configuration options
142142

@@ -150,6 +150,9 @@ hyperdx:
150150
tls:
151151
enabled: false
152152
secretName: "hyperdx-tls"
153+
154+
additionalIngresses: []
155+
153156
replicas: 1
154157

155158
mongodb:
@@ -205,7 +208,7 @@ otel:
205208
clickhouseEndpoint:
206209
clickhouseUser:
207210
clickhousePassword:
208-
# Clickhouse Prometheus endpoint - defaults to chart's Clickhouse prometheus service. Customize if you want to use a different Clickhouse prometheus service.
211+
# Clickhouse Prometheus endpoint - defaults to chart's Clickhouse prometheus service. Customize if you want to use a different Clickhouse prometheus service.
209212
# Leave empty if prometheus is disabled.
210213
# Example: clickhousePrometheusEndpoint: "http://custom-clickhouse-service:9363"
211214
clickhousePrometheusEndpoint:

0 commit comments

Comments
 (0)