Skip to content

Commit c117d72

Browse files
authored
fix: Allow for custom otel collector environment variables (#46)
1 parent 6226226 commit c117d72

File tree

4 files changed

+100
-0
lines changed

4 files changed

+100
-0
lines changed

.changeset/lucky-paws-occur.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 custom otel collector environment variables

charts/hdx-oss-v2/templates/otel-collector-deployment.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,9 @@ spec:
5252
value: {{ .Values.otel.clickhouseUser | default .Values.clickhouse.config.users.otelUserName }}
5353
- name: CLICKHOUSE_PASSWORD
5454
value: {{ .Values.otel.clickhousePassword | default .Values.clickhouse.config.users.otelUserPassword }}
55+
{{- with .Values.otel.env }}
56+
{{- toYaml . | nindent 12 }}
57+
{{- end }}
5558
---
5659
apiVersion: v1
5760
kind: Service

charts/hdx-oss-v2/tests/otel-collector_test.yaml

Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -431,3 +431,85 @@ tests:
431431
content:
432432
name: CLICKHOUSE_PASSWORD
433433
value: "custom-password"
434+
435+
- it: should render custom environment variables when specified
436+
set:
437+
otel:
438+
enabled: true
439+
image:
440+
repository: hyperdx/hyperdx-otel-collector
441+
tag: 2-beta
442+
env:
443+
- name: CUSTOM_VAR
444+
value: "custom-value"
445+
- name: DEBUG_MODE
446+
value: "true"
447+
- name: SECRET_TOKEN
448+
valueFrom:
449+
secretKeyRef:
450+
name: my-secret
451+
key: token
452+
hyperdx:
453+
image:
454+
repository: hyperdx/hyperdx
455+
tag: 2-beta
456+
logLevel: info
457+
clickhouse:
458+
config:
459+
users:
460+
otelUserPassword: test-password
461+
release:
462+
name: test-release
463+
asserts:
464+
- documentIndex: 0
465+
isKind:
466+
of: Deployment
467+
- documentIndex: 0
468+
contains:
469+
path: spec.template.spec.containers[0].env
470+
content:
471+
name: CUSTOM_VAR
472+
value: "custom-value"
473+
- documentIndex: 0
474+
contains:
475+
path: spec.template.spec.containers[0].env
476+
content:
477+
name: DEBUG_MODE
478+
value: "true"
479+
- documentIndex: 0
480+
contains:
481+
path: spec.template.spec.containers[0].env
482+
content:
483+
name: SECRET_TOKEN
484+
valueFrom:
485+
secretKeyRef:
486+
name: my-secret
487+
key: token
488+
489+
- it: should not render custom environment variables when not specified
490+
set:
491+
otel:
492+
enabled: true
493+
image:
494+
repository: hyperdx/hyperdx-otel-collector
495+
tag: 2-beta
496+
hyperdx:
497+
image:
498+
repository: hyperdx/hyperdx
499+
tag: 2-beta
500+
logLevel: info
501+
clickhouse:
502+
config:
503+
users:
504+
otelUserPassword: test-password
505+
release:
506+
name: test-release
507+
asserts:
508+
- documentIndex: 0
509+
isKind:
510+
of: Deployment
511+
- documentIndex: 0
512+
notContains:
513+
path: spec.template.spec.containers[0].env
514+
content:
515+
name: CUSTOM_VAR

charts/hdx-oss-v2/values.yaml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -220,6 +220,16 @@ otel:
220220
httpPort: 4318
221221
healthPort: 8888
222222
enabled: true
223+
env: []
224+
# Additional environment variables can be configured here
225+
# Example:
226+
# - name: CUSTOM_VAR
227+
# value: "my-value"
228+
# - name: SECRET_VAR
229+
# valueFrom:
230+
# secretKeyRef:
231+
# name: my-secret
232+
# key: secret-key
223233
# Opamp server URL - defaults to the app service. Customize if you want to use a different Opamp server.
224234
# Leave empty if you want to use the app service.
225235
# Example: opampServerUrl: "http://custom-opamp-server:4320"

0 commit comments

Comments
 (0)