Skip to content

Commit 3a46505

Browse files
committed
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
1 parent 07c50b1 commit 3a46505

6 files changed

Lines changed: 6 additions & 199 deletions

File tree

charts/sourcegraph/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,7 @@ In addition to the documented values, all services also support the following va
203203
| openTelemetry.agent.containerSecurityContext.runAsGroup | int | `101` | |
204204
| openTelemetry.agent.containerSecurityContext.runAsUser | int | `100` | |
205205
| 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/) |
206-
| 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. |
206+
| 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. |
207207
| openTelemetry.agent.name | string | `"otel-agent"` | Name used by resources. Does not affect service names or PVCs. |
208208
| openTelemetry.agent.resources.limits.cpu | string | `"500m"` | |
209209
| openTelemetry.agent.resources.limits.memory | string | `"500Mi"` | |

charts/sourcegraph/templates/_helpers.tpl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ app.kubernetes.io/name: jaeger
171171
{{- if .Values.openTelemetry.enabled -}}
172172
{{- if eq (.Values.openTelemetry.agent.kind | default "DaemonSet") "Deployment" -}}
173173
- name: OTEL_EXPORTER_OTLP_ENDPOINT
174-
value: http://otel-agent:4317
174+
value: http://otel-collector:4317
175175
{{- else -}}
176176
# 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
177177
- name: OTEL_AGENT_HOST

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

Lines changed: 0 additions & 99 deletions
This file was deleted.

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

Lines changed: 0 additions & 24 deletions
This file was deleted.

charts/sourcegraph/tests/otelAgentKind_test.yaml

Lines changed: 2 additions & 72 deletions
Original file line numberDiff line numberDiff line change
@@ -24,45 +24,7 @@ tests:
2424
asserts:
2525
- hasDocuments:
2626
count: 0
27-
- it: should render a Deployment when kind is Deployment
28-
template: otel-collector/otel-agent.Deployment.yaml
29-
set:
30-
openTelemetry:
31-
agent:
32-
kind: "Deployment"
33-
asserts:
34-
- isKind:
35-
of: Deployment
36-
- it: should not render a Deployment by default
37-
template: otel-collector/otel-agent.Deployment.yaml
38-
asserts:
39-
- hasDocuments:
40-
count: 0
41-
- it: should render a Service when kind is Deployment
42-
template: otel-collector/otel-agent.Service.yaml
43-
set:
44-
openTelemetry:
45-
agent:
46-
kind: "Deployment"
47-
asserts:
48-
- isKind:
49-
of: Service
50-
- equal:
51-
path: metadata.name
52-
value: otel-agent
53-
- contains:
54-
path: spec.ports
55-
content:
56-
name: grpc-otlp
57-
port: 4317
58-
protocol: TCP
59-
targetPort: grpc-otlp
60-
- it: should not render a Service by default (DaemonSet mode)
61-
template: otel-collector/otel-agent.Service.yaml
62-
asserts:
63-
- hasDocuments:
64-
count: 0
65-
- it: should set OTEL_EXPORTER_OTLP_ENDPOINT to otel-agent service when kind is Deployment
27+
- it: should set OTEL_EXPORTER_OTLP_ENDPOINT to otel-collector when kind is Deployment
6628
template: searcher/searcher.StatefulSet.yaml
6729
set:
6830
openTelemetry:
@@ -73,40 +35,8 @@ tests:
7335
path: spec.template.spec.containers[0].env
7436
content:
7537
name: OTEL_EXPORTER_OTLP_ENDPOINT
76-
value: "http://otel-agent:4317"
38+
value: "http://otel-collector:4317"
7739
- notContains:
7840
path: spec.template.spec.containers[0].env
7941
content:
8042
name: OTEL_AGENT_HOST
81-
- it: should set default replica count of 1 for Deployment kind
82-
template: otel-collector/otel-agent.Deployment.yaml
83-
set:
84-
openTelemetry:
85-
agent:
86-
kind: "Deployment"
87-
asserts:
88-
- equal:
89-
path: spec.replicas
90-
value: 1
91-
- it: should allow configuring replicas for Deployment kind
92-
template: otel-collector/otel-agent.Deployment.yaml
93-
set:
94-
openTelemetry:
95-
agent:
96-
kind: "Deployment"
97-
replicas: 3
98-
asserts:
99-
- equal:
100-
path: spec.replicas
101-
value: 3
102-
- it: should not have hostPorts in Deployment mode
103-
template: otel-collector/otel-agent.Deployment.yaml
104-
set:
105-
openTelemetry:
106-
agent:
107-
kind: "Deployment"
108-
asserts:
109-
- notContains:
110-
path: spec.template.spec.containers[0].ports
111-
content:
112-
hostPort: 4317

charts/sourcegraph/values.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -660,8 +660,8 @@ openTelemetry:
660660
name: "otel-agent"
661661
# -- The workload kind for the otel-agent. Valid values are `DaemonSet` and `Deployment`.
662662
# Use `Deployment` in environments where DaemonSets are restricted (e.g. some managed Kubernetes offerings).
663-
# When set to `Deployment`, a ClusterIP Service is created for the agent and application pods send
664-
# traces directly to that Service instead of using the node's host IP.
663+
# When set to `Deployment`, the otel-agent DaemonSet is not created and application pods send
664+
# traces directly to the existing otel-collector Deployment (otel-collector:4317) instead.
665665
kind: "DaemonSet"
666666
# -- Resource requests & limits for the `otel-agent` container,
667667
# learn more from the [Kubernetes documentation](https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/)

0 commit comments

Comments
 (0)