# Tuned clone: parallelism, same-table splitting, filtering, a re-runnable
# target, runner placement, and lifecycle knobs. Filters render to pgcopydb's
# --filters INI; table names follow PostgreSQL quoting, ~/regex/ works.
apiVersion: pgcopydb-operator.io/v1beta1
kind: Migration
metadata:
  name: clone-tuned
spec:
  source:
    host: warehouse.example.com
    database: warehouse
    username: migrator
    passwordSecretRef: {name: warehouse-source, key: password}
  target:
    host: warehouse-pg-rw.warehouse.svc
    database: warehouse
    username: app
    passwordSecretRef: {name: warehouse-pg-app, key: password}
  clone:
    tableJobs: 8
    indexJobs: 8
    splitTablesLargerThan: 2Gi  # tables above this copy in parallel parts
    skip: [largeObjects]        # no large objects in this database
    dropIfExists: true          # re-runnable onto a populated target
    filters:
      excludeSchemas: ["audit", "scratch"]
      excludeTableData: ["public.event_log"]  # schema yes, rows no
  workVolume:
    size: 50Gi  # holds dumps and catalogs; size it near the database size
  runner:
    nodeSelector: {workload: batch}  # keep the copy off latency-sensitive nodes
    resources:
      requests: {cpu: "2", memory: 4Gi}
  backoffLimit: 5
  ttlSecondsAfterFinished: 86400  # keep finished Jobs a day for log reading
