You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit c239141
Browse filesBrowse the repository at this point in the historyBrowse files
fix/opentelemetry: Skip the unused otel-agent ConfigMap and ServiceAccount when openTelemetry.agent.kind is Deployment (#1041)
## Context
- #863 added `openTelemetry.agent.kind: Deployment`, which skips the
`otel-agent` DaemonSet, so application pods send traces straight to
`otel-collector:4317`
- The `otel-agent` DaemonSet is the only pod that mounts the
`otel-agent` ConfigMap and uses the `otel-agent` ServiceAccount
## Problem
- With `kind: Deployment`, the chart still renders the `otel-agent`
ConfigMap, which nothing uses
- Found rendering a customer's override with `kind: Deployment` and
#1038's label values: the orphan ConfigMap was the only object of 49
without their per-component label, since they set no
`openTelemetry.agent.labels` for an agent they don't run
- With `openTelemetry.agent.serviceAccount.create: true`, the
`otel-agent` ServiceAccount renders regardless of `kind` and
`openTelemetry.enabled`, so it is also unused when no DaemonSet renders
## Solution
- Render the `otel-agent` ConfigMap and ServiceAccount under the same
condition as the DaemonSet: `openTelemetry.enabled` and
`openTelemetry.agent.kind` of `DaemonSet`, the default. The
ServiceAccount still also needs `serviceAccount.create`
- On upgrade, Helm deletes the unused objects from releases that set
`kind: Deployment`. Renders with the default `kind: DaemonSet` do not
change
## Testing
- Four new tests in `otelAgentKind_test.yaml`: the ConfigMap and
ServiceAccount each render by default, and not with `kind: Deployment`.
The two `kind: Deployment` tests fail on `main` and pass here; `helm
unittest` (317 tests, 120 snapshots) and `helm lint` pass
- `helm template` renders byte-identical output on `main` and this
branch with the default values, and with
`openTelemetry.agent.serviceAccount.create: true`
- With `serviceAccount.create: true`, the ServiceAccount renders on
`main` with `kind: Deployment` or `openTelemetry.enabled: false`, and
not here
- The customer override with `kind: Deployment` renders 49 objects on
`main`, including the `otel-agent` ConfigMap, and 48 here, without it
- Not deployed on a cluster
## Amp threads
- https://ampcode.com/threads/T-01a21663-f060-7148-8fdc-8eed219fa092
## Changelog
The `otel-agent` ConfigMap and ServiceAccount are no longer rendered
when `openTelemetry.agent.kind` is `Deployment`
Co-authored-by: Amp <amp@ampcode.com>
Copy file name to clipboardExpand all lines: charts/sourcegraph/CHANGELOG.md
+1Lines changed: 1 addition & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -14,6 +14,7 @@ Use `**BREAKING**:` to denote a breaking change
14
14
- The `otel-collector` Service now has the `app: otel-collector` label, like every other Service and the `otel-collector` pods. Prometheus copies Service labels to the metrics it scrapes, so `otel-collector` metrics also gain `app="otel-collector"`.
15
15
- Fixed `otel-collector` serving its own metrics on `127.0.0.1` only when `openTelemetry.gateway.config.traces.exporters` is set, so Prometheus could not scrape them. The configuration the chart renders for those exporters now serves them on all interfaces, port 8888, like the image's `jaeger.yaml`. With the `app: otel-collector` label above, the failed scrape would fire the `otel-collector` "pods available" critical alert. The default configuration, the image's `logging.yaml`, gets the same fix in the `otel-collector` image.
16
16
- Removed the `sourcegraph-resource-requires: no-cluster-admin` label from the `node-exporter` Service, the last object in this chart that set it. It came from the manifests of the old `kubectl apply` install, which used it to split an install between cluster admins and other users, and nothing selects on it. With it, `sourcegraph-resource-requires` set in `sourcegraph.serviceLabels` or `nodeExporter.serviceLabels` rendered the key twice on that Service, which Kustomize and `kubeconform -strict` reject. To keep the label, set it in one of these values. `node-exporter` metrics lose the `sourcegraph_resource_requires` label, which no bundled dashboard or alert queries.
17
+
- The `otel-agent` ConfigMap and ServiceAccount are no longer rendered when `openTelemetry.agent.kind` is `Deployment` or `openTelemetry.enabled` is false, like the `otel-agent` DaemonSet, the only pod that uses them. On upgrade, Helm deletes them from releases that set `kind: Deployment`. Renders with the default `kind: DaemonSet` do not change.
17
18
- The `correct-data-dir-permissions` init containers of `pgsql`, `codeintel-db`, and `codeinsights-db` now run the database's own image instead of `sourcegraph/alpine-3.14`, which was based on an end-of-life Alpine release. The chart no longer pulls `alpine-3.14`, so private registries no longer need to mirror it. `alpine.image` has been removed and is ignored if set; `alpine.containerSecurityContext`, `alpine.resources`, and `codeInsightsDB.init.containerSecurityContext` still apply.
18
19
- Added `sourcegraph.selectorLabelsOverride`, `<serviceName>.extraSelectorLabels`, and `storageLabels` on `gitserver`, `grafana`, `indexedSearch`, and `searcher`, so the chart can render the selectors and volume claim templates of workloads created outside it, such as with Kustomize, and a Helm release can take them over without deleting them. All default to empty, so existing releases render the same selectors. Never change them on an installed release: Kubernetes does not allow changing these fields. See [Adopting existing workloads](README.md#adopting-existing-workloads).
19
20
- Fixed `frontend.command` and `migrator.command` rendering a list as a single element, e.g. `["sh", "-c", "<script>"]` became `[sh -c <script>]`, so the container failed to start. Both are now rendered as YAML lists and documented in `values.yaml`. A string holding a YAML list, the only form that worked before, still renders unchanged.
0 commit comments