Skip to content

Commit 788d32f

Browse files
authored
Ensure that otel-collector and otel-agent run as sourcegraph user (#543)
* Ensure that otel-collector and otel-agent run as sourcegraph user * Update changelog * Include securityContext in otel deployment + daemonset * Run helm-docs.sh
1 parent 8803c05 commit 788d32f

File tree

5 files changed

+20
-0
lines changed

5 files changed

+20
-0
lines changed

charts/sourcegraph/CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ Use `**BREAKING**:` to denote a breaking change
88

99
## Unreleased
1010

11+
- Updated OpenTelemetry collector and agent images to run as non-root users [#543](https://github.com/sourcegraph/deploy-sourcegraph-helm/pull/543)
12+
1113
## 5.6.185
1214

1315
- Sourcegraph 5.6.185 is now available

charts/sourcegraph/README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -194,6 +194,9 @@ In addition to the documented values, all services also support the following va
194194
| nodeExporter.resources | object | `{"limits":{"cpu":"1","memory":"1Gi"},"requests":{"cpu":".2","memory":"100Mi"}}` | Resource requests & limits for the `node-exporter` container, learn more from the [Kubernetes documentation](https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/) |
195195
| nodeExporter.serviceAccount.create | bool | `false` | Enable creation of ServiceAccount for `node-exporter` |
196196
| nodeExporter.serviceAccount.name | string | `"node-exporter"` | Name of the ServiceAccount to be created or an existing ServiceAccount |
197+
| openTelemetry.agent.containerSecurityContext.allowPrivilegeEscalation | bool | `false` | |
198+
| openTelemetry.agent.containerSecurityContext.runAsGroup | int | `101` | |
199+
| openTelemetry.agent.containerSecurityContext.runAsUser | int | `100` | |
197200
| openTelemetry.agent.hostPorts | object | `{"otlpGrpc":4317,"otlpHttp":4318,"zpages":55679}` | Resource requests & limits for the `otel-agent` container, learn more from the [Kubernetes documentation](https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/) |
198201
| openTelemetry.agent.name | string | `"otel-agent"` | Name used by resources. Does not affect service names or PVCs. |
199202
| openTelemetry.agent.resources.limits.cpu | string | `"500m"` | |
@@ -206,6 +209,9 @@ In addition to the documented values, all services also support the following va
206209
| 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) |
207210
| 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) |
208211
| openTelemetry.gateway.config.traces.processors | object | `{}` | Define trace processors. Read how to configure sampling in the [OpenTelemetry documentation](https://docs.sourcegraph.com/admin/observability/opentelemetry#sampling-traces) |
212+
| openTelemetry.gateway.containerSecurityContext.allowPrivilegeEscalation | bool | `false` | |
213+
| openTelemetry.gateway.containerSecurityContext.runAsGroup | int | `101` | |
214+
| openTelemetry.gateway.containerSecurityContext.runAsUser | int | `100` | |
209215
| openTelemetry.gateway.name | string | `"otel-collector"` | Name used by resources. Does not affect service names or PVCs. |
210216
| 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/) |
211217
| openTelemetry.gateway.serviceAccount.create | bool | `false` | Enable creation of ServiceAccount for `otel-collector` |

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,8 @@ spec:
5858
{{- end }}
5959
resources:
6060
{{- toYaml .Values.openTelemetry.agent.resources | nindent 10 }}
61+
securityContext:
62+
{{- toYaml .Values.openTelemetry.agent.containerSecurityContext | nindent 10 }}
6163
readinessProbe:
6264
httpGet:
6365
path: /

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,8 @@ spec:
7474
{{- end }}
7575
resources:
7676
{{- toYaml .Values.openTelemetry.gateway.resources | nindent 10 }}
77+
securityContext:
78+
{{- toYaml .Values.openTelemetry.gateway.containerSecurityContext | nindent 10 }}
7779
readinessProbe:
7880
httpGet:
7981
path: /

charts/sourcegraph/values.yaml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -645,6 +645,10 @@ openTelemetry:
645645
create: false
646646
# -- Name of the ServiceAccount to be created or an existing ServiceAccount
647647
name: ""
648+
containerSecurityContext:
649+
allowPrivilegeEscalation: false
650+
runAsUser: 100
651+
runAsGroup: 101
648652

649653
agent:
650654
# -- Name used by resources. Does not affect service names or PVCs.
@@ -667,6 +671,10 @@ openTelemetry:
667671
create: false
668672
# -- Name of the ServiceAccount to be created or an existing ServiceAccount
669673
name: ""
674+
containerSecurityContext:
675+
allowPrivilegeEscalation: false
676+
runAsUser: 100
677+
runAsGroup: 101
670678

671679
nodeExporter:
672680
# -- Enable `node-exporter`

0 commit comments

Comments
 (0)