Skip to content

Commit 90ea33a

Browse files
feat: add otel tolerations using helpers.tpl
1 parent 05b8f2c commit 90ea33a

File tree

4 files changed

+25
-2
lines changed

4 files changed

+25
-2
lines changed

charts/sourcegraph/templates/_helpers.tpl

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,25 @@ tolerations:
145145
{{- end }}
146146
{{- end }}
147147

148+
{{/*
149+
OpenTelemetry tolerations - supports separate tolerations for agent and gateway
150+
*/}}
151+
{{- define "sourcegraph.openTelemetry.tolerations" -}}
152+
{{- $top := index . 0 }}
153+
{{- $component := index . 1 }}
154+
{{- $globalTolerations := (index $top.Values "sourcegraph" "tolerations") }}
155+
{{- $openTelemetryTolerations := (index $top.Values "openTelemetry" "tolerations") }}
156+
{{- $componentTolerations := (index $top.Values "openTelemetry" $component "tolerations") }}
157+
tolerations:
158+
{{- if $componentTolerations }}
159+
{{- $componentTolerations | toYaml | trim | nindent 2 }}
160+
{{- else if $openTelemetryTolerations }}
161+
{{- $openTelemetryTolerations | toYaml | trim | nindent 2 }}
162+
{{- else if $globalTolerations }}
163+
{{- $globalTolerations | toYaml | trim | nindent 2 }}
164+
{{- end }}
165+
{{- end }}
166+
148167
{{/*
149168
Jaeger common labels
150169
*/}}

charts/sourcegraph/templates/otel-collector/otel-agent.DaemonSet.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ spec:
8484
terminationGracePeriodSeconds: 120
8585
{{- include "sourcegraph.nodeSelector" (list . "openTelemetry" ) | trim | nindent 6 }}
8686
{{- include "sourcegraph.affinity" (list . "openTelemetry" ) | trim | nindent 6 }}
87-
{{- include "sourcegraph.tolerations" (list . "openTelemetry" ) | trim | nindent 6 }}
87+
{{- include "sourcegraph.openTelemetry.tolerations" (list . "agent" ) | trim | nindent 6 }}
8888
{{- with .Values.sourcegraph.imagePullSecrets }}
8989
imagePullSecrets:
9090
{{- toYaml . | nindent 8 }}

charts/sourcegraph/templates/otel-collector/otel-collector.Deployment.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ spec:
105105
terminationGracePeriodSeconds: 120
106106
{{- include "sourcegraph.nodeSelector" (list . "openTelemetry" ) | trim | nindent 6 }}
107107
{{- include "sourcegraph.affinity" (list . "openTelemetry" ) | trim | nindent 6 }}
108-
{{- include "sourcegraph.tolerations" (list . "openTelemetry" ) | trim | nindent 6 }}
108+
{{- include "sourcegraph.openTelemetry.tolerations" (list . "gateway" ) | trim | nindent 6 }}
109109
{{- with .Values.sourcegraph.imagePullSecrets }}
110110
imagePullSecrets:
111111
{{- toYaml . | nindent 8 }}

charts/sourcegraph/values.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -632,6 +632,8 @@ openTelemetry:
632632
allowPrivilegeEscalation: false
633633
runAsUser: 100
634634
runAsGroup: 101
635+
# -- Tolerations for the `otel-collector` pods
636+
tolerations: []
635637

636638
agent:
637639
# -- Name used by resources. Does not affect service names or PVCs.
@@ -658,6 +660,8 @@ openTelemetry:
658660
allowPrivilegeEscalation: false
659661
runAsUser: 100
660662
runAsGroup: 101
663+
# -- Tolerations for the `otel-agent` pods
664+
tolerations: []
661665

662666
nodeExporter:
663667
# -- Enable `node-exporter`

0 commit comments

Comments
 (0)