Skip to content

Commit 7b964f1

Browse files
authored
feat: allow additional ingress definitions (#41)
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 068482a commit 7b964f1

File tree

8 files changed

+362
-30
lines changed

8 files changed

+362
-30
lines changed

.changeset/angry-lines-repair.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"helm-charts": minor
3+
---
4+
5+
Allow defining additional ingresses so resources outside of the HyperDX application can accept traffic outside of the cluster.

.github/workflows/chart-test.yml

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ on:
1616
jobs:
1717
test-helm-chart:
1818
runs-on: ubuntu-latest
19-
19+
2020
steps:
2121
- name: Checkout code
2222
uses: actions/checkout@v4
@@ -55,7 +55,7 @@ jobs:
5555
5656
- name: Run Helm unit tests
5757
run: |
58-
helm plugin install https://github.com/quintush/helm-unittest || true
58+
helm plugin install https://github.com/helm-unittest/helm-unittest.git || true
5959
helm unittest charts/hdx-oss-v2
6060
6161
- name: Deploy HyperDX chart
@@ -66,33 +66,33 @@ jobs:
6666
apiKey: "test-api-key-for-ci"
6767
appUrl: "http://localhost:3000"
6868
replicas: 1
69-
69+
7070
clickhouse:
7171
persistence:
7272
enabled: true
7373
dataSize: 2Gi
7474
logSize: 1Gi
75-
75+
7676
persistence:
7777
mongodb:
7878
enabled: true
7979
size: 2Gi
80-
80+
8181
# Enable NodePort services for testing
8282
hyperdx:
8383
service:
8484
type: NodePort
8585
nodePort: 30000
86-
86+
8787
otel:
8888
service:
8989
type: NodePort
9090
nodePort: 30001
9191
EOF
92-
92+
9393
# Install the chart
9494
helm install hyperdx-test ./charts/hdx-oss-v2 -f test-values.yaml --timeout=2m
95-
95+
9696
# Give services time to initialize after pods are running
9797
echo "Waiting for services to initialize..."
9898
sleep 20
@@ -101,18 +101,18 @@ jobs:
101101
run: |
102102
# Wait for all pods to be ready
103103
kubectl wait --for=condition=Ready pods --all --timeout=300s
104-
104+
105105
# Check pod status
106106
kubectl get pods -o wide
107-
107+
108108
# Check services
109109
kubectl get services
110110
111111
- name: Run comprehensive smoke tests
112112
run: |
113113
# Make smoke test script executable
114114
chmod +x ./scripts/smoke-test.sh
115-
115+
116116
# Run the smoke test with CI-specific environment
117117
RELEASE_NAME=hyperdx-test NAMESPACE=default ./scripts/smoke-test.sh
118118
@@ -121,19 +121,19 @@ jobs:
121121
run: |
122122
echo "=== Pod Status ==="
123123
kubectl get pods -o wide
124-
124+
125125
echo "=== Events ==="
126126
kubectl get events --sort-by=.metadata.creationTimestamp
127-
127+
128128
echo "=== HyperDX App Logs ==="
129129
kubectl logs -l app=app --tail=100 || true
130-
130+
131131
echo "=== ClickHouse Logs ==="
132132
kubectl logs -l app=clickhouse --tail=100 || true
133-
133+
134134
echo "=== MongoDB Logs ==="
135135
kubectl logs -l app=mongodb --tail=100 || true
136-
136+
137137
echo "=== OTEL Collector Logs ==="
138138
kubectl logs -l app=otel-collector --tail=100 || true
139139

.github/workflows/helm-test.yaml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,11 @@ jobs:
2626
uses: azure/setup-helm@v3
2727
with:
2828
version: v3.12.0
29-
29+
3030
- name: Install helm-unittest plugin
3131
run: |
32-
helm plugin install https://github.com/quintush/helm-unittest
33-
32+
helm plugin install https://github.com/helm-unittest/helm-unittest.git
33+
3434
- name: Run helm-unittest
3535
run: |
36-
helm unittest charts/hdx-oss-v2
36+
helm unittest charts/hdx-oss-v2

README.md

Lines changed: 34 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,39 @@ hyperdx:
106106
otelExporterEndpoint: "http://your-otel-collector:4318"
107107
```
108108
109+
#### Configuring Ingress for OTEL Collector
110+
111+
If you need to expose your OTEL collector endpoints through ingress, you can use the additional ingresses configuration. The example below uses a regex pattern to capture all OTLP endpoints (traces, metrics, and logs) in a single path rule:
112+
113+
```yaml
114+
hyperdx:
115+
ingress:
116+
enabled: true
117+
additionalIngresses:
118+
- name: otel-collector
119+
annotations:
120+
nginx.ingress.kubernetes.io/ssl-redirect: "false"
121+
nginx.ingress.kubernetes.io/force-ssl-redirect: "false"
122+
nginx.ingress.kubernetes.io/use-regex: "true"
123+
ingressClassName: nginx
124+
hosts:
125+
- host: collector.yourdomain.com
126+
paths:
127+
- path: /v1/(traces|metrics|logs)
128+
pathType: Prefix
129+
port: 4318
130+
tls:
131+
- hosts:
132+
- collector.yourdomain.com
133+
secretName: collector-tls
134+
```
135+
136+
This configuration creates a separate ingress resource for the OTEL collector endpoints, allowing you to:
137+
- Use a different domain for collector traffic
138+
- Configure specific TLS settings
139+
- Apply custom annotations for the collector ingress
140+
- Route all telemetry signals through a single regex-based path rule
141+
109142
### Minimal Deployment
110143
111144
For organizations with existing infrastructure:
@@ -285,7 +318,7 @@ helm install my-hyperdx hyperdx/hdx-oss-v2 \
285318
# values-gke.yaml
286319
hyperdx:
287320
appUrl: "http://34.123.61.99" # Use your LoadBalancer external IP
288-
321+
289322
otel:
290323
opampServerUrl: "http://my-hyperdx-hdx-oss-v2-app.default.svc.cluster.local:4320"
291324

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

Lines changed: 56 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,4 +35,59 @@ 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+
{{- if not (kindIs "map" .annotations) }}
48+
{{- fail "annotations must be a map of string key-value pairs" }}
49+
{{- end }}
50+
annotations:
51+
{{- range $key, $value := .annotations }}
52+
{{- printf "%s: %s" $key (tpl $value $ | quote) | nindent 4 }}
53+
{{- end }}
54+
{{- end }}
55+
spec:
56+
{{- if .ingressClassName }}
57+
ingressClassName: {{ .ingressClassName }}
58+
{{- end -}}
59+
{{- if .tls }}
60+
tls:
61+
{{- range .tls }}
62+
{{- if not .hosts }}
63+
{{- fail "TLS configuration must contain hosts property" }}
64+
{{- end }}
65+
- hosts:
66+
{{- range .hosts }}
67+
- {{ tpl . $ | quote }}
68+
{{- end }}
69+
{{- with .secretName }}
70+
secretName: {{ . }}
71+
{{- end }}
72+
{{- end }}
73+
{{- end }}
74+
rules:
75+
{{- range .hosts }}
76+
- host: {{ tpl .host $ | quote }}
77+
http:
78+
paths:
79+
{{- range .paths }}
80+
{{- if or (not .path) (not .pathType) (not .port) }}
81+
{{- fail "Each path in additional ingress must contain path, pathType, and port properties" }}
82+
{{- end }}
83+
- path: {{ .path }}
84+
pathType: {{ .pathType }}
85+
backend:
86+
service:
87+
name: {{ include "hdx-oss.fullname" $ }}
88+
port:
89+
number: {{ .port }}
90+
{{- end }}
91+
{{- end }}
92+
{{- end }}
93+
{{- end }}
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
should render additional ingress templates:
2+
1: |
3+
apiVersion: networking.k8s.io/v1
4+
kind: Ingress
5+
metadata:
6+
annotations:
7+
another: "yes"
8+
testProperty: "true"
9+
labels:
10+
app.kubernetes.io/instance: RELEASE-NAME
11+
app.kubernetes.io/managed-by: Helm
12+
app.kubernetes.io/name: hdx-oss-v2
13+
app.kubernetes.io/version: 1.0.0
14+
helm.sh/chart: hdx-oss-v2-0.5.2
15+
name: RELEASE-NAME-hdx-oss-v2-otel-collector
16+
spec:
17+
ingressClassName: nginx
18+
rules:
19+
- host: collector.example.com
20+
http:
21+
paths:
22+
- backend:
23+
service:
24+
name: RELEASE-NAME-hdx-oss-v2
25+
port:
26+
number: 4318
27+
path: /
28+
pathType: Prefix
29+
should render additional ingress templates with TLS enabled:
30+
1: |
31+
apiVersion: networking.k8s.io/v1
32+
kind: Ingress
33+
metadata:
34+
annotations:
35+
another: "yes"
36+
testProperty: "true"
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
57+
tls:
58+
- hosts:
59+
- collector.example.com
60+
secretName: otel-collector-tls

0 commit comments

Comments
 (0)