From 41c44af07668925d088940b8e4da6cd96808b834 Mon Sep 17 00:00:00 2001 From: Claude Date: Thu, 7 May 2026 19:31:42 +0000 Subject: [PATCH 1/2] otel-agent: support Deployment kind in addition to DaemonSet Adds `openTelemetry.agent.kind` value (default: `DaemonSet`) to allow customers who cannot run DaemonSets in their clusters to deploy the otel-agent as a Deployment instead. When `kind: Deployment`: - A Deployment is created instead of the DaemonSet - A ClusterIP Service (`otel-agent`) is created to front the agent pods - Application pods send traces to `http://otel-agent:4317` (the Service) rather than to the node's host IP via hostPort `openTelemetry.agent.replicas` can be set to control the replica count when running as a Deployment (defaults to 1). https://claude.ai/code/session_01K2AnXLduzruntPtUsC7xiA --- charts/sourcegraph/README.md | 1 + charts/sourcegraph/templates/_helpers.tpl | 5 + .../otel-collector/otel-agent.DaemonSet.yaml | 2 +- .../otel-collector/otel-agent.Deployment.yaml | 99 ++++++++++++++++ .../otel-collector/otel-agent.Service.yaml | 24 ++++ .../sourcegraph/tests/otelAgentKind_test.yaml | 112 ++++++++++++++++++ charts/sourcegraph/values.yaml | 5 + 7 files changed, 247 insertions(+), 1 deletion(-) create mode 100644 charts/sourcegraph/templates/otel-collector/otel-agent.Deployment.yaml create mode 100644 charts/sourcegraph/templates/otel-collector/otel-agent.Service.yaml create mode 100644 charts/sourcegraph/tests/otelAgentKind_test.yaml diff --git a/charts/sourcegraph/README.md b/charts/sourcegraph/README.md index c5a643c44..60029ae5d 100644 --- a/charts/sourcegraph/README.md +++ b/charts/sourcegraph/README.md @@ -203,6 +203,7 @@ In addition to the documented values, all services also support the following va | openTelemetry.agent.containerSecurityContext.runAsGroup | int | `101` | | | openTelemetry.agent.containerSecurityContext.runAsUser | int | `100` | | | openTelemetry.agent.hostPorts | object | `{"grpcOtlp":4317,"httpOtlp":4318,"httpZpages":55679}` | Resource requests & limits for the `otel-agent` container, learn more from the [Kubernetes documentation](https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/) | +| openTelemetry.agent.kind | string | `"DaemonSet"` | The workload kind for the otel-agent. Valid values are `DaemonSet` and `Deployment`. Use `Deployment` in environments where DaemonSets are restricted (e.g. some managed Kubernetes offerings). When set to `Deployment`, a ClusterIP Service is created for the agent and application pods send traces directly to that Service instead of using the node's host IP. | | openTelemetry.agent.name | string | `"otel-agent"` | Name used by resources. Does not affect service names or PVCs. | | openTelemetry.agent.resources.limits.cpu | string | `"500m"` | | | openTelemetry.agent.resources.limits.memory | string | `"500Mi"` | | diff --git a/charts/sourcegraph/templates/_helpers.tpl b/charts/sourcegraph/templates/_helpers.tpl index 13d0ed52d..e9ec49c86 100644 --- a/charts/sourcegraph/templates/_helpers.tpl +++ b/charts/sourcegraph/templates/_helpers.tpl @@ -169,6 +169,10 @@ app.kubernetes.io/name: jaeger {{- define "sourcegraph.openTelemetryEnv" -}} {{- if .Values.openTelemetry.enabled -}} +{{- if eq (.Values.openTelemetry.agent.kind | default "DaemonSet") "Deployment" -}} +- name: OTEL_EXPORTER_OTLP_ENDPOINT + value: http://otel-agent:4317 +{{- else -}} # OTEL_AGENT_HOST must be defined before OTEL_EXPORTER_OTLP_ENDPOINT to substitute the node IP on which the DaemonSet pod instance runs in the latter variable - name: OTEL_AGENT_HOST valueFrom: @@ -178,6 +182,7 @@ app.kubernetes.io/name: jaeger value: http://$(OTEL_AGENT_HOST):{{ toYaml .Values.openTelemetry.agent.hostPorts.grpcOtlp }} {{- end }} {{- end }} +{{- end }} {{- define "sourcegraph.databaseAuth" -}} {{- $top := index . 0 -}} diff --git a/charts/sourcegraph/templates/otel-collector/otel-agent.DaemonSet.yaml b/charts/sourcegraph/templates/otel-collector/otel-agent.DaemonSet.yaml index b27713969..d93c64b62 100644 --- a/charts/sourcegraph/templates/otel-collector/otel-agent.DaemonSet.yaml +++ b/charts/sourcegraph/templates/otel-collector/otel-agent.DaemonSet.yaml @@ -1,4 +1,4 @@ -{{- if .Values.openTelemetry.enabled -}} +{{- if and .Values.openTelemetry.enabled (eq (.Values.openTelemetry.agent.kind | default "DaemonSet") "DaemonSet") -}} apiVersion: apps/v1 kind: DaemonSet metadata: diff --git a/charts/sourcegraph/templates/otel-collector/otel-agent.Deployment.yaml b/charts/sourcegraph/templates/otel-collector/otel-agent.Deployment.yaml new file mode 100644 index 000000000..957dfafe7 --- /dev/null +++ b/charts/sourcegraph/templates/otel-collector/otel-agent.Deployment.yaml @@ -0,0 +1,99 @@ +{{- if and .Values.openTelemetry.enabled (eq (.Values.openTelemetry.agent.kind | default "DaemonSet") "Deployment") -}} +apiVersion: apps/v1 +kind: Deployment +metadata: + annotations: + description: Forwards telemetry data to the OpenTelemetry Collector Deployment. + labels: + {{- include "sourcegraph.labels" . | nindent 4 }} + {{- if .Values.openTelemetry.agent.labels }} + {{- toYaml .Values.openTelemetry.agent.labels | nindent 4 }} + {{- end }} + deploy: sourcegraph + app.kubernetes.io/component: otel-collector + name: {{ .Values.openTelemetry.agent.name }} +spec: + selector: + matchLabels: + {{- include "sourcegraph.selectorLabels" . | nindent 6 }} + app: otel-agent + minReadySeconds: 5 + replicas: {{ .Values.openTelemetry.agent.replicas | default 1 }} + template: + metadata: + annotations: + kubectl.kubernetes.io/default-container: otel-agent + {{- if .Values.sourcegraph.podAnnotations }} + {{- toYaml .Values.sourcegraph.podAnnotations | nindent 8 }} + {{- end }} + {{- if .Values.openTelemetry.agent.podAnnotations }} + {{- toYaml .Values.openTelemetry.agent.podAnnotations | nindent 8 }} + {{- end }} + labels: + {{- include "sourcegraph.selectorLabels" . | nindent 8 }} + {{- if .Values.sourcegraph.podLabels }} + {{- toYaml .Values.sourcegraph.podLabels | nindent 8 }} + {{- end }} + {{- if .Values.openTelemetry.agent.podLabels }} + {{- toYaml .Values.openTelemetry.agent.podLabels | nindent 8 }} + {{- end }} + deploy: sourcegraph + app: otel-agent + spec: + containers: + - name: otel-agent + image: {{ include "sourcegraph.image" (list . "openTelemetry") }} + imagePullPolicy: {{ .Values.sourcegraph.image.pullPolicy }} + command: + - "/bin/otelcol-sourcegraph" + - "--config=/etc/otel-agent/config.yaml" + {{- with .Values.openTelemetry.agent.args }} + args: + {{- toYaml . | nindent 8 }} + {{- end }} + terminationMessagePolicy: FallbackToLogsOnError + env: + {{- range $name, $item := .Values.openTelemetry.agent.env}} + - name: {{ $name }} + {{- $item | toYaml | nindent 10 }} + {{- end }} + resources: + {{- toYaml .Values.openTelemetry.agent.resources | nindent 10 }} + securityContext: + {{- toYaml .Values.openTelemetry.agent.containerSecurityContext | nindent 10 }} + readinessProbe: + httpGet: + path: / + port: 13133 + livenessProbe: + httpGet: + path: / + port: 13133 + ports: + - name: grpc-otlp + containerPort: 4317 + - name: http-otlp + containerPort: 4318 + - name: http-zpages + containerPort: 55679 + volumeMounts: + - name: config + mountPath: /etc/otel-agent + terminationGracePeriodSeconds: 120 + {{- include "sourcegraph.nodeSelector" (list . "openTelemetry" ) | trim | nindent 6 }} + {{- include "sourcegraph.affinity" (list . "openTelemetry" ) | trim | nindent 6 }} + {{- with include "sourcegraph.priorityClassName" (list . "openTelemetry" ) | trim }}{{ . | nindent 6 }}{{- end }} + {{- include "sourcegraph.tolerations" (list . "openTelemetry" ) | trim | nindent 6 }} + {{- with .Values.sourcegraph.imagePullSecrets }} + imagePullSecrets: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- include "sourcegraph.renderServiceAccountName" (list .Values.openTelemetry "agent") | trim | nindent 6 }} + volumes: + - name: config + configMap: + name: otel-agent + items: + - key: config.yaml + path: config.yaml +{{- end }} diff --git a/charts/sourcegraph/templates/otel-collector/otel-agent.Service.yaml b/charts/sourcegraph/templates/otel-collector/otel-agent.Service.yaml new file mode 100644 index 000000000..3daf864c9 --- /dev/null +++ b/charts/sourcegraph/templates/otel-collector/otel-agent.Service.yaml @@ -0,0 +1,24 @@ +{{- if and .Values.openTelemetry.enabled (eq (.Values.openTelemetry.agent.kind | default "DaemonSet") "Deployment") -}} +apiVersion: v1 +kind: Service +metadata: + labels: + {{- include "sourcegraph.labels" . | nindent 4 }} + deploy: sourcegraph + app.kubernetes.io/component: otel-collector + name: otel-agent +spec: + ports: + - name: grpc-otlp + port: 4317 + protocol: TCP + targetPort: grpc-otlp + - name: http-otlp + port: 4318 + protocol: TCP + targetPort: http-otlp + selector: + {{- include "sourcegraph.selectorLabels" . | nindent 4 }} + app: otel-agent + type: ClusterIP +{{- end }} diff --git a/charts/sourcegraph/tests/otelAgentKind_test.yaml b/charts/sourcegraph/tests/otelAgentKind_test.yaml new file mode 100644 index 000000000..dfd105f68 --- /dev/null +++ b/charts/sourcegraph/tests/otelAgentKind_test.yaml @@ -0,0 +1,112 @@ +--- +suite: otelAgentKind +tests: + - it: should render a DaemonSet by default + template: otel-collector/otel-agent.DaemonSet.yaml + asserts: + - isKind: + of: DaemonSet + - it: should render a DaemonSet when kind is DaemonSet + template: otel-collector/otel-agent.DaemonSet.yaml + set: + openTelemetry: + agent: + kind: "DaemonSet" + asserts: + - isKind: + of: DaemonSet + - it: should not render a DaemonSet when kind is Deployment + template: otel-collector/otel-agent.DaemonSet.yaml + set: + openTelemetry: + agent: + kind: "Deployment" + asserts: + - hasDocuments: + count: 0 + - it: should render a Deployment when kind is Deployment + template: otel-collector/otel-agent.Deployment.yaml + set: + openTelemetry: + agent: + kind: "Deployment" + asserts: + - isKind: + of: Deployment + - it: should not render a Deployment by default + template: otel-collector/otel-agent.Deployment.yaml + asserts: + - hasDocuments: + count: 0 + - it: should render a Service when kind is Deployment + template: otel-collector/otel-agent.Service.yaml + set: + openTelemetry: + agent: + kind: "Deployment" + asserts: + - isKind: + of: Service + - equal: + path: metadata.name + value: otel-agent + - contains: + path: spec.ports + content: + name: grpc-otlp + port: 4317 + protocol: TCP + targetPort: grpc-otlp + - it: should not render a Service by default (DaemonSet mode) + template: otel-collector/otel-agent.Service.yaml + asserts: + - hasDocuments: + count: 0 + - it: should set OTEL_EXPORTER_OTLP_ENDPOINT to otel-agent service when kind is Deployment + template: searcher/searcher.StatefulSet.yaml + set: + openTelemetry: + agent: + kind: "Deployment" + asserts: + - contains: + path: spec.template.spec.containers[0].env + content: + name: OTEL_EXPORTER_OTLP_ENDPOINT + value: "http://otel-agent:4317" + - notContains: + path: spec.template.spec.containers[0].env + content: + name: OTEL_AGENT_HOST + - it: should set default replica count of 1 for Deployment kind + template: otel-collector/otel-agent.Deployment.yaml + set: + openTelemetry: + agent: + kind: "Deployment" + asserts: + - equal: + path: spec.replicas + value: 1 + - it: should allow configuring replicas for Deployment kind + template: otel-collector/otel-agent.Deployment.yaml + set: + openTelemetry: + agent: + kind: "Deployment" + replicas: 3 + asserts: + - equal: + path: spec.replicas + value: 3 + - it: should not have hostPorts in Deployment mode + template: otel-collector/otel-agent.Deployment.yaml + set: + openTelemetry: + agent: + kind: "Deployment" + asserts: + - notContains: + path: spec.template.spec.containers[0].ports + content: + hostPort: 4317 diff --git a/charts/sourcegraph/values.yaml b/charts/sourcegraph/values.yaml index cdb59b5fd..a6435d0aa 100644 --- a/charts/sourcegraph/values.yaml +++ b/charts/sourcegraph/values.yaml @@ -658,6 +658,11 @@ openTelemetry: agent: # -- Name used by resources. Does not affect service names or PVCs. name: "otel-agent" + # -- The workload kind for the otel-agent. Valid values are `DaemonSet` and `Deployment`. + # Use `Deployment` in environments where DaemonSets are restricted (e.g. some managed Kubernetes offerings). + # When set to `Deployment`, a ClusterIP Service is created for the agent and application pods send + # traces directly to that Service instead of using the node's host IP. + kind: "DaemonSet" # -- Resource requests & limits for the `otel-agent` container, # learn more from the [Kubernetes documentation](https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/) hostPorts: From 09a44c2a33e8a1d5634431c31ab6e8dc011825ca Mon Sep 17 00:00:00 2001 From: Claude Date: Thu, 7 May 2026 22:54:31 +0000 Subject: [PATCH 2/2] otel-agent: simplify Deployment mode to reuse otel-collector When openTelemetry.agent.kind=Deployment, skip the otel-agent DaemonSet and point OTEL_EXPORTER_OTLP_ENDPOINT directly at the existing otel-collector Deployment (http://otel-collector:4317), which already has the OTLP gRPC receiver enabled. Removes the unnecessary otel-agent Deployment + ClusterIP Service that were added in the previous commit. https://claude.ai/code/session_01K2AnXLduzruntPtUsC7xiA --- charts/sourcegraph/README.md | 2 +- charts/sourcegraph/templates/_helpers.tpl | 2 +- .../otel-collector/otel-agent.Deployment.yaml | 99 ------------------- .../otel-collector/otel-agent.Service.yaml | 24 ----- .../sourcegraph/tests/otelAgentKind_test.yaml | 74 +------------- charts/sourcegraph/values.yaml | 4 +- 6 files changed, 6 insertions(+), 199 deletions(-) delete mode 100644 charts/sourcegraph/templates/otel-collector/otel-agent.Deployment.yaml delete mode 100644 charts/sourcegraph/templates/otel-collector/otel-agent.Service.yaml diff --git a/charts/sourcegraph/README.md b/charts/sourcegraph/README.md index 60029ae5d..d51916c3d 100644 --- a/charts/sourcegraph/README.md +++ b/charts/sourcegraph/README.md @@ -203,7 +203,7 @@ In addition to the documented values, all services also support the following va | openTelemetry.agent.containerSecurityContext.runAsGroup | int | `101` | | | openTelemetry.agent.containerSecurityContext.runAsUser | int | `100` | | | openTelemetry.agent.hostPorts | object | `{"grpcOtlp":4317,"httpOtlp":4318,"httpZpages":55679}` | Resource requests & limits for the `otel-agent` container, learn more from the [Kubernetes documentation](https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/) | -| openTelemetry.agent.kind | string | `"DaemonSet"` | The workload kind for the otel-agent. Valid values are `DaemonSet` and `Deployment`. Use `Deployment` in environments where DaemonSets are restricted (e.g. some managed Kubernetes offerings). When set to `Deployment`, a ClusterIP Service is created for the agent and application pods send traces directly to that Service instead of using the node's host IP. | +| openTelemetry.agent.kind | string | `"DaemonSet"` | The workload kind for the otel-agent. Valid values are `DaemonSet` and `Deployment`. Use `Deployment` in environments where DaemonSets are restricted (e.g. some managed Kubernetes offerings). When set to `Deployment`, the otel-agent DaemonSet is not created and application pods send traces directly to the existing otel-collector Deployment (otel-collector:4317) instead. | | openTelemetry.agent.name | string | `"otel-agent"` | Name used by resources. Does not affect service names or PVCs. | | openTelemetry.agent.resources.limits.cpu | string | `"500m"` | | | openTelemetry.agent.resources.limits.memory | string | `"500Mi"` | | diff --git a/charts/sourcegraph/templates/_helpers.tpl b/charts/sourcegraph/templates/_helpers.tpl index e9ec49c86..01d070d55 100644 --- a/charts/sourcegraph/templates/_helpers.tpl +++ b/charts/sourcegraph/templates/_helpers.tpl @@ -171,7 +171,7 @@ app.kubernetes.io/name: jaeger {{- if .Values.openTelemetry.enabled -}} {{- if eq (.Values.openTelemetry.agent.kind | default "DaemonSet") "Deployment" -}} - name: OTEL_EXPORTER_OTLP_ENDPOINT - value: http://otel-agent:4317 + value: http://otel-collector:4317 {{- else -}} # OTEL_AGENT_HOST must be defined before OTEL_EXPORTER_OTLP_ENDPOINT to substitute the node IP on which the DaemonSet pod instance runs in the latter variable - name: OTEL_AGENT_HOST diff --git a/charts/sourcegraph/templates/otel-collector/otel-agent.Deployment.yaml b/charts/sourcegraph/templates/otel-collector/otel-agent.Deployment.yaml deleted file mode 100644 index 957dfafe7..000000000 --- a/charts/sourcegraph/templates/otel-collector/otel-agent.Deployment.yaml +++ /dev/null @@ -1,99 +0,0 @@ -{{- if and .Values.openTelemetry.enabled (eq (.Values.openTelemetry.agent.kind | default "DaemonSet") "Deployment") -}} -apiVersion: apps/v1 -kind: Deployment -metadata: - annotations: - description: Forwards telemetry data to the OpenTelemetry Collector Deployment. - labels: - {{- include "sourcegraph.labels" . | nindent 4 }} - {{- if .Values.openTelemetry.agent.labels }} - {{- toYaml .Values.openTelemetry.agent.labels | nindent 4 }} - {{- end }} - deploy: sourcegraph - app.kubernetes.io/component: otel-collector - name: {{ .Values.openTelemetry.agent.name }} -spec: - selector: - matchLabels: - {{- include "sourcegraph.selectorLabels" . | nindent 6 }} - app: otel-agent - minReadySeconds: 5 - replicas: {{ .Values.openTelemetry.agent.replicas | default 1 }} - template: - metadata: - annotations: - kubectl.kubernetes.io/default-container: otel-agent - {{- if .Values.sourcegraph.podAnnotations }} - {{- toYaml .Values.sourcegraph.podAnnotations | nindent 8 }} - {{- end }} - {{- if .Values.openTelemetry.agent.podAnnotations }} - {{- toYaml .Values.openTelemetry.agent.podAnnotations | nindent 8 }} - {{- end }} - labels: - {{- include "sourcegraph.selectorLabels" . | nindent 8 }} - {{- if .Values.sourcegraph.podLabels }} - {{- toYaml .Values.sourcegraph.podLabels | nindent 8 }} - {{- end }} - {{- if .Values.openTelemetry.agent.podLabels }} - {{- toYaml .Values.openTelemetry.agent.podLabels | nindent 8 }} - {{- end }} - deploy: sourcegraph - app: otel-agent - spec: - containers: - - name: otel-agent - image: {{ include "sourcegraph.image" (list . "openTelemetry") }} - imagePullPolicy: {{ .Values.sourcegraph.image.pullPolicy }} - command: - - "/bin/otelcol-sourcegraph" - - "--config=/etc/otel-agent/config.yaml" - {{- with .Values.openTelemetry.agent.args }} - args: - {{- toYaml . | nindent 8 }} - {{- end }} - terminationMessagePolicy: FallbackToLogsOnError - env: - {{- range $name, $item := .Values.openTelemetry.agent.env}} - - name: {{ $name }} - {{- $item | toYaml | nindent 10 }} - {{- end }} - resources: - {{- toYaml .Values.openTelemetry.agent.resources | nindent 10 }} - securityContext: - {{- toYaml .Values.openTelemetry.agent.containerSecurityContext | nindent 10 }} - readinessProbe: - httpGet: - path: / - port: 13133 - livenessProbe: - httpGet: - path: / - port: 13133 - ports: - - name: grpc-otlp - containerPort: 4317 - - name: http-otlp - containerPort: 4318 - - name: http-zpages - containerPort: 55679 - volumeMounts: - - name: config - mountPath: /etc/otel-agent - terminationGracePeriodSeconds: 120 - {{- include "sourcegraph.nodeSelector" (list . "openTelemetry" ) | trim | nindent 6 }} - {{- include "sourcegraph.affinity" (list . "openTelemetry" ) | trim | nindent 6 }} - {{- with include "sourcegraph.priorityClassName" (list . "openTelemetry" ) | trim }}{{ . | nindent 6 }}{{- end }} - {{- include "sourcegraph.tolerations" (list . "openTelemetry" ) | trim | nindent 6 }} - {{- with .Values.sourcegraph.imagePullSecrets }} - imagePullSecrets: - {{- toYaml . | nindent 8 }} - {{- end }} - {{- include "sourcegraph.renderServiceAccountName" (list .Values.openTelemetry "agent") | trim | nindent 6 }} - volumes: - - name: config - configMap: - name: otel-agent - items: - - key: config.yaml - path: config.yaml -{{- end }} diff --git a/charts/sourcegraph/templates/otel-collector/otel-agent.Service.yaml b/charts/sourcegraph/templates/otel-collector/otel-agent.Service.yaml deleted file mode 100644 index 3daf864c9..000000000 --- a/charts/sourcegraph/templates/otel-collector/otel-agent.Service.yaml +++ /dev/null @@ -1,24 +0,0 @@ -{{- if and .Values.openTelemetry.enabled (eq (.Values.openTelemetry.agent.kind | default "DaemonSet") "Deployment") -}} -apiVersion: v1 -kind: Service -metadata: - labels: - {{- include "sourcegraph.labels" . | nindent 4 }} - deploy: sourcegraph - app.kubernetes.io/component: otel-collector - name: otel-agent -spec: - ports: - - name: grpc-otlp - port: 4317 - protocol: TCP - targetPort: grpc-otlp - - name: http-otlp - port: 4318 - protocol: TCP - targetPort: http-otlp - selector: - {{- include "sourcegraph.selectorLabels" . | nindent 4 }} - app: otel-agent - type: ClusterIP -{{- end }} diff --git a/charts/sourcegraph/tests/otelAgentKind_test.yaml b/charts/sourcegraph/tests/otelAgentKind_test.yaml index dfd105f68..8954a2935 100644 --- a/charts/sourcegraph/tests/otelAgentKind_test.yaml +++ b/charts/sourcegraph/tests/otelAgentKind_test.yaml @@ -24,45 +24,7 @@ tests: asserts: - hasDocuments: count: 0 - - it: should render a Deployment when kind is Deployment - template: otel-collector/otel-agent.Deployment.yaml - set: - openTelemetry: - agent: - kind: "Deployment" - asserts: - - isKind: - of: Deployment - - it: should not render a Deployment by default - template: otel-collector/otel-agent.Deployment.yaml - asserts: - - hasDocuments: - count: 0 - - it: should render a Service when kind is Deployment - template: otel-collector/otel-agent.Service.yaml - set: - openTelemetry: - agent: - kind: "Deployment" - asserts: - - isKind: - of: Service - - equal: - path: metadata.name - value: otel-agent - - contains: - path: spec.ports - content: - name: grpc-otlp - port: 4317 - protocol: TCP - targetPort: grpc-otlp - - it: should not render a Service by default (DaemonSet mode) - template: otel-collector/otel-agent.Service.yaml - asserts: - - hasDocuments: - count: 0 - - it: should set OTEL_EXPORTER_OTLP_ENDPOINT to otel-agent service when kind is Deployment + - it: should set OTEL_EXPORTER_OTLP_ENDPOINT to otel-collector when kind is Deployment template: searcher/searcher.StatefulSet.yaml set: openTelemetry: @@ -73,40 +35,8 @@ tests: path: spec.template.spec.containers[0].env content: name: OTEL_EXPORTER_OTLP_ENDPOINT - value: "http://otel-agent:4317" + value: "http://otel-collector:4317" - notContains: path: spec.template.spec.containers[0].env content: name: OTEL_AGENT_HOST - - it: should set default replica count of 1 for Deployment kind - template: otel-collector/otel-agent.Deployment.yaml - set: - openTelemetry: - agent: - kind: "Deployment" - asserts: - - equal: - path: spec.replicas - value: 1 - - it: should allow configuring replicas for Deployment kind - template: otel-collector/otel-agent.Deployment.yaml - set: - openTelemetry: - agent: - kind: "Deployment" - replicas: 3 - asserts: - - equal: - path: spec.replicas - value: 3 - - it: should not have hostPorts in Deployment mode - template: otel-collector/otel-agent.Deployment.yaml - set: - openTelemetry: - agent: - kind: "Deployment" - asserts: - - notContains: - path: spec.template.spec.containers[0].ports - content: - hostPort: 4317 diff --git a/charts/sourcegraph/values.yaml b/charts/sourcegraph/values.yaml index a6435d0aa..632d4fdd2 100644 --- a/charts/sourcegraph/values.yaml +++ b/charts/sourcegraph/values.yaml @@ -660,8 +660,8 @@ openTelemetry: name: "otel-agent" # -- The workload kind for the otel-agent. Valid values are `DaemonSet` and `Deployment`. # Use `Deployment` in environments where DaemonSets are restricted (e.g. some managed Kubernetes offerings). - # When set to `Deployment`, a ClusterIP Service is created for the agent and application pods send - # traces directly to that Service instead of using the node's host IP. + # When set to `Deployment`, the otel-agent DaemonSet is not created and application pods send + # traces directly to the existing otel-collector Deployment (otel-collector:4317) instead. kind: "DaemonSet" # -- Resource requests & limits for the `otel-agent` container, # learn more from the [Kubernetes documentation](https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/)