Skip to the content.

Managed PostgreSQL (MSP)

Module: services/msppostgresql · NEBIUS_MOCKER_SERVICES=msp-postgresql M1 tier: T2 (mock backend) · T3: docker backend (real PostgreSQL + PgBouncer in Docker) · Endpoint: postgresql.msp.api.nebius.cloud · Operations: common.v1alpha1.OperationService

Implementation status

Piece Status
ClusterService: Get, GetByName, GetForBackup, List (paged), Create, Update (reset mask, resource_version), Delete, Restore (incl. point-in-time), Stop, Start ✅
BackupService: Get, List (by project, paged, proto ordering), ListByCluster, Create (on-demand), Delete (on-demand only) ✅
Catalog validation: version, platform/preset (status.preset_details), disk type and size (grow only), hosts count, pooler, postgresql_config_16 ranges, backup window and retention ✅
Automatic backups: one right after a cluster first runs, then daily at backup_window_start (UTC, mock clock); retention <N>d (7–30) also for backups of deleted clusters ✅
Backend port (domain.Backend in services/msppostgresql/domain/ports.go); mock is the default ✅
docker backend: a real PostgreSQL primary + streaming replicas, PgBouncer pooler, TLS from the mocker CA, parameters applied, password changes, physical backups with WAL archiving and PITR restore ✅ e2e: make e2e-msp
Authorization: rules for every RPC (postgresql.clusters.*, postgresql.backups.*, stop/start verbs) ✅
nebius_msp_postgresql_v1alpha1_cluster resource and data source with the official provider ✅ e2e: test/terraform/msp
nebius msp postgresql v1alpha1 cluster … / backup … CLI flows ✅ e2e: test/cli/msp
Quotas: msp.postgresql.cluster.count, .vcpu, .memory, .disk.size charged on Create and Restore, the growth on Update, released on Delete (quotas.md) ✅
Cross-region backup replication, maintenance windows Not yet (see Not yet)

Verified against: nebius/api@4522189, terraform-provider-nebius v0.6.91, gosdk v0.2.100, nebius CLI 0.12.312.

Covered by unit tests (services/msppostgresql/{domain,dal,api,backend/mock,backend/docker}, pkg/dockerhost), gosdk contract tests (test/contract/msp_postgresql_*), the Terraform and CLI e2e suites (test/terraform/msp, test/cli/msp, run by make e2e), and the Docker suite (test/msp plus the backend’s own e2e_msp test, make e2e-msp).

Resource kind Message NID prefix Parent Phases
Cluster msp.postgresql.v1alpha1.Cluster postgresql project PROVISIONING, RUNNING, UPDATING, STOPPING, RESUMING, DELETING (+ state)
Backup msp.postgresql.v1alpha1.Backup postgresqlbackup its source cluster (outlives it until retention) —

Behavior notes

Fields rejected as not emulated

INVALID_ARGUMENT naming the field: spec.backup.replication_regions and spec.backup.replication_interval (cross-region backup replication has nowhere to go locally).

Authorization

postgresql.clusters.{get,list,create,update,delete,stop,start} on the cluster or its project; GetForBackup needs get on the cluster; Restore needs create on the new cluster’s project. postgresql.backups.{get,list,create,delete} on the backup’s source cluster (List: on the project). Viewers read clusters and backups, editors change them. Backups of a deleted cluster stay readable: the cluster ID still resolves to its project for authorization.

Not yet

Terraform

Kind Terraform type Service RPCs called Tested
Resource nebius_msp_postgresql_v1alpha1_cluster nebius.msp.postgresql.v1alpha1.ClusterService Get, GetByName, Create, Update, Delete + OperationService.Get ✅ test/terraform/msp
Data source nebius_msp_postgresql_v1alpha1_cluster nebius.msp.postgresql.v1alpha1.ClusterService Get, GetByName ✅ test/terraform/msp

The suite runs under NEBIUS_MOCKER_AUTHZ=enforce: create, empty plan, in-place update (preset, hosts, disk, a parameter, pooler mode, password, public access), empty plan, replacements (description, db_name), both data sources, destroy, a viewer that cannot apply, and an invalid preset that fails apply.

CLI

nebius msp postgresql v1alpha1 cluster create|get|get-by-name|list|update|stop|start|restore|delete and backup create|list|list-by-cluster|delete work against the mock (test/cli/msp).

Configuration

Variable Default Meaning
NEBIUS_MOCKER_MSP_POSTGRESQL_BACKEND mock mock (no server) or docker (real PostgreSQL)
NEBIUS_MOCKER_MSP_POSTGRESQL_IMAGES 16=postgres:16.11-alpine version=image,…: the version catalog and the image per version
NEBIUS_MOCKER_MSP_PGBOUNCER_IMAGE edoburu/pgbouncer:v1.25.2-p0 The connection pooler image
NEBIUS_MOCKER_MSP_POSTGRESQL_PRESETS cpu-e2=2vcpu-8gb\|…\|80vcpu-320gb platform=preset\|…;… resources catalog
NEBIUS_MOCKER_MSP_POSTGRESQL_DISK_TYPES network-ssd Accepted disk types
NEBIUS_MOCKER_MSP_POSTGRESQL_MAX_HOSTS 3 Largest hosts.count
NEBIUS_MOCKER_MSP_POSTGRESQL_DISK_UNIT 1Gi Bytes one GiB of size_gibibytes holds, for disk-full enforcement only (8Mi: a 10 GiB disk holds 80 MiB). Validation stays 10-4096
NEBIUS_MOCKER_MSP_POSTGRESQL_DISK_CHECK_INTERVAL 1m How often the disk usage of running clusters is checked
NEBIUS_MOCKER_MSP_DOCKER_HOST, _BIND_IP, _ENDPOINT_HOST, _TLS_DIR, _START_TIMEOUT see configuration Shared with Managed MLflow

Docker backend: real PostgreSQL

With NEBIUS_MOCKER_MSP_POSTGRESQL_BACKEND=docker every cluster is real PostgreSQL from the official postgres image (arm64 and amd64), driven through the Docker Engine API (pkg/dockerhost):

Disk size

spec.config.template.disk.size_gibibytes is enforced by the docker backend, approximately. Nebius documents no full-disk behavior (only the dashboard metrics “Disk used space” and “Total service disk usage”), and the API has no disk-usage field, so what follows is the mock’s own design:

Connect as the docs show (docs.nebius.com/postgresql/databases/connect), with the mocker’s CA as the root certificate:

cp "$NEBIUS_MOCKER_MSP_TLS_DIR/ca.pem" ~/.postgresql/root.crt   # default: <user config dir>/nebius-mocker/ca
ep=$(nebius msp postgresql v1alpha1 cluster get-by-name --name pg --format jsonpath='{.status.connection_endpoints.private_read_write}')
psql "host=${ep%:*} port=${ep##*:} sslmode=verify-full dbname=app user=app"

API surface

nebius.msp.postgresql.v1alpha1.BackupService

Endpoint: postgresql.msp.api.nebius.cloud:443 · Proto: nebius/msp/postgresql/v1alpha1/backup_service.proto

RPC Request Response TF
Get GetBackupRequest Backup  
List ListBackupsRequest ListBackupsResponse  
ListByCluster ListBackupsByClusterRequest ListBackupsResponse  
Create CreateBackupRequest common.v1alpha1.Operation  
Delete DeleteBackupRequest common.v1alpha1.Operation  

nebius.msp.postgresql.v1alpha1.ClusterService

Endpoint: postgresql.msp.api.nebius.cloud:443 · Proto: nebius/msp/postgresql/v1alpha1/cluster_service.proto · used by Terraform

RPC Request Response TF
Get GetClusterRequest Cluster ✅
GetByName common.v1.GetByNameRequest Cluster ✅
GetForBackup GetClusterForBackupRequest Cluster  
List ListClustersRequest ListClustersResponse  
Create CreateClusterRequest common.v1alpha1.Operation ✅
Delete DeleteClusterRequest common.v1alpha1.Operation ✅
Update UpdateClusterRequest common.v1alpha1.Operation ✅
Restore RestoreClusterRequest common.v1alpha1.Operation  
Stop StopClusterRequest common.v1alpha1.Operation  
Start StartClusterRequest common.v1alpha1.Operation