diff --git a/deploy/kubernetes/region/base/deployment.yaml b/deploy/kubernetes/region/base/deployment.yaml index b8b345e..f7fbe86 100644 --- a/deploy/kubernetes/region/base/deployment.yaml +++ b/deploy/kubernetes/region/base/deployment.yaml @@ -42,17 +42,29 @@ spec: fsGroup: 10001 fsGroupChangePolicy: Always seccompProfile: {type: RuntimeDefault} + initContainers: + - name: prepare-pgpass + image: aevolution-server + command: ["/bin/bash", "-c"] + args: ["set -eu; umask 077; cp /run/postgres/pgpass /tmp/pgpass; chmod 0600 /tmp/pgpass"] + securityContext: + runAsUser: 0 + runAsGroup: 0 + runAsNonRoot: false + allowPrivilegeEscalation: false + readOnlyRootFilesystem: true + capabilities: {drop: [ALL]} + volumeMounts: + - {name: connection, mountPath: /run/postgres, readOnly: true} + - {name: scratch, mountPath: /tmp} containers: - name: evo-server image: aevolution-server - # libpq ignores group-readable password files: copy to private memory, then - # exec so evo-server is PID 1 and receives SIGTERM directly. + # The init container copies pgpass to private memory, then exec so evo-server is PID 1 and receives SIGTERM directly. command: ["/bin/bash", "-c"] args: - | set -eu - umask 077 - cp /run/postgres/pgpass /tmp/pgpass # Builds that wrote this region's history stay recoverable (ADR-0068). retained=() for build in $REGION_RETAINED; do retained+=(--retained "$build"); done