ที่จัดเก็บข้อมูลที่สำรองบนทุกเป้าหมายด้วยการแนบ core/backup เพียงรายการเดียว
ฐานcore/backup เพียง
core/backup ระบุ
พื้นที่
สิ่งที่ตัวอย่างนี้บิลด์
| อินสแตนซ์ | Component ของ | รัน |
|---|---|---|
db | core/datastore/postgres | Release ทุก |
backups | core/storage/s3-object-store | Releases ของ Kubernetes สอง |
velero | core/storage/velero | Release ของ Velero |
barman-cloud | core/storage/barman-cloud-plugin | Release ของ CloudNativePG |
Aggregate ประกาศbackup_controller ตัวactive: ของ
spec: parameters: [… omitted: the comment above the parameter] backup_controller: type: string default: none [… omitted: the parameter's description] components: [… omitted: the comment above each component] db: type: core/datastore/postgres
backups: type: core/storage/s3-object-store active: '{{ ne .parameters.backup_controller "none" }}' values: bucket: db-backups
velero: type: core/storage/velero active: '{{ eq .parameters.backup_controller "velero" }}'
barman-cloud: type: core/storage/barman-cloud-plugin active: '{{ eq .parameters.backup_controller "cloudnative-pg" }}'ส่วนfalse จะnone จึง
การแนบ
นักdb ไม่มีcore/backup ใน Release แต่ละfeatures ของstore ไป
components: db: annotations: aggrega.ai/namespace: orders [… omitted: the comment above the attachment] features: backup: type: core/backup infra: schedule: "30 2 * * *" retention_days: 14 uses: store: bucket: target: backupsReleases ของ AWS เขียนstore เพราะ RDS และ AWS Backup เก็บinfra.role_arn ซึ่ง
Releases หกรายการ
| Release | Manifest | core/backup ทำให้ | การ |
|---|---|---|---|
release-helm-velero.yaml | manifest-helm-velero.yaml | helm/backup-velero | เสร็จ |
release-helm-cloudnative-pg.yaml | manifest-helm-cloudnative-pg.yaml | helm/backup-cloudnative-pg | เสร็จ |
release-terraform.yaml | manifest-terraform.yaml | terraform/backup-native | เสร็จ |
release-cloudformation.yaml | manifest-cloudformation.yaml | cloudformation/backup-native | เสร็จ |
release-terraform-aws-backup.yaml | manifest-terraform-aws-backup.yaml | terraform/backup-aws-backup | เสร็จ |
release-compose.yaml | manifest-compose.yaml | ไม่ | หยุด |
Manifest เป็นhelm/postgres ซึ่งhelm/postgres-cloudnative-pg ซึ่งmanifest-terraform.yaml และ manifest-terraform-aws-backup.yaml แมปcore/backup ส่วน Releases ที่
Releases ของ Kubernetes ยังcore/referenced-secret ที่
ร่างตัวอย่าง
คุณ
เขียน
aggrega draft --example datastore-backupจาก
cd datastore-backupบิลด์
พื้นที่.aggrega-config.yaml ระบุ Velero และ
aggrega build --release release-helm-velero.yaml --auto-pull # one Releaseในaggrega draft --example ไม่มี ./check.sh บิลด์ Releases ทั้ง
RELEASE EXIT EXPECTED VERDICT----------------------------------------------------------------------------------------------------release-helm-velero.yaml 0 complete OK: completed, the backup the README showsrelease-helm-cloudnative-pg.yaml 0 complete OK: completed, the backup the README showsrelease-terraform.yaml 0 complete OK: completed, the backup the README showsrelease-cloudformation.yaml 0 complete OK: completed, the backup the README showsrelease-terraform-aws-backup.yaml 0 complete OK: completed, the backup the README showsrelease-compose.yaml 1 halt OK: halted with the expected refusal
check: every build ended as expected.กับผู้ช่วย AI
ผู้
ใช้เฉพาะเครื่องมือของ Aggrega และอย่าสร้างโฟลเดอร์เอง หากโฟลเดอร์พื้นที่ทำงานยังไม่มีโฟลเดอร์ `datastore-backup` เรียกเครื่องมือ `draft` หนึ่งครั้งโดยตั้ง `example` เป็น `datastore-backup` และไม่ระบุ `dir` เครื่องมือจะเขียนตัวอย่างลงในโฟลเดอร์ `datastore-backup` ใหม่ จากนั้นเรียกเครื่องมือ `build` โดยตั้ง `workspace_root` เป็น `datastore-backup` ตั้ง `release` เป็น `release-helm-velero.yaml` ตั้ง `auto_pull` เป็น true และตั้ง `write` เป็น true บอกฉันว่าการบิลด์เขียนไฟล์ใดบ้าง ไฟล์เหล่านั้นอยู่ใต้ `datastore-backup/dist/`Kubernetes กับ Velero
release-helm-velero.yaml เขียน StatefulSet และ Services ของ
apiVersion: velero.io/v1kind: BackupStorageLocationmetadata: [… omitted: the labels and annotations the build writes on every resource] name: "orders-db-backup" namespace: velerospec: provider: velero.io/aws objectStorage: bucket: "db-backups" prefix: "orders-db-backup" config: region: "us-east-1" s3Url: "http://backups-default.orders:8333" s3ForcePathStyle: "true"---apiVersion: velero.io/v1kind: Schedulemetadata: [… omitted: the labels and annotations, as on the storage location] name: "orders-db-backup" namespace: velerospec: schedule: "30 2 * * *" template: includedNamespaces: - "orders" orLabelSelectors: - matchLabels: "app": "db" storageLocation: "orders-db-backup" ttl: "336h0m0s" snapshotVolumes: false defaultVolumesToFsBackup: trueทั้งvelero ซึ่งbackups เผยus-east-1 14 วัน
Kubernetes กับ CloudNativePG
release-helm-cloudnative-pg.yaml เขียน
apiVersion: barmancloud.cnpg.io/v1kind: ObjectStoremetadata: [… omitted: the labels and annotations the build writes on every resource] name: "db-backup" namespace: "orders"spec: configuration: destinationPath: "s3://db-backups/orders/db-backup" endpointURL: "http://backups-default.orders:8333" s3Credentials: accessKeyId: name: "db-backup" key: "ACCESS_KEY_ID" secretAccessKey: name: "db-backup" key: "ACCESS_SECRET_KEY" retentionPolicy: "14d" instanceSidecarConfiguration: env: - name: "AWS_DEFAULT_REGION" value: "us-east-1"---apiVersion: postgresql.cnpg.io/v1kind: ScheduledBackupmetadata: [… omitted: the labels and annotations, as on the object store] name: "db-backup" namespace: "orders"spec: schedule: "0 30 2 * * *" cluster: name: "db" method: "plugin" pluginConfiguration: name: "barman-cloud.cloudnative-pg.io"ตาราง30 2 * * * ของ0 นำdb-backup ตั้งinfra.credentials_secret
Recipe ของ
[… omitted: apiVersion, kind and metadata]spec: [… omitted: the instance count, the image, the storage and the resources] plugins: - name: "barman-cloud.cloudnative-pg.io" isWALArchiver: true parameters: barmanObjectName: "db-backup" [… omitted: the bootstrap settings]write-ahead log จึง
Terraform
release-terraform.yaml เขียนterraform/backup-native ไม่
[… omitted: the provenance comment, the provider requirement, and the instance's engine, compute, storage, database and HA arguments] ## ── Backup ─────────────────────────────────────────────── backup_retention_period = 14 backup_window = "02:30-03:00"[… omitted: the subnet group and security groups, and the address output]RDS รับ30 2 * * * จึง
CloudFormation
release-cloudformation.yaml เขียน
[… omitted: the template's format version, the outputs carrying what the database publishes, and the opening of its resources] "Db": { [… omitted: the deletion policy and the provenance metadata] "Properties": { "AllocatedStorage": 10, "BackupRetentionPeriod": 14, "DBInstanceClass": "db.t3.small", [… omitted: the database name, the subnet group, the engine and the credentials settings] "MultiAZ": false, "Port": 5432, "PreferredBackupWindow": "02:30-03:00", [… omitted: the storage type and the security groups] }, "Type": "AWS::RDS::DBInstance" }[… omitted: the closing of the resources and of the template]AWS Backup
release-terraform-aws-backup.yaml บิลด์terraform/backup-aws-backup แทน การ
[… omitted: the provenance comment, the provider requirement, and the partition, Region and account lookups]resource "aws_backup_vault" "backup" { name = "db-backup"}
resource "aws_backup_plan" "backup" { name = "db-backup"
rule { rule_name = "db-backup" target_vault_name = aws_backup_vault.backup.name schedule = "cron(30 2 * * ? *)" start_window = 60
lifecycle { delete_after = 14 } }}
resource "aws_backup_selection" "backup" { name = "db-backup" plan_id = aws_backup_plan.backup.id iam_role_arn = "arn:aws:iam::123456789012:role/example-backup"
resources = [ "arn:${data.aws_partition.current.partition}:rds:${data.aws_region.current.region}:${data.aws_caller_identity.current.account_id}:db:db", ]}ตาราง
อินสแตนซ์
[… omitted: the provenance comment, the provider requirement, and the instance's engine, compute, storage, database and HA arguments] ## ── Backup ─────────────────────────────────────────────── backup_retention_period = 7[… omitted: the subnet group and security groups, and the address output]infra.keep_automated_backups: false บน
สิ่งที่การบิลด์ไม่ทำ
การ
- ตาราง
เวลา ของ Velero รัน เฉพาะ ที่ ที่ Velero ถูก ปรับ ใช้ และ การ สำรอง ของ ปลั๊กอิน รัน เฉพาะ ที่ ที่ ปลั๊กอิน Operator ของ CloudNativePG (เวอร์ชัน 1.26 ขึ้น ไป) และ cert-manager รัน อยู่ พื้นที่ ทำงาน นี้ ปรับ ใช้ Velero และ ปลั๊กอิน ส่วน Operator และ cert-manager สันนิษฐาน ว่า มี อยู่ แล้ว - Secrets ที่ Releases ของ Kubernetes ระบุ
เป็น สิ่ง ที่ คลัสเตอร์ ต้อง เก็บ ไว้ เอง ใน เนมสเปซ ที่ แต่ละ รายการ ถูก อ่าน ได้แก่ backup-store-access-key-idและbackup-store-secret-access-keyข้างบัคเก็ต velero-cloud-credentialsในveleroซึ่งเก็บ ไฟล์ ข้อมูล รับรอง ที่ ใช้ ร่วม กัน ของ AWS และ db-backupข้างฐาน ข้อมูล ซึ่ง เก็บ คู่ คีย์ ภาย ใต้ ACCESS_KEY_IDและACCESS_SECRET_KEYการบิลด์ ไม่ เรนเดอร์ รายการ ใด เลย
Release ที่หยุด
release-compose.yaml แนบcore/backup เป็นmanifest-compose.yaml จึงaggrega build --release release-compose.yaml --auto-pull หยุด
[… omitted: what resolving the lockfile prints, the same halt among it][OPS_ERROR E0099] recipe resolution caused by (1): no recipe resolved for component/feature instance: add an explicit Manifest mapping for its type: feature "backup" (type "core/backup"); no feature recipe the lockfile pins implements core/backup:1.0.0 for capability "compose", the capability its component's Recipe binds to; with no catalog directory, the feature recipes searched are only those the lockfile pins, not a registry's; pin one a registry publishes in the Manifest, where one for another capability renders as its own output beside the component's, or write one for "compose", then map the type to itพื้นที่core/backup ก็core/backup:1.0.0 สำหรับ compose และcloudformation/backup-aws-backup, cloudformation/backup-native, helm/backup-cloudnative-pg, helm/backup-k8up, helm/backup-kasten, helm/backup-kubestash, helm/backup-mariadb-operator, helm/backup-velero, terraform/backup-aws-backup และ terraform/backup-native
แค็ตตาล็อกcore/backup บน