英語原文: ROADMAP.md — canonical / 正本
本 ROADMAP は、検証可能な Gate と sub-task チェックリストで進捗を追跡します — 日付コミットメントではありません。プロジェクトの定義は MIT-licensed PostgreSQL Kubernetes Operator です。外部 PostgreSQL operator ランタイムを fork / embed / wrap せずに production-grade な運用品質を目指します。
| マーカー | 意味 |
|---|---|
[x] |
コード および テストが存在。e2e または unit テストで回帰を防止。 |
[~] |
部分実装 — 例: CRD フィールドのみ、ヘルパー未接続、または e2e なし。 |
[ ] |
未着手 (設計または PoC のみ)。 |
各 sub-task の Verify 行は検証コマンドまたは e2e ファイルを引用します。
- 外部システムは本製品に同梱しない — 外部 PostgreSQL operator、sharding extension、HA agent ランタイム、サードパーティ DB バックエンドは runtime artifact から除外。
- 新規サービスとして実装 — operator manager、instance manager、sharding メタデータ、router、backup orchestration は本リポジトリ内に permissive-license-compatibleライセンスで実装。
- 品質基準 — HA / backup / restore / upgrade / observability / security UX の 目標水準 は、特定のサードパーティ製品に依存せず約束します。
| 項目 | 状態 | Evidence |
|---|---|---|
| プロジェクト / chart 名 | postgres-operator |
GitHub repo、Helm chart、GitOps path 全部整合 |
| ライセンス | MIT | LICENSE, ADR-0003 |
| 最新リリース | 0.4.0-beta.1 |
GHCR イメージ + Helm chart publish + OLM bundle — Level 4 Deep Insights |
| OLM bundle | bundle/manifests/ が 8 CRD + alm-examples + CSV description と整合 |
operator-sdk bundle validate --select-optional suite=operatorframework clean (T26) |
| 宣言的 DB サーフェス | Pooler / PostgresDatabase / PostgresUser / ScheduledBackup / ImageCatalog / ClusterImageCatalog / externalClusters / replica cluster | T22 / T24 / T25 サイクル完了。live kind smoke 自動化 (T27) 進行中 |
| ローカル 4-layer ゲート | L1 lefthook pre-commit + L2 pre-push + L3 make validate/audit + L4 PR evidence | ADR-0009 / RFC-0002。version-drift assertion と bundle validate を自動化 (T26) |
| 本番デプロイ | Day-0 single-shard | PostgresCluster/postgres Ready |
| GHCR runtime image | 公開 pull 可能 | ghcr.io/keiailab/pg:18 が pull secret なしで restart |
| HA replicas | Partial (Replicas フィールドのみ) |
api/v1alpha1/postgrescluster_types.go |
| Backup / restore | 部分実装 | BackupJob phase transitions + ScheduledBackup CRD/controller + RestorePIT call path + pgBackRest command-runner plugin + K8s sidecar exec path。実際の restore drill は pending。 |
| 1.0.0 GA | 未達 | HA / backup / chaos / soak が依然必要 |
目標: ユーザーが GitOps で operator + single-shard Postgres クラスターをデプロイ可能。
- CRD
PostgresCluster定義 —api/v1alpha1/postgrescluster_types.go(RFC-0001 v2 schema)。 - CRD
BackupJob定義 (Phase 1 spec) —api/v1alpha1/backupjob_types.go。 -
PostgresClusterReconcilerが desired state を構築 (ConfigMap / headless Service / StatefulSet) —internal/controller/postgrescluster_controller.go。 - Status phase transition (Provisioning → Ready) —
internal/controller/status.go、aggregate_status.go。 - Pod readiness トラッキング — reconciler endpoint watch。
- ArgoCD
Synced/Healthy— 本番で検証 (platform-data-postgres-operator)。 - GHCR 公開 pull —
ghcr.io/keiailab/pg:18が pull secret なしで restart。 - Day-0 e2e —
test/e2e/e2e_test.go、postgrescluster_e2e_test.go。 - Verify: ArgoCD
Synced/Healthy+ Pod1/1Running +psql -c 'select version()'。
目標: HA を備えた single-PostgreSQL production データベースとして利用可能。
-
Replicasフィールド (0〜15 async replica) —postgrescluster_types.go。 - STS scale マッピング — reconciler。
- Primary-delete e2e baseline —
test/e2e/failover_e2e_test.go。 - 自動 PDB 生成 —
internal/controller/pdb.go。 - [~] PVC fencing (split-brain fail-fast) — fencing skeleton のみ。runbook automation pending。
- 自動 failover ロジック — 新規ディレクトリ
internal/controller/failover/。- Primary 障害検知 —
internal/controller/failover/detection.go(DetectPrimaryFailure+SelectPromotionCandidate、純粋関数、4 種類のFailureReasonenum、9 unit test、PR #38)。 - Standby 昇格 (
pg_ctl promoteまたは logical-replication 昇格) —internal/controller/failover/promotion.go(BuildPromotionPlan+Promoterインタフェース +PromoteFromDecisionhelper、4-step plan: RemoveStandbySignal / PgCtlPromote / WaitNotInRecovery / UpdateInstanceRole。6 unit test、PR #39)。internal/controller/failover_promoter.goが replica Pod のpostgresコンテナへの exec と昇格後のinstance-statusannotation patch を実装。 - Post-Ready primary-failure status 可視化 —
status.phase=Degraded+FailoverReady=False+ promotion-candidate メッセージ。 - Replica rejoin (
pg_basebackupまたはpg_rewind) — first-bootpg_basebackup+ 既存 PGDATA old-primary marker 一般化 + 現 primary endpoint main env +pg_rewindcommand-runner + HBA normal-connection auth + freshpg_basebackupfallback すべて完了。Live A.1 basebackup drill PASS (T31, 2026-05-17, commits 09abbb5/dca3fa0):quickstart-shard-0-1standby PVC delete + in-pod PGDATA wipe + Pod kill → reconciler init container が freshpg_basebackupを実行 →pg_stat_replication{application_name=quickstart-shard-0-1, state=streaming, sync_state=async, lag=0}回復。STS PVC retentionRetain回避 path までの evidence。A.2 pg_rewind live drill は別 task (SMOKE_FAILOVER operator-driven promotion live trigger 回帰 —docs/g1-ha-election-fact-fix領域に委任)。 - Synchronous replication —
spec.postgresql.synchronous.{method,number,dataDurability}+ CELnumber<=shards.replicas+ANY/FIRST N (...)rendering +required/preferredquorum policy + standbyapplication_namewiring + ConfigMap-hash rolling reconcile すべて完了。Live B.1〜B.3 RPO=0 drill PASS (T31, 2026-05-17, commit dca3fa0):synchronous_standby_names='ANY 1 ("quickstart-shard-0-1","quickstart-shard-0-0")'適用 →sync/quorum replica count=1→ 1000-row commit 後のcommit_lsn=0/3DA43A0 / flush_lsn=0/3DA43A0(pg_wal_lsn_diff=0) → RPO=0 を直接証明。drill 関数:hack/smoke.sh::drill_sync(SMOKE_SYNC=1)。B.4 sync standby kill シナリオは opt-in (SMOKE_SYNC_KILL=1)。 - [~] HA election 分散ロック (K8s Lease) —
internal/controller/failover/lease.go(FailoverLeaseName+LeaseConfig+NewLease/Run/IsLeader、§2 Simplicity に従いinternal/instance/election.Realの薄い adapter。fake clientset で single-leader + handoff を検証する 2 unit test)。Live e2e multi-replica failover drill は cluster mesh restore 後 pending。
- Primary 障害検知 —
- Backup / restore コントローラ実装 —
internal/controller/backupjob_controller.goを強化。-
BackupJob.Phasetransition (Pending → Running → Succeeded/Failed) —internal/controller/backupjob_controller.goreconcile switch + 8 unit test。 -
ScheduledBackupCRD / controller — 6 フィールド cron schedule → atomicBackupJob生成。suspend/immediate/ownerReference/concurrencyガード。5 unit test。 -
BackupJob.spec.type=restore→BackupPlugin.RestorePIT(targetTime)call path + 必須targetTimevalidation。 -
BackupJob.spec.executionMode=job→ ownedbatch/v1.Job生成 + observe。jobTemplate標準 env injection。 - [~] Plugin 呼び出し — pgBackRest command-runner + sidecar コマンド計画完了。WAL-G / Barman pending。
- Sidecar mode 分岐 — pgBackRest argv を K8s
pods/exec経由で ready primary Pod のpostgresコンテナへ送信。
-
- [~] PITR restore —
BackupRestoreSpec.TargetTime駆動の pgBackRestrestore --type=time --target=...call path + sidecar exec path 双方あり。実際の restore + checksum drill は pending。 - Upgrade rollback runbook —
docs/runbooks/upgrade.md(stub: pre-upgrade チェック + ImageCatalog 手順 + rollback) (PR #54)。 - RTO / RPO 測定 + 記録 —
docs/runbooks/ha.md(SLO RTO≤60s + RPO=0 + verify 手順) (PR #54)。 - Verify: primary 削除後 N 秒以内に replica 昇格 +
pg_is_in_recovery()=false+ データ損失 0。fresh-cluster restore 後にデータ checksum が一致。
目標: production-grade な運用サーフェスをカバー。
-
/metricsbaseline 公開 (port 8443) —internal/controller/metrics.go、cmd/main.go。 - TLS path セットアップ (certificate mount +
ssl=on) —internal/controller/builders.go:renderPostgresConf()、tls.go。 - Topology spread 統合 —
internal/controller/topology_spread.go。 - PVC online resize —
internal/controller/pvc_resize.go。 - Cascade-delete ガード —
internal/controller/cascade_delete_test.go。 - [~] cert-manager 統合 — mount path のみ。発行メカニズムは TBD。
- [~] 自動 PrometheusRule 生成 — Helm metrics Service / ServiceMonitor / PrometheusRule rendering + 実
postgres_operator_backupjob_phaseメトリクスによる BackupJob failure alert。- Replication-lag 警告 — instance status
LagBytes→postgres_operator_postgrescluster_replication_lag_bytes+ HelmPostgresReplicationLagHigh。 - Pooler failure / saturation 警告 —
postgres_operator_pooler_phase{phase="Failed"}+ PgBouncer exporter メトリクス駆動の collection-failure / client-waiting / max-wait alert rendering 検証。 - ディスク逼迫 —
kubelet_volume_stats_*data-PVC alert。 - Backup 失敗 —
postgres_operator_backupjob_phase{phase="Failed"}。
- Replication-lag 警告 — instance status
- [~] Grafana ダッシュボード — Helm ダッシュボード ConfigMap rendering 完了 (
postgres-operator-cluster-overview.json、postgres-operator-pooler.json)。live Grafana import / panel 検証は pending。 - [~] Connection pooler (PgBouncer) —
PoolerCRD + ConfigMap / Deployment / Service reconcile (first slice)。- CRD
Pooler.spec.{cluster, instances, type, pgbouncer.poolMode, pgbouncer.parameters}追加。 - 分離された PgBouncer Deployment / Service / ConfigMap 生成 +
userlist.txtSecret fail-closed validation。 - デフォルト PgBouncer readiness / liveness / startup probe + exporter
/metricsreadiness / liveness probe。 - PgBouncer パラメータ allowlist + operator-owned-key fail-closed validation。
-
instances > 1時に自動 topology spread + PodDisruptionBudget。 - より強い rolling-update デフォルト —
maxUnavailable=0、maxSurge=1、minReadySeconds=5。 - Pooler parity サーフェス —
deploymentStrategy、serviceAccountName、statusbackendTargets/configHash。 -
pg_hba→ PgBouncerpg_hba.confrendering + operator-owned validation ofauth_type=hba/auth_hba_file。 - ユーザー提供 server / client TLS Secret rendering + Secret/key fail-closed validation。
-
type=rofull ready-replica host-list rendering +server_round_robin=1+server_login_retry=2デフォルト。 - [~] PgBouncer exporter — 明示的 sidecar +
metricsServicePort + PodMonitor selector ラベル/サンプル + PgBouncer メトリクスプレフィックスでの PrometheusRule alert render 検証。live Prometheus scrape / Grafana 検証は pending。 - Built-in auth ユーザー自動化 (T27 ⑤) —
authSecretRefが空のときkeiailab_pooler_pgbouncerLOGIN role +<pooler-name>-builtin-authSecret を自動プロビジョニング。 - Built-in auth パスワード rotation (T27 ⑥) —
postgres.keiailab.io/rotate-pooler-password=trueannotation で in-placeALTER ROLE+ Secret update + status timestamp を trigger。ConfigHash が userlist を含み自動リロード。 - Built-in TLS 自動発行 (T29)。
- Paused PAUSE/RESUME reconciliation —
spec.paused→ PgBouncerSIGUSR1/SIGUSR2、status.paused、Pod annotation audit。 - Pooler Service
psqlsmoke — 2026-05-12 に kind 上でSMOKE_POOLER=1 ./hack/smoke.sh --keepが通過 (quickstart+ Pooler ServiceSELECT 1 = 1、PAUSE がタイムアウトで新規クライアントをブロック、RESUME がSELECT 1 = 1を再有効化、Deployment2/2)。 - In-place PgBouncer config reload —
pgbouncer.parametersの patch が ConfigMapconfig.sha256projection を待機 → ready Pod にSIGHUPを送信 → Pod hash annotation を audit しつつ Deployment generation と Pod 名を保存。
- CRD
- User / DB / RBAC 宣言的。
- [~] CRD
PostgresDatabase—spec.cluster/name/owner/ensure/tablespace/extensions/schemas/fdws/servers/privileges+ ready-primarypsqlreconcile +status.applied+databaseReclaimPolicy=deletefinalizer + database/schema privilege grant/revoke 実装済み。Live smoke / retain-policy 検証は pending。 - [~] CRD
PostgresUser—spec.cluster/name/ensure/login/superuser/createdb/createrole/replication/bypassrls/inherit/connectionLimit/inRoles/passwordSecretRef/disablePassword/validUntil+ ready-primarypsqlreconcile +status.applied/passwordSecretResourceVersion実装済み。membershipREVOKE+ password Secret username 一致 +disablePasswordfail-closed + 参照 Secret の更新 watch +PostgresCluster.status.managedRolesStatus集約済み。Live smoke + password-rotation SQL round-trip は pending。 - [~] Role/permission reconcile —
PostgresUserrole flag + membershipGRANT/REVOKE+ cluster-level managed-role status (first slice) 完了。データベースオブジェクト privilege モデルは pending。
- [~] CRD
- Upgrade smoke —
test/e2e/version_upgrade_e2e_test.goを拡張 (skeleton はすでに存在)。 - Security デフォルト強化 — restricted PSA、NetworkPolicy デフォルト on。
- [~] ImageCatalog / ClusterImageCatalog — CRD +
spec.imageCatalogRef.{apiGroup,kind,name,major}+ catalog 画像 → StatefulSet init/main コンテナ画像 + image-hash annotation rollout-drift 追跡 + catalog watch / envtest 完了。Extension-image volume mount、公式 digest catalog 供給、live rollout 計測は pending。 - [~] Replica cluster / externalClusters —
externalClusters[].connectionParameters+password+sslKey/sslCert/sslRootCert+bootstrap.pg_basebackup.source+replica.enabled/source表面、streaming standalone replica bootstrap、ordinal-0 外部pg_basebackup、standby.signal/primary_conninfo、password passfile + TLS client/root cert conninfo、persistent-follower election (local promotion をブロック)、fail-closed status すべて検証済み。WAL-archive / object-store ハイブリッド、distributed-topology demotion/promotion-token、live cross-cluster drill は pending。 - [~] 宣言的 hibernation —
postgres.keiailab.io/hibernation=on/offannotation、shard StatefulSet/PVC-template 保持 +replicas=0、native routerreplicas=0、status.phase=Hibernated、hibernation condition をすべて envtest で検証。SMOKE_HIBERNATION=1パスは PVC-marker-row 保持と rehydration SQL round-trip drill も実行。live kind 検証は pending。 - [~] Release smoke test —
scripts/release-smoke-test.sh6-stage (GH Release tag + GHCR manifest + GH Pages + helm index + helm pull/template + trivy post-publish scan)。path 修正 (hack/→scripts/)。 - Verify: PrometheusRule / Grafana ダッシュボード rendering、Pooler Service 経由の
psqlアクセス、live PgBouncer exporter scrape、upgrade rolling restart の成功。
目標: 外部 sharding ランタイムなしで sharding メタデータを自前実装。
-
ShardingModeフィールド (none/native) —postgrescluster_types.go。Constants + Spec round-trip をTestShardingModeがガード (api/v1alpha1/postgrescluster_types_test.go)。enum validation は+kubebuilder:validation:Enum=none;nativeマーカーで apiserver にて強制。RFC 0001 §3.1 / RFC 0002。 -
ShardsSpec(初期 shard 数 / replica / storage) —postgrescluster_types.go。フィールド round-trip +DeepCopyスライス独立性 +Replicas=0(HA-off dev) をTestShardsSpecがガード (api/v1alpha1/postgrescluster_types_test.go)。RFC 0001 §3.1。 - Sharding plugin interface —
internal/plugin/sharding/api.go。コンパイル時 interface freeze +Registryregister/get/Names round-trip +Capabilities広告 +ErrUnsupportedsentinel をTestShardingPluginumbrella がガード (internal/plugin/sharding/api_test.go)。RFC 0001〜0005 / RFC 0004 (router アーキテクチャ)。 -
ShardRangeCRD —api/v1alpha1/shardrange_types.go+config/crd/bases/postgres.keiailab.io_shardranges.yaml(RFC 0002、offline yaml parse PASS、make manifests通過)。- [~] Hash-range / list / range ポリシー分岐 (vindex enum 定義完了、reconciler 未実装 — 後続 sub-task)。
- メタデータストア (Postgres システムカタログまたは sidecar)。
-
pg-routerservice PoC — 新規cmd/pg-router/。- SQL parser (libpg_query または homegrown)。
- Shard-placement lookup。
- Connection routing (libpq passthrough)。
- 手動 shard placement —
ShardRange.Spec.PlacementHints。 - GitOps drift guard — sharding メタデータと実際の placement の乖離検知。
- Verify: 2-shard クラスターでの
pg-router経由クエリが正しい shard にルーティングされる。
目標: データ損失なしの split / rebalance。
-
ShardSplitJobCRD — 新規api/v1alpha1/shardsplitjob_types.go。 - 7-step e2e シナリオ。
- 1. Snapshot + WAL キャプチャ。
- 2. ターゲット shard の bootstrap。
- 3. Initial copy。
- 4. CDC catch-up。
- 5. Cutover (最小 write-block window)。
- 6. Routing 更新。
- 7. Source cleanup。
- Cutover rollback / forward-only 検証。
- Verify: split 中のデータ整合性 (checksum) + cutover-window 計測 + rollback 実行可能性。
目標: cross-shard クエリ / トランザクションの対応範囲を明確化。
- [~] Scatter-gather クエリパス — skeleton (
internal/router/scatter.go+ErrNotImplementedsentinel、Executor interface freeze)。実 wire-protocol forwarding + merge は P3+。Ref: RFC-0004 §2.2 Scenario 2 + ADR-0015。 - [~] 2PC / saga 分散トランザクションの選択 — ADR-0015 決定 (2PC primary + saga deferred) +
internal/tx/skeleton。実装は D.2.2 Lease election 統合後。 - Isolation matrix ドキュメント化 — どの isolation level がどの条件で保持されるか。Evidence:
docs/sql/isolation-matrix.md(D.10.3)。 - [~] ベンチマーク — sysbench / pgbench バリアント (
test/bench/pgbench.sh+sysbench.sh+docs/perf/baseline.mdskeleton。live 計測は pending)。 - Verify: isolation level 別の anomaly / no-anomaly 表 + ベンチマーク値。
目標: 商用グレードの品質。
- e2e baseline —
test/e2e/。 - Long-running soak — ≥ 7 日、ダウンタイム 0。(NON-GOAL single session) (NON-GOAL for single session — 7-day wall clock required)
- Chaos engineering — pod kill / network partition / disk pressure。(multi-day drill) (multi-day chaos drill required)
- Restore rehearsal — 周期的な自動 backup-restore + 検証。(monthly cron drill — out of single session)
- Upgrade matrix — N → N+1 / N → N+2 / minor patches。(G2 D.6.3 依存 — substantial e2e)
- SBOM + signing — SPDX SBOM + cosign 署名。
- Docs / runbook 完備。
- HA / backup / restore / upgrade / security / migration runbook。
- Verify: 7 日 soak 通過 + N 種類の chaos シナリオ通過 + SBOM 添付 + すべての runbook 存在。
- ❌ 外部 PostgreSQL operator の再パッケージングまたは fork。
- ❌ 外部 sharding extension を first-class built-in として採用 (runtime 依存ではない)。
- ❌ 汎用 Plugin SDK 製品ストーリー (v0.x archive から retired)。
- ❌ 必須リリースゲートとしての GitHub Actions — RFC 0002 (org-wide) 参照。ローカル 4-layer ゲートに委任。
- ❌ 日付ベースのロードマップ締切 — org-wide
workflow.md参照。 - ❌ 未検証の HA / backup 機能を
production-readyとしてマーケティング。
| 日付 | 変更 |
|---|---|
| 2026-05-16 | G3 §Sharding foundation: ShardingMode / ShardsSpec / Sharding plugin interface を unit-test カバレッジと共に [~] → [x] に flip (TestShardingMode、TestShardsSpec、TestShardingPlugin)。Plans 2026-05-14-4-operators-100pct/P-D §D.7。 |
| 2026-05-12 | Backup/restore のギャップ解消: ScheduledBackup CRD/controller、cron 発火時の BackupJob 生成、BackupJob.spec.type=restore → RestorePIT call path、executionMode=job runner Job ライフサイクル、pgBackRest command-runner plugin 登録、sidecar pod-exec path を追加。 |
| 2026-05-12 | Observability のギャップ解消: Helm metrics Service / ServiceMonitor / PrometheusRule + postgres_operator_backupjob_phase Prometheus メトリクスを追加。 |
| 2026-05-11 | G1 §Backup/Restore BackupJob.Phase transition (Pending → Running → Succeeded/Failed) 実装 + 8 unit test — [x] (ralph-loop iter#3)。 |
| 2026-05-11 | 全面書き直し — Gate-scoped sub-task チェックリスト、buffer 指標を導入し、date-style 表現を削除。 |
| 2026-05-07 | 0.3.0-alpha.3 をリリース、公開 GHCR pull に移行、レガシー staging operator を削除、"no embedded external systems" 原則を明文化。 |
© 2026 keiailab · MIT · keiailab.com