Repository navigation
sourcegraph: read-only root filesystem for blobstore, cadvisor, otel, and pgsql-exporter - #1003
Draft
marcleblanc2 wants to merge 1 commit into
Draft
marcleblanc2 wants to merge 1 commit into
marcleblanc2 wants to merge 1 commit into
Conversation
… and pgsql-exporter These were the only containers in the chart, besides prometheus, without readOnlyRootFilesystem: true. blobstore gets an emptyDir at /tmp. postgresExporter.containerSecurityContext was read by the three database StatefulSets but never defined, so the sidecar rendered securityContext: null. It sets no user, so the sidecar keeps running as its database pod's user. Amp-Thread-ID: https://ampcode.com/threads/T-01a13cfb-9756-7111-8b29-381a841065e1 Co-authored-by: Amp <amp@ampcode.com>
This was referenced Nov 11, 2026
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Open issues
Found in review on 2026-11-13 (review thread), at
a6fa5d5. The change passed its cluster test (see "Test plan"); this PR is a draft until the first is fixed.maininREADME.md. Fix: rebase and regenerate it with./scripts/helm-docs.sh/tmponblobstorecollides with the newtmpdirvolume. The API rejects a new Deployment with two mounts at/tmp(mountPath: must be unique), or with a second volume namedtmpdir. Checked withkubectl create --dry-run=server; a realhelm upgradeof such a release was not run. Fix: say so in the changelogtmpdirvolumeotel-agent,otel-collector, and the exporter sidecar (openTelemetry.agent,openTelemetry.gateway,postgresExporter)prometheus" leaves out thehelm testpod, which sets no security contextProblem
Some customers need a read-only root filesystem on every container
These containers didn't set
readOnlyRootFilesystem: true:blobstore,cadvisor,otel-agent, andotel-collectorpgsql-exportersidecar ofpgsql,codeintel-db, andcodeinsights-dbpostgresExporter.containerSecurityContext, butvalues.yamlnever defined itSolution
Set
readOnlyRootFilesystem: trueon each of them:blobstorealso gets anemptyDirat/tmpcadvisorstaysprivilegedvalues.yamldefinespostgresExporter.containerSecurityContext, which also setsallowPrivilegeEscalation: falserunAsUserorrunAsGroup, so the sidecar keeps running as its database pod's userNot changed:
prometheus, which is fix/observability: Prometheus read only root volume #1000, and waits on an image changeTest plan
helm lint charts/sourcegraphandhelm unittest charts/sourcegraphpasshelm templatewith default values rendersreadOnlyRootFilesystem: trueon every container exceptprometheus, and thetmpdirvolume onblobstoreHelm
On the EKS test instance
m5, on 2026-11-13, by upgrading frommainto this branch merged ontomain, withcadvisor.enabled: true:blobstore,otel-collector, the three databases, and eachcadvisorandotel-agentpod were replaced onceprometheusand the k8s executor (a separate chart) lack a read-only root filesystemblobstore:/tmpis writable, the rest of the root filesystem is not, and a search job completed and wrote its results toblobstorepg_up 1with no scrape errors, running as their database's usercadvisorpod queried serves container metrics, andotel-agentandotel-collectorstart cleanlyNot run:
Docker Compose
read_only: trueLinked PRs
prometheusread_only: truein Docker Composevalues.yaml, so whichever merges second needs a rebasepgsql-exporterDeployment, which picks up this defaultAmp threads
Changelog
blobstore,cadvisor,otel-agent,otel-collector, and thepgsql-exportersidecars now run with a read-only root filesystem<serviceName>.containerSecurityContext.readOnlyRootFilesystem: falseto revertpostgresExporter.containerSecurityContext, which the templates already read butvalues.yamldid not define