Skip to content

feat: otel tolerations for helm chart #686

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions charts/sourcegraph/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,7 @@ In addition to the documented values, all services also support the following va
| openTelemetry.agent.resources.requests.memory | string | `"100Mi"` | |
| openTelemetry.agent.serviceAccount.create | bool | `false` | Enable creation of ServiceAccount for `otel-agent` |
| openTelemetry.agent.serviceAccount.name | string | `""` | Name of the ServiceAccount to be created or an existing ServiceAccount |
| openTelemetry.agent.tolerations | list | `[]` | Tolerations for the `otel-agent` pods |
| openTelemetry.enabled | bool | `true` | |
| openTelemetry.gateway.config.traces.exporters | object | `{}` | Define where traces should be exported to. Read how to configure different backends in the [OpenTelemetry documentation](https://opentelemetry.io/docs/collector/configuration/#exporters) |
| openTelemetry.gateway.config.traces.exportersTlsSecretName | string | `""` | Define the name of a preexisting secret containing TLS certificates for exporters, which will be mounted under "/tls". Read more about TLS configuration of exporters in the [OpenTelemetry Collector documentation](https://github.com/open-telemetry/opentelemetry-collector/blob/main/config/configtls/README.md) |
Expand All @@ -213,6 +214,7 @@ In addition to the documented values, all services also support the following va
| openTelemetry.gateway.resources | object | `{"limits":{"cpu":"3","memory":"3Gi"},"requests":{"cpu":"1","memory":"1Gi"}}` | Resource requests & limits for the `otel-collector` container, learn more from the [Kubernetes documentation](https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/) |
| openTelemetry.gateway.serviceAccount.create | bool | `false` | Enable creation of ServiceAccount for `otel-collector` |
| openTelemetry.gateway.serviceAccount.name | string | `""` | Name of the ServiceAccount to be created or an existing ServiceAccount |
| openTelemetry.gateway.tolerations | list | `[]` | Tolerations for the `otel-collector` pods |
| openTelemetry.image.defaultTag | string | `"6.0.0@sha256:ef3e61a4f0a624523ecdee57d8b7757436c2389e0cf12401b4764d19c826ff8a"` | Docker image tag for the `otel-collector` image |
| openTelemetry.image.name | string | `"opentelemetry-collector"` | Docker image name for the `otel-collector` image |
| pgsql.additionalConfig | string | `""` | Additional PostgreSQL configuration. This will override or extend our default configuration. Notes: This is expecting a multiline string. Learn more from our [recommended PostgreSQL configuration](https://docs.sourcegraph.com/admin/config/postgres-conf) and [PostgreSQL documentation](https://www.postgresql.org/docs/12/config-setting.html) |
Expand Down
19 changes: 19 additions & 0 deletions charts/sourcegraph/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,25 @@ tolerations:
{{- end }}
{{- end }}

{{/*
OpenTelemetry tolerations - supports separate tolerations for agent and gateway
*/}}
{{- define "sourcegraph.openTelemetry.tolerations" -}}
{{- $top := index . 0 }}
{{- $component := index . 1 }}
{{- $globalTolerations := (index $top.Values "sourcegraph" "tolerations") }}
{{- $openTelemetryTolerations := (index $top.Values "openTelemetry" "tolerations") }}
{{- $componentTolerations := (index $top.Values "openTelemetry" $component "tolerations") }}
tolerations:
{{- if $componentTolerations }}
{{- $componentTolerations | toYaml | trim | nindent 2 }}
{{- else if $openTelemetryTolerations }}
{{- $openTelemetryTolerations | toYaml | trim | nindent 2 }}
{{- else if $globalTolerations }}
{{- $globalTolerations | toYaml | trim | nindent 2 }}
{{- end }}
{{- end }}

{{/*
Jaeger common labels
*/}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ spec:
terminationGracePeriodSeconds: 120
{{- include "sourcegraph.nodeSelector" (list . "openTelemetry" ) | trim | nindent 6 }}
{{- include "sourcegraph.affinity" (list . "openTelemetry" ) | trim | nindent 6 }}
{{- include "sourcegraph.tolerations" (list . "openTelemetry" ) | trim | nindent 6 }}
{{- include "sourcegraph.openTelemetry.tolerations" (list . "agent" ) | trim | nindent 6 }}
{{- with .Values.sourcegraph.imagePullSecrets }}
imagePullSecrets:
{{- toYaml . | nindent 8 }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ spec:
terminationGracePeriodSeconds: 120
{{- include "sourcegraph.nodeSelector" (list . "openTelemetry" ) | trim | nindent 6 }}
{{- include "sourcegraph.affinity" (list . "openTelemetry" ) | trim | nindent 6 }}
{{- include "sourcegraph.tolerations" (list . "openTelemetry" ) | trim | nindent 6 }}
{{- include "sourcegraph.openTelemetry.tolerations" (list . "gateway" ) | trim | nindent 6 }}
{{- with .Values.sourcegraph.imagePullSecrets }}
imagePullSecrets:
{{- toYaml . | nindent 8 }}
Expand Down
4 changes: 4 additions & 0 deletions charts/sourcegraph/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -632,6 +632,8 @@ openTelemetry:
allowPrivilegeEscalation: false
runAsUser: 100
runAsGroup: 101
# -- Tolerations for the `otel-collector` pods
tolerations: []

agent:
# -- Name used by resources. Does not affect service names or PVCs.
Expand All @@ -658,6 +660,8 @@ openTelemetry:
allowPrivilegeEscalation: false
runAsUser: 100
runAsGroup: 101
# -- Tolerations for the `otel-agent` pods
tolerations: []

nodeExporter:
# -- Enable `node-exporter`
Expand Down
Loading