Agent Mesh
Go a2aa2a-protocolagent-meshagentic-aiinferencemcpmeshmesh-networknetwork-securitynetworking-aip2p-network
charts: non-root postgres needs a data directory it owns
Antonio Ojea843a4b813495
diff --git a/charts/sam-mesh/templates/db-statefulset.yaml b/charts/sam-mesh/templates/db-statefulset.yamlindex 18c6b7a4..ae18ea11 100644--- a/charts/sam-mesh/templates/db-statefulset.yaml+++ b/charts/sam-mesh/templates/db-statefulset.yaml@@ -42,6 +42,11 @@ spec:{{- toYaml . | nindent 10 }}{{- end }}env:+ # initdb chmods its data directory; running as uid 70 it cannot do+ # that to the PVC root (owned by root, group-shared via fsGroup), so+ # the cluster lives in a subdirectory postgres creates and owns.+ - name: PGDATA+ value: /var/lib/postgresql/data/pgdata- name: POSTGRES_DBvalue: {{ .Values.database.postgres.database | quote }}- name: POSTGRES_USERdiff --git a/charts/sam-mesh/tests/db-statefulset_test.yaml b/charts/sam-mesh/tests/db-statefulset_test.yamlindex ab3b936f..bc632cbd 100644--- a/charts/sam-mesh/tests/db-statefulset_test.yaml+++ b/charts/sam-mesh/tests/db-statefulset_test.yaml@@ -36,6 +36,12 @@ tests:- contains:path: spec.template.spec.containers[0].securityContext.capabilities.dropcontent: ALL+ # Non-root initdb needs a data directory it owns, below the PVC root.+ - contains:+ path: spec.template.spec.containers[0].env+ content:+ name: PGDATA+ value: /var/lib/postgresql/data/pgdata- it: scheduling knobs pass through to the pod specset:diff --git a/charts/sam-mesh/values.yaml b/charts/sam-mesh/values.yamlindex b4e06b36..c67b9d53 100644--- a/charts/sam-mesh/values.yaml+++ b/charts/sam-mesh/values.yaml@@ -83,8 +83,12 @@ database:port: 5432sslmode: disablestorageSize: 1Gi- # postgres:16-alpine runs as uid 70 (postgres) and needs the data dir- # owned by it; fsGroup does that on the PVC.+ # postgres:16-alpine runs as uid 70 (postgres); the data directory is+ # the pgdata/ subdirectory of the PVC (initdb must own what it chmods,+ # and the PVC root belongs to root). fsGroup gives uid 70 group access+ # to create it. Upgrading a release whose postgres ran as root with+ # data at the PVC root: move that data into pgdata/ first, or the new+ # pod initialises an empty cluster beside it.podSecurityContext:runAsNonRoot: truerunAsUser: 70