Skip to content

Commit a75f283

Browse files
authored
T-10638 Fix envFrom yaml structure (#23)
1 parent fb9b255 commit a75f283

File tree

3 files changed

+213
-211
lines changed

3 files changed

+213
-211
lines changed

Chart.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ apiVersion: v2
22
name: collector
33
description: A Helm chart for Better Stack Collector - monitoring solution that collects metrics, logs, and traces
44
type: application
5-
version: 0.1.23
5+
version: 0.1.24
66
appVersion: "latest"
77
keywords:
88
- monitoring

templates/daemonset.yaml

Lines changed: 165 additions & 163 deletions
Original file line numberDiff line numberDiff line change
@@ -38,83 +38,84 @@ spec:
3838
runAsUser: 0
3939
privileged: false
4040
env:
41-
{{- range $key, $value := .Values.collector.env }}
42-
{{- if $value }}
43-
- name: {{ $key }}
44-
value: {{ $value | quote }}
45-
{{- end }}
46-
{{- end }}
41+
# Custom environment variables from values.yaml
42+
{{- range $key, $value := .Values.collector.env }}
43+
{{- if $value }}
44+
- name: {{ $key }}
45+
value: {{ $value | quote }}
46+
{{- end }}
47+
{{- end }}
48+
# System environment variables from Kubernetes downward API
49+
- name: HOSTNAME
50+
valueFrom:
51+
fieldRef:
52+
fieldPath: spec.nodeName
53+
- name: COLLECTOR_NAME
54+
value: {{ include "better-stack-collector.fullname" . }}
55+
- name: CONTAINER_NAME
56+
value: "collector"
57+
- name: POD_NAME
58+
valueFrom:
59+
fieldRef:
60+
fieldPath: metadata.name
61+
- name: NAMESPACE
62+
valueFrom:
63+
fieldRef:
64+
fieldPath: metadata.namespace
65+
- name: PROCFS_ROOT
66+
value: "/host/proc"
67+
- name: SYSFS_ROOT
68+
value: "/host/sys"
69+
- name: HELM_CHART_VERSION
70+
value: {{ .Chart.Version | quote }}
4771
{{- if or (gt (len .Values.collector.envFrom.configMapRefs) 0) (gt (len .Values.collector.envFrom.secretRefs) 0) }}
4872
envFrom:
49-
{{- range .Values.collector.envFrom.configMapRefs }}
50-
- configMapRef:
51-
name: {{ . | quote }}
52-
{{- end }}
53-
{{- range .Values.collector.envFrom.secretRefs }}
54-
- secretRef:
55-
name: {{ . | quote }}
73+
{{- range .Values.collector.envFrom.configMapRefs }}
74+
- configMapRef:
75+
name: {{ . | quote }}
76+
{{- end }}
77+
{{- range .Values.collector.envFrom.secretRefs }}
78+
- secretRef:
79+
name: {{ . | quote }}
80+
{{- end }}
5681
{{- end }}
57-
{{- end }}
58-
# System environment variables from Kubernetes downward API
59-
- name: HOSTNAME
60-
valueFrom:
61-
fieldRef:
62-
fieldPath: spec.nodeName
63-
- name: COLLECTOR_NAME
64-
value: {{ include "better-stack-collector.fullname" . }}
65-
- name: CONTAINER_NAME
66-
value: "collector"
67-
- name: POD_NAME
68-
valueFrom:
69-
fieldRef:
70-
fieldPath: metadata.name
71-
- name: NAMESPACE
72-
valueFrom:
73-
fieldRef:
74-
fieldPath: metadata.namespace
75-
- name: PROCFS_ROOT
76-
value: "/host/proc"
77-
- name: SYSFS_ROOT
78-
value: "/host/sys"
79-
- name: HELM_CHART_VERSION
80-
value: {{ .Chart.Version | quote }}
8182
ports:
82-
- name: otlp
83-
containerPort: 34320
84-
hostPort: 34320
85-
protocol: TCP
83+
- name: otlp
84+
containerPort: 34320
85+
hostPort: 34320
86+
protocol: TCP
8687
livenessProbe:
8788
exec:
8889
command:
89-
- /bin/sh
90-
- -c
91-
- if [ -x /var/lib/better-stack/collector/healthcheck.sh ]; then /var/lib/better-stack/collector/healthcheck.sh; else exit 0; fi
90+
- /bin/sh
91+
- -c
92+
- if [ -x /var/lib/better-stack/collector/healthcheck.sh ]; then /var/lib/better-stack/collector/healthcheck.sh; else exit 0; fi
9293
initialDelaySeconds: 60
9394
periodSeconds: 30
9495
timeoutSeconds: 10
9596
failureThreshold: 3
9697
volumeMounts:
97-
- name: betterstack-data
98-
mountPath: /var/lib/better-stack
99-
- name: cgroup
100-
mountPath: /sys/fs/cgroup
101-
readOnly: true
102-
- name: varlog-pods
103-
mountPath: /var/log/pods
104-
readOnly: true
105-
- name: docker-containers
106-
mountPath: /var/lib/docker/containers
107-
readOnly: true
108-
{{- if .Values.collector.hostMounts.paths }}
109-
{{- range $index, $path := .Values.collector.hostMounts.paths }}
110-
- name: hostfs-{{ $index }}
111-
mountPath: /host{{ $path }}
112-
readOnly: true
113-
{{- end }}
114-
{{- else }}
115-
- name: hostfs
116-
mountPath: /host
117-
readOnly: true
98+
- name: betterstack-data
99+
mountPath: /var/lib/better-stack
100+
- name: cgroup
101+
mountPath: /sys/fs/cgroup
102+
readOnly: true
103+
- name: varlog-pods
104+
mountPath: /var/log/pods
105+
readOnly: true
106+
- name: docker-containers
107+
mountPath: /var/lib/docker/containers
108+
readOnly: true
109+
{{- if .Values.collector.hostMounts.paths }}
110+
{{- range $index, $path := .Values.collector.hostMounts.paths }}
111+
- name: hostfs-{{ $index }}
112+
mountPath: /host{{ $path }}
113+
readOnly: true
114+
{{- end }}
115+
{{- else }}
116+
- name: hostfs
117+
mountPath: /host
118+
readOnly: true
118119
{{- end }}
119120
resources:
120121
{{- toYaml .Values.collector.resources | nindent 10 }}
@@ -126,121 +127,122 @@ spec:
126127
securityContext:
127128
{{- toYaml .Values.securityContext.beyla | nindent 10 }}
128129
env:
129-
{{- range $key, $value := .Values.beyla.env }}
130-
{{- if $value }}
131-
- name: {{ $key }}
132-
value: {{ $value | quote }}
133-
{{- end }}
134-
{{- end }}
130+
# Custom environment variables from values.yaml
131+
{{- range $key, $value := .Values.beyla.env }}
132+
{{- if $value }}
133+
- name: {{ $key }}
134+
value: {{ $value | quote }}
135+
{{- end }}
136+
{{- end }}
137+
# System environment variables from Kubernetes downward API
138+
- name: HOSTNAME
139+
valueFrom:
140+
fieldRef:
141+
fieldPath: spec.nodeName
142+
- name: COLLECTOR_NAME
143+
value: {{ include "better-stack-collector.fullname" . }}
144+
- name: CONTAINER_NAME
145+
value: "beyla"
146+
- name: POD_NAME
147+
valueFrom:
148+
fieldRef:
149+
fieldPath: metadata.name
150+
- name: NAMESPACE
151+
valueFrom:
152+
fieldRef:
153+
fieldPath: metadata.namespace
154+
- name: HELM_CHART_VERSION
155+
value: {{ .Chart.Version | quote }}
156+
# Special configuration (these need dynamic template values)
157+
- name: ENABLE_DOCKERPROBE
158+
value: {{ .Values.beyla.dockerprobe.enabled | quote }}
135159
{{- if or (gt (len .Values.beyla.envFrom.configMapRefs) 0) (gt (len .Values.beyla.envFrom.secretRefs) 0) }}
136160
envFrom:
137-
{{- range .Values.beyla.envFrom.configMapRefs }}
138-
- configMapRef:
139-
name: {{ . | quote }}
161+
{{- range .Values.beyla.envFrom.configMapRefs }}
162+
- configMapRef:
163+
name: {{ . | quote }}
164+
{{- end }}
165+
{{- range .Values.beyla.envFrom.secretRefs }}
166+
- secretRef:
167+
name: {{ . | quote }}
168+
{{- end }}
140169
{{- end }}
141-
{{- range .Values.beyla.envFrom.secretRefs }}
142-
- secretRef:
143-
name: {{ . | quote }}
144-
{{- end }}
145-
{{- end }}
146-
# System environment variables from Kubernetes downward API
147-
- name: HOSTNAME
148-
valueFrom:
149-
fieldRef:
150-
fieldPath: spec.nodeName
151-
- name: COLLECTOR_NAME
152-
value: {{ include "better-stack-collector.fullname" . }}
153-
- name: CONTAINER_NAME
154-
value: "beyla"
155-
- name: POD_NAME
156-
valueFrom:
157-
fieldRef:
158-
fieldPath: metadata.name
159-
- name: NAMESPACE
160-
valueFrom:
161-
fieldRef:
162-
fieldPath: metadata.namespace
163-
- name: HELM_CHART_VERSION
164-
value: {{ .Chart.Version | quote }}
165-
# Special configuration (these need dynamic template values)
166-
- name: ENABLE_DOCKERPROBE
167-
value: {{ .Values.beyla.dockerprobe.enabled | quote }}
168170
{{- if .Values.beyla.memoryRestartThreshold }}
169171
livenessProbe:
170172
exec:
171173
command:
172-
- /bin/sh
173-
- -c
174-
- |
175-
BEYLA_PID=$(pgrep -f '^/usr/local/bin/beyla' | head -1)
176-
if [ -z "$BEYLA_PID" ]; then
177-
echo "Beyla process not found"
178-
exit 1
179-
fi
180-
MEM_USAGE=$(cat /proc/$BEYLA_PID/status | grep VmRSS | awk '{print int($2/1024)}')
181-
THRESHOLD={{ .Values.beyla.memoryRestartThreshold }}
182-
if [ "$MEM_USAGE" -gt "$THRESHOLD" ]; then
183-
echo "Beyla memory usage ${MEM_USAGE}MiB exceeds threshold ${THRESHOLD}MiB"
184-
exit 1
185-
fi
186-
exit 0
174+
- /bin/sh
175+
- -c
176+
- |
177+
BEYLA_PID=$(pgrep -f '^/usr/local/bin/beyla' | head -1)
178+
if [ -z "$BEYLA_PID" ]; then
179+
echo "Beyla process not found"
180+
exit 1
181+
fi
182+
MEM_USAGE=$(cat /proc/$BEYLA_PID/status | grep VmRSS | awk '{print int($2/1024)}')
183+
THRESHOLD={{ .Values.beyla.memoryRestartThreshold }}
184+
if [ "$MEM_USAGE" -gt "$THRESHOLD" ]; then
185+
echo "Beyla memory usage ${MEM_USAGE}MiB exceeds threshold ${THRESHOLD}MiB"
186+
exit 1
187+
fi
188+
exit 0
187189
initialDelaySeconds: 60
188190
periodSeconds: 30
189191
timeoutSeconds: 5
190192
failureThreshold: 3
191193
{{- end }}
192194
volumeMounts:
193-
- name: betterstack-data
194-
mountPath: /var/lib/better-stack
195-
- name: sys-kernel-tracing
196-
mountPath: /sys/kernel/tracing
197-
- name: sys-kernel-debug
198-
mountPath: /sys/kernel/debug
199-
- name: sys-kernel-security
200-
mountPath: /sys/kernel/security
201-
readOnly: true
195+
- name: betterstack-data
196+
mountPath: /var/lib/better-stack
197+
- name: sys-kernel-tracing
198+
mountPath: /sys/kernel/tracing
199+
- name: sys-kernel-debug
200+
mountPath: /sys/kernel/debug
201+
- name: sys-kernel-security
202+
mountPath: /sys/kernel/security
203+
readOnly: true
202204
resources:
203205
{{- toYaml .Values.beyla.resources | nindent 10 }}
204206
{{- end }}
205207
volumes:
206-
# Shared Better Stack data volume
207-
- name: betterstack-data
208-
emptyDir: {}
209-
# Collector volumes
210-
- name: cgroup
211-
hostPath:
212-
path: /sys/fs/cgroup
213-
- name: varlog-pods
214-
hostPath:
215-
path: /var/log/pods
216-
- name: docker-containers
217-
hostPath:
218-
path: /var/lib/docker/containers
219-
{{- if .Values.collector.hostMounts.paths }}
220-
{{- range $index, $path := .Values.collector.hostMounts.paths }}
221-
- name: hostfs-{{ $index }}
222-
hostPath:
223-
path: {{ $path }}
224-
type: ""
225-
{{- end }}
226-
{{- else }}
227-
- name: hostfs
228-
hostPath:
229-
path: /
230-
type: ""
231-
{{- end }}
232-
{{- if .Values.beyla.enabled }}
233-
# Beyla volumes
234-
- name: sys-kernel-tracing
235-
hostPath:
236-
path: /sys/kernel/tracing
237-
- name: sys-kernel-debug
238-
hostPath:
239-
path: /sys/kernel/debug
240-
- name: sys-kernel-security
241-
hostPath:
242-
path: /sys/kernel/security
243-
{{- end }}
208+
# Shared Better Stack data volume
209+
- name: betterstack-data
210+
emptyDir: {}
211+
# Collector volumes
212+
- name: cgroup
213+
hostPath:
214+
path: /sys/fs/cgroup
215+
- name: varlog-pods
216+
hostPath:
217+
path: /var/log/pods
218+
- name: docker-containers
219+
hostPath:
220+
path: /var/lib/docker/containers
221+
{{- if .Values.collector.hostMounts.paths }}
222+
{{- range $index, $path := .Values.collector.hostMounts.paths }}
223+
- name: hostfs-{{ $index }}
224+
hostPath:
225+
path: {{ $path }}
226+
type: ""
227+
{{- end }}
228+
{{- else }}
229+
- name: hostfs
230+
hostPath:
231+
path: /
232+
type: ""
233+
{{- end }}
234+
{{- if .Values.beyla.enabled }}
235+
# Beyla volumes
236+
- name: sys-kernel-tracing
237+
hostPath:
238+
path: /sys/kernel/tracing
239+
- name: sys-kernel-debug
240+
hostPath:
241+
path: /sys/kernel/debug
242+
- name: sys-kernel-security
243+
hostPath:
244+
path: /sys/kernel/security
245+
{{- end }}
244246
{{- with .Values.collector.nodeSelector }}
245247
nodeSelector:
246248
{{- toYaml . | nindent 8 }}

0 commit comments

Comments
 (0)