Skip to content

Commit a06f212

Browse files
MikeShi42wrn14897
andauthored
Improve ingress configs (#90)
- allows specifying ingress `path` and `pathType` for different ingress controllers - allows customizing additional ingresses service names to route to the correct otel collector service (with README update) Closes HDX-2033, HDX-2064 Resolves #72, #74 Co-authored-by: Warren <[email protected]>
1 parent 4a5194f commit a06f212

File tree

6 files changed

+144
-3
lines changed

6 files changed

+144
-3
lines changed

.changeset/ready-donuts-hope.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"helm-charts": patch
3+
---
4+
5+
feat: allows customizing additional ingresses service names to route to the correct otel collector service (with README update)

.changeset/spicy-cooks-study.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"helm-charts": patch
3+
---
4+
5+
feat: allows specifying ingress path and pathType for different ingress controllers

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -359,6 +359,7 @@ hyperdx:
359359
- path: /v1/(traces|metrics|logs)
360360
pathType: Prefix
361361
port: 4318
362+
name: otel-collector
362363
tls:
363364
- hosts:
364365
- collector.yourdomain.com

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,8 @@ spec:
3333
- host: {{ .Values.hyperdx.ingress.host | default "localhost" }}
3434
http:
3535
paths:
36-
- path: /(.*)
37-
pathType: ImplementationSpecific
36+
- path: {{ .Values.hyperdx.ingress.path | default "/(.*)" }}
37+
pathType: {{ .Values.hyperdx.ingress.pathType | default "ImplementationSpecific" }}
3838
backend:
3939
service:
4040
name: {{ include "hdx-oss.fullname" . }}-app
@@ -87,7 +87,7 @@ spec:
8787
pathType: {{ .pathType }}
8888
backend:
8989
service:
90-
name: {{ include "hdx-oss.fullname" $ }}
90+
name: {{ if .name }}{{ printf "%s-%s" (include "hdx-oss.fullname" $) .name }}{{ else }}{{ include "hdx-oss.fullname" $ }}{{ end }}
9191
port:
9292
number: {{ .port }}
9393
{{- end }}

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

Lines changed: 128 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -481,3 +481,131 @@ tests:
481481
asserts:
482482
- failedTemplate:
483483
errorMessage: "Each path in additional ingress must contain path, pathType, and port properties"
484+
485+
- it: should use custom path and pathType when provided
486+
set:
487+
hyperdx:
488+
ingress:
489+
enabled: true
490+
host: hyperdx.example.com
491+
path: /api/(.*)
492+
pathType: Prefix
493+
tls:
494+
enabled: false
495+
asserts:
496+
- hasDocuments:
497+
count: 1
498+
- isKind:
499+
of: Ingress
500+
- equal:
501+
path: spec.rules[0].http.paths[0].path
502+
value: /api/(.*)
503+
- equal:
504+
path: spec.rules[0].http.paths[0].pathType
505+
value: Prefix
506+
507+
- it: should use default path and pathType when not provided
508+
set:
509+
hyperdx:
510+
ingress:
511+
enabled: true
512+
host: hyperdx.example.com
513+
tls:
514+
enabled: false
515+
asserts:
516+
- hasDocuments:
517+
count: 1
518+
- isKind:
519+
of: Ingress
520+
- equal:
521+
path: spec.rules[0].http.paths[0].path
522+
value: /(.*)
523+
- equal:
524+
path: spec.rules[0].http.paths[0].pathType
525+
value: ImplementationSpecific
526+
527+
- it: should allow Exact pathType
528+
set:
529+
hyperdx:
530+
ingress:
531+
enabled: true
532+
host: hyperdx.example.com
533+
path: /hyperdx
534+
pathType: Exact
535+
tls:
536+
enabled: false
537+
asserts:
538+
- hasDocuments:
539+
count: 1
540+
- isKind:
541+
of: Ingress
542+
- equal:
543+
path: spec.rules[0].http.paths[0].path
544+
value: /hyperdx
545+
- equal:
546+
path: spec.rules[0].http.paths[0].pathType
547+
value: Exact
548+
549+
- it: should use service name suffix when name is provided in additional ingress paths
550+
set:
551+
hyperdx:
552+
ingress:
553+
enabled: true
554+
host: hyperdx.example.com
555+
additionalIngresses:
556+
- name: custom-service
557+
ingressClassName: nginx
558+
hosts:
559+
- host: custom.example.com
560+
paths:
561+
- path: /api
562+
pathType: Prefix
563+
port: 8080
564+
name: api-service
565+
- path: /metrics
566+
pathType: Exact
567+
port: 9090
568+
name: metrics
569+
asserts:
570+
- hasDocuments:
571+
count: 2
572+
# Check the additional ingress (document 1)
573+
- isKind:
574+
of: Ingress
575+
documentIndex: 1
576+
- equal:
577+
path: spec.rules[0].http.paths[0].backend.service.name
578+
value: RELEASE-NAME-hdx-oss-v2-api-service
579+
documentIndex: 1
580+
- equal:
581+
path: spec.rules[0].http.paths[1].backend.service.name
582+
value: RELEASE-NAME-hdx-oss-v2-metrics
583+
documentIndex: 1
584+
585+
- it: should use default service name when name is not provided in additional ingress paths
586+
set:
587+
hyperdx:
588+
ingress:
589+
enabled: true
590+
host: hyperdx.example.com
591+
additionalIngresses:
592+
- name: default-service
593+
ingressClassName: nginx
594+
hosts:
595+
- host: default.example.com
596+
paths:
597+
- path: /
598+
pathType: Prefix
599+
port: 8080
600+
# name field is not provided
601+
asserts:
602+
- hasDocuments:
603+
count: 2
604+
# Check the additional ingress (document 1)
605+
- isKind:
606+
of: Ingress
607+
documentIndex: 1
608+
- equal:
609+
path: spec.rules[0].http.paths[0].backend.service.name
610+
value: RELEASE-NAME-hdx-oss-v2
611+
documentIndex: 1

charts/hdx-oss-v2/values.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,8 @@ hyperdx:
177177
ingressClassName: nginx
178178
annotations: {}
179179
host: "localhost" # Production domain
180+
path: "/(.*)"
181+
pathType: "ImplementationSpecific"
180182
proxyBodySize: "100m"
181183
proxyConnectTimeout: "60"
182184
proxySendTimeout: "60"

0 commit comments

Comments
 (0)