Skip to content

Commit b82c57d

Browse files
authored
fix: Allow for configurable service type + annotations (#57)
* Changes default service deployment to ClusterIP * Allows for configurable service type * Allow for annotations in the service chart * Updates NOTES.txt after chart is deployed Fixes: HDX-1900
1 parent b5881bd commit b82c57d

File tree

5 files changed

+124
-7
lines changed

5 files changed

+124
-7
lines changed

.changeset/plenty-pears-yawn.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+
fix: Allow for configurable service type + annotations

charts/hdx-oss-v2/templates/NOTES.txt

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,28 @@ Note: By default, this chart also installs clickhouse and the otel-collector. Ho
44
it is recommended that you use the clickhouse and otel-collector operators instead.
55

66
To disable clickhouse and otel-collector, set the following values:
7-
helm install myrelease hyperdx-helm --set clickhouse.enabled=false --set clickhouse.persistence.enabled=false --set otel.enabled=false
7+
helm install myrelease <chart-name-or-path> --set clickhouse.enabled=false --set clickhouse.persistence.enabled=false --set otel.enabled=false
88

9-
Application URL: {{ include "hdx-oss.fullname" . }}-app:{{ .Values.hyperdx.appPort }}
9+
{{- if .Values.hyperdx.ingress.enabled }}
10+
Application URL: {{ if .Values.hyperdx.ingress.tls.enabled }}https{{ else }}http{{ end }}://{{ .Values.hyperdx.ingress.host }}
11+
{{- else }}
12+
Application Access:
13+
For security, the service uses ClusterIP and is not exposed externally by default.
14+
Choose one of the following secure access methods:
15+
16+
1. Enable Ingress with TLS (Recommended for Production):
17+
helm upgrade {{ .Release.Name }} <chart-name-or-path> \
18+
--set hyperdx.ingress.enabled=true \
19+
--set hyperdx.ingress.host=your-domain.com \
20+
--set hyperdx.ingress.tls.enabled=true
21+
22+
2. Port Forward (Development/Testing):
23+
kubectl port-forward svc/{{ include "hdx-oss.fullname" . }}-app {{ .Values.hyperdx.appPort }}:{{ .Values.hyperdx.appPort }}
24+
Then access: http://localhost:{{ .Values.hyperdx.appPort }}
25+
26+
Note: This application handles sensitive telemetry data and should not be exposed
27+
directly to the internet without proper authentication and encryption.
28+
{{- end }}
1029

1130
To verify the deployment status, run:
1231
kubectl get pods -l "app.kubernetes.io/name={{ include "hdx-oss.name" . }}"

charts/hdx-oss-v2/templates/hyperdx-service.yaml

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,14 @@ metadata:
44
name: {{ include "hdx-oss.fullname" . }}-app
55
labels:
66
{{- include "hdx-oss.labels" . | nindent 4 }}
7+
{{- if .Values.hyperdx.service.annotations }}
8+
annotations:
9+
{{- with .Values.hyperdx.service.annotations }}
10+
{{- toYaml . | nindent 4 }}
11+
{{- end }}
12+
{{- end }}
713
spec:
8-
type: LoadBalancer
14+
type: {{ .Values.hyperdx.service.type | default "ClusterIP" }}
915
ports:
1016
- port: {{ .Values.hyperdx.appPort }}
1117
targetPort: {{ .Values.hyperdx.appPort }}
@@ -15,4 +21,4 @@ spec:
1521
name: opamp
1622
selector:
1723
{{- include "hdx-oss.selectorLabels" . | nindent 4 }}
18-
app: {{ include "hdx-oss.fullname" . }}
24+
app: {{ include "hdx-oss.fullname" . }}

charts/hdx-oss-v2/tests/hyperdx-service_test.yaml

Lines changed: 77 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ tests:
88
of: Service
99
- equal:
1010
path: spec.type
11-
value: LoadBalancer
11+
value: ClusterIP
1212
- equal:
1313
path: spec.ports[0].port
1414
value: 3000
@@ -18,7 +18,53 @@ tests:
1818
- equal:
1919
path: spec.ports[0].name
2020
value: app
21-
21+
- isNull:
22+
path: metadata.annotations
23+
24+
- it: should use LoadBalancer type when configured
25+
set:
26+
hyperdx:
27+
service:
28+
type: LoadBalancer
29+
asserts:
30+
- equal:
31+
path: spec.type
32+
value: LoadBalancer
33+
34+
- it: should use NodePort type when configured
35+
set:
36+
hyperdx:
37+
service:
38+
type: NodePort
39+
asserts:
40+
- equal:
41+
path: spec.type
42+
value: NodePort
43+
44+
- it: should render service annotations when provided
45+
set:
46+
hyperdx:
47+
service:
48+
annotations:
49+
service.beta.kubernetes.io/aws-load-balancer-internal: "true"
50+
service.beta.kubernetes.io/aws-load-balancer-type: "nlb"
51+
asserts:
52+
- equal:
53+
path: metadata.annotations["service.beta.kubernetes.io/aws-load-balancer-internal"]
54+
value: "true"
55+
- equal:
56+
path: metadata.annotations["service.beta.kubernetes.io/aws-load-balancer-type"]
57+
value: "nlb"
58+
59+
- it: should not render annotations section when annotations are empty
60+
set:
61+
hyperdx:
62+
service:
63+
annotations: {}
64+
asserts:
65+
- isNull:
66+
path: metadata.annotations
67+
2268
- it: should use custom port when provided
2369
set:
2470
hyperdx:
@@ -59,4 +105,32 @@ tests:
59105
value: 5320
60106
- equal:
61107
path: spec.ports[1].targetPort
62-
value: 5320
108+
value: 5320
109+
110+
- it: should combine LoadBalancer type with annotations
111+
set:
112+
hyperdx:
113+
service:
114+
type: LoadBalancer
115+
annotations:
116+
cloud.google.com/load-balancer-type: "Internal"
117+
service.beta.kubernetes.io/azure-load-balancer-internal: "true"
118+
asserts:
119+
- equal:
120+
path: spec.type
121+
value: LoadBalancer
122+
- equal:
123+
path: metadata.annotations["cloud.google.com/load-balancer-type"]
124+
value: "Internal"
125+
- equal:
126+
path: metadata.annotations["service.beta.kubernetes.io/azure-load-balancer-internal"]
127+
value: "true"
128+
129+
- it: should fallback to ClusterIP when service type is not specified
130+
set:
131+
hyperdx:
132+
service: {}
133+
asserts:
134+
- equal:
135+
path: spec.type
136+
value: ClusterIP

charts/hdx-oss-v2/values.yaml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,12 @@ hyperdx:
1818
# Endpoint to send hyperdx logs/traces/metrics to.Defaults to the chart's otel collector endpoint.
1919
otelExporterEndpoint: http://{{ include "hdx-oss.fullname" . }}-otel-collector:{{ .Values.otel.httpPort }}
2020
mongoUri: mongodb://{{ include "hdx-oss.fullname" . }}-mongodb:{{ .Values.mongodb.port }}/hyperdx
21+
22+
# Pod-level annotations (applied to the deployment pods)
2123
annotations: {}
2224
# myAnnotation: "myValue"
25+
26+
# Pod-level labels (applied to the deployment pods)
2327
labels: {}
2428
# myLabel: "myValue"
2529
env: []
@@ -176,6 +180,15 @@ hyperdx:
176180

177181
replicas: 1
178182

183+
# Service configuration
184+
service:
185+
type: ClusterIP # Use ClusterIP for security. For external access, use ingress with proper TLS and authentication
186+
# Service-level annotations (applied to the Kubernetes service resource)
187+
annotations: {}
188+
# Example service annotations:
189+
# service.beta.kubernetes.io/aws-load-balancer-internal: "true"
190+
# cloud.google.com/load-balancer-type: "Internal"
191+
179192
mongodb:
180193
image: "mongo:5.0.14-focal"
181194
port: 27017

0 commit comments

Comments
 (0)