Skip to content

Commit be62ffe

Browse files
feat(otel): Adds envVars to otel pods and deployment option (#38)
1 parent a7933d2 commit be62ffe

8 files changed

Lines changed: 134 additions & 66 deletions

File tree

charts/ctrlplane/Chart.lock

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ dependencies:
44
version: 0.1.6
55
- name: otel
66
repository: file://charts/otel
7-
version: 0.1.0
7+
version: 0.2.0
88
- name: wandb-base
99
repository: https://charts.wandb.ai
1010
version: 0.11.11
@@ -14,5 +14,5 @@ dependencies:
1414
- name: wandb-base
1515
repository: https://charts.wandb.ai
1616
version: 0.11.11
17-
digest: sha256:a15f24e455ca221b9506bdf09b33917224777f4ea68bb4e89a8eb794fbcb89e0
18-
generated: "2026-03-11T18:06:48.680888-04:00"
17+
digest: sha256:11be9c366718847a7f76355f54f3816cd7223e2d9feb63a28d90e6397ad0cc50
18+
generated: "2026-04-13T16:19:18.331308-05:00"

charts/ctrlplane/Chart.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ apiVersion: v2
22
name: ctrlplane
33
description: Ctrlplane Helm chart for Kubernetes
44
type: application
5-
version: 1.0.2
5+
version: 1.1.0
66
appVersion: 1.0.0
77

88
maintainers:

charts/ctrlplane/charts/otel/Chart.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,5 @@ name: otel
33
type: application
44
description: A Helm chart for Kubernetes
55

6-
version: 0.1.0
6+
version: 0.2.0
77
appVersion: "0.109.0"

charts/ctrlplane/charts/otel/templates/_config.tpl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,10 @@ processors:
5151
limit_percentage: 80
5252
spike_limit_percentage: 25
5353
k8sattributes:
54+
{{- if ne (default "DaemonSet" .Values.workload.kind) "Deployment" }}
5455
filter:
5556
node_from_env_var: K8S_NODE_NAME
57+
{{- end }}
5658
passthrough: false
5759
pod_association:
5860
- sources:
Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
{{- define "otel.podTemplate" }}
2+
metadata:
3+
labels:
4+
{{- include "otel.commonLabels" . | nindent 8 }}
5+
{{- include "otel.podLabels" . | nindent 8 }}
6+
{{- include "otel.labels" . | nindent 8 }}
7+
annotations:
8+
checksum/configmap: {{ include (print .Template.BasePath "/configmap.yaml") . | sha256sum | trunc 63 }}
9+
{{- if .Values.pod.annotations }}
10+
{{- toYaml .Values.pod.annotations | nindent 8 }}
11+
{{- end }}
12+
spec:
13+
serviceAccountName: {{ include "otel.serviceAccountName" . }}
14+
{{- if .Values.tolerations }}
15+
tolerations:
16+
{{- toYaml .Values.tolerations | nindent 8 }}
17+
{{- end }}
18+
{{- include "ctrlplane.nodeSelector" . | nindent 6 }}
19+
{{- include "ctrlplane.priorityClassName" . | nindent 6 }}
20+
{{- include "ctrlplane.podSecurityContext" .Values.pod.securityContext | nindent 6 }}
21+
containers:
22+
- name: {{ .Chart.Name }}
23+
image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
24+
command:
25+
- /otelcol-contrib
26+
- --config=/conf/config.yaml
27+
ports:
28+
- name: otlp
29+
containerPort: 4317
30+
protocol: TCP
31+
- name: otlp-http
32+
containerPort: 4318
33+
protocol: TCP
34+
- name: prometheus
35+
containerPort: 9109
36+
protocol: TCP
37+
- name: statsd
38+
containerPort: 8125
39+
protocol: TCP
40+
env:
41+
- name: K8S_NODE_NAME
42+
valueFrom:
43+
fieldRef:
44+
fieldPath: spec.nodeName
45+
- name: POD_IP
46+
valueFrom:
47+
fieldRef:
48+
apiVersion: v1
49+
fieldPath: status.podIP
50+
{{- range $name, $ref := .Values.extraEnvFrom }}
51+
- name: {{ $name }}
52+
valueFrom:
53+
{{- toYaml $ref | nindent 16 }}
54+
{{- end }}
55+
resources:
56+
{{- toYaml .Values.resources | nindent 12 }}
57+
volumeMounts:
58+
- mountPath: /conf
59+
name: config
60+
volumes:
61+
- name: config
62+
configMap:
63+
name: {{ include "otel.fullname" . }}
64+
items:
65+
- key: config
66+
path: config.yaml
67+
hostNetwork: false
68+
{{- end }}
Lines changed: 3 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
{{- if ne (default "DaemonSet" .Values.workload.kind) "Deployment" }}
12
apiVersion: apps/v1
23
kind: DaemonSet
34
metadata:
@@ -17,64 +18,5 @@ spec:
1718
{{- include "ctrlplane.selectorLabels" $ | nindent 6 }}
1819
{{- include "otel.labels" . | nindent 6 }}
1920
template:
20-
metadata:
21-
labels:
22-
{{- include "otel.commonLabels" . | nindent 8 }}
23-
{{- include "otel.podLabels" . | nindent 8 }}
24-
{{- include "otel.labels" . | nindent 8 }}
25-
annotations:
26-
checksum/configmap: {{ include (print .Template.BasePath "/configmap.yaml") . | sha256sum | trunc 63 }}
27-
{{- if .Values.pod.annotations -}}
28-
{{- toYaml .Values.pod.annotations | nindent 4 }}
29-
{{- end }}
30-
spec:
31-
serviceAccountName: {{ include "otel.serviceAccountName" . }}
32-
{{- if .Values.tolerations }}
33-
tolerations:
34-
{{- toYaml .Values.tolerations | nindent 8 }}
35-
{{- end }}
36-
{{- include "ctrlplane.nodeSelector" . | nindent 6 }}
37-
{{- include "ctrlplane.priorityClassName" . | nindent 6 }}
38-
{{- include "ctrlplane.podSecurityContext" .Values.pod.securityContext | nindent 6 }}
39-
containers:
40-
- name: {{ .Chart.Name }}
41-
image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
42-
command:
43-
- /otelcol-contrib
44-
- --config=/conf/config.yaml
45-
ports:
46-
- name: otlp
47-
containerPort: 4317
48-
protocol: TCP
49-
- name: otlp-http
50-
containerPort: 4318
51-
protocol: TCP
52-
- name: prometheus
53-
containerPort: 9109
54-
protocol: TCP
55-
- name: statsd
56-
containerPort: 8125
57-
protocol: TCP
58-
env:
59-
- name: K8S_NODE_NAME
60-
valueFrom:
61-
fieldRef:
62-
fieldPath: spec.nodeName
63-
- name: POD_IP
64-
valueFrom:
65-
fieldRef:
66-
apiVersion: v1
67-
fieldPath: status.podIP
68-
resources:
69-
{{- toYaml .Values.resources | nindent 12 }}
70-
volumeMounts:
71-
- mountPath: /conf
72-
name: config
73-
volumes:
74-
- name: config
75-
configMap:
76-
name: {{ include "otel.fullname" . }}
77-
items:
78-
- key: config
79-
path: config.yaml
80-
hostNetwork: false
21+
{{ include "otel.podTemplate" . }}
22+
{{- end }}
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
{{- if eq (default "DaemonSet" .Values.workload.kind) "Deployment" }}
2+
{{- $deploy := default dict .Values.deployment }}
3+
apiVersion: apps/v1
4+
kind: Deployment
5+
metadata:
6+
name: {{ include "otel.fullname" . }}
7+
labels:
8+
{{- include "otel.labels" . | nindent 4 }}
9+
{{- if $deploy.labels -}}
10+
{{- toYaml $deploy.labels | nindent 4 }}
11+
{{- end }}
12+
annotations:
13+
{{- if $deploy.annotations -}}
14+
{{- toYaml $deploy.annotations | nindent 4 }}
15+
{{- end }}
16+
spec:
17+
replicas: {{ $deploy.replicas | default 2 }}
18+
revisionHistoryLimit: {{ $deploy.revisionHistoryLimit | default 10 }}
19+
{{- if $deploy.strategy }}
20+
strategy:
21+
{{- toYaml $deploy.strategy | nindent 4 }}
22+
{{- end }}
23+
selector:
24+
matchLabels:
25+
{{- include "ctrlplane.selectorLabels" $ | nindent 6 }}
26+
{{- include "otel.labels" . | nindent 6 }}
27+
template:
28+
{{ include "otel.podTemplate" . }}
29+
{{- end }}

charts/ctrlplane/charts/otel/values.yaml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,24 @@
11
nameOverride: ""
22
fullnameOverride: ""
33

4+
# "DaemonSet" (default): one collector per node, needed for host-level
5+
# receivers (hostMetrics, logsCollection, kubeletMetrics).
6+
# "Deployment": central collector behind the Service, suitable when only
7+
# network receivers (otlp, statsd) are used.
8+
workload:
9+
kind: DaemonSet
10+
11+
# deployment:
12+
# replicas: 2
13+
# revisionHistoryLimit: 10
14+
# strategy:
15+
# type: RollingUpdate
16+
# rollingUpdate:
17+
# maxSurge: 1
18+
# maxUnavailable: 0
19+
# labels: {}
20+
# annotations: {}
21+
422
config:
523
service:
624
pipelines:
@@ -28,6 +46,15 @@ image:
2846
# Tolerations for pod scheduling
2947
tolerations: []
3048

49+
# Extra environment variables sourced from Secrets/ConfigMaps.
50+
# Example:
51+
# extraEnvFrom:
52+
# DD_API_KEY:
53+
# secretKeyRef:
54+
# name: my-secret
55+
# key: api-key
56+
extraEnvFrom: {}
57+
3158
extraCors: []
3259

3360
service: {}

0 commit comments

Comments
 (0)