MySQL — Aggregate เดียว สองเป้าหมาย
ตัวอย่างAggregate ที่
- Kubernetes ผ่าน
การ สังเคราะห์ Workload ของ ผู้ ให้ บริการ helm (StatefulSet ที่ เรนเดอร์ ตรง บน อิมเมจ mysqlทางการ ไม่มี chart ภายนอก) และ - Docker Compose สำหรับ
การ พัฒนา ภายใน เครื่อง
เจตนา
ไฟล์
| ไฟล์ | บทบาท |
|---|---|
aggregate-helm-synth.yaml | เจตนาdb หนึ่งcore/datastore/mysql ค่าroot_password ที่ |
aggregate-helm-synth-auth.yaml | เจตนาroot_password และ user_password |
manifest-helm-synth.yaml | แมปhelm/mysql) และenv-secret, k8s-secret-from-parameter) |
release-helm-synth.yaml | บันทึกengine_version, storage) |
release-helm-synth-auth.yaml | บันทึก |
aggregate.yaml | เจตนาdb เดียวกัน |
manifest-compose.yaml | แมปmysql) และdotenv-secret |
release-compose.yaml | บันทึกinfra.overrides เฉพาะ |
สิ่งที่ตัวอย่างนี้แสดง
- พื้น
ผิว Aggregate คือการ เขียน เดียว หลาย เป้า หมาย แหล่ง อะไร Manifest แต่ละความ จริง ว่า สแตก เป็น รายการ อย่างไรบอก ว่า จะ ทำให้ เป็น รูป ธรรม - การ
สังเคราะห์ Workload บน Kubernetes (แนะนำ) Recipehelm/mysqlประกาศWorkloadที่ไม่ ขึ้น กับ ความ สามารถ ด้วย form: statefulผู้ให้ StatefulSet ClusterIP Service headless Service (ตัวบริการ helm สังเคราะห์ ตน volumeClaimTemplate สำหรับเครือข่าย ที่ คงที่ ของ StatefulSet) และ ไดเรกทอรี ข้อมูล สภาพ แวดล้อม ของ คอนเทนเนอร์ มี MYSQL_DATABASE,MYSQL_USER,MYSQL_ROOT_PASSWORDและMYSQL_PASSWORDชุดอักขระ และ collation ถูก นำ ไป ใช้ เป็น อาร์กิวเมนต์ บรรทัด คำ สั่ง ของ เซิร์ฟเวอร์ mysqld(--character-set-server,--collation-server) เพราะอิมเมจ mysqlทางการรับ ค่า เหล่า นี้ เป็น แฟล็ก ของ เซิร์ฟเวอร์ ไม่ใช่ ตัวแปร สภาพ แวดล้อม - การ
สังเคราะห์ Workload บน Compose Recipe ของ Compose ประกาศWorkloadที่ไม่ ขึ้น กับ ความ สามารถ ผู้ ให้ บริการ compose สังเคราะห์ บริการ docker-compose.yamlที่มี อิมเมจ MySQL สภาพ แวดล้อม วอลุ่ม ข้อมูล ที่ มีชื่อ และ การ ตรวจ สอบ สุขภาพ - ทางออก
ฉุกเฉิน Release ของ Compose ตั้งของ ผู้ ดำเนิน การ infra.overrides.imageซึ่งเป็น การเสา หลัก แบบ เปิด สำหรับ ข้อ เท็จ จริง เฉพาะ ผู้ ให้ บริการ ที่ สคีมา ของ Component เอง ไม่ ระบุ และ บริการ ที่ เรนเดอร์ รัน การ อ้างอิง อิมเมจ ตาม ที่ ระบุ แน่ชัด นั้น ดู แทนที่ เฉพาะ Provider - โมเดล
ข้อมูล รหัสรับรอง สอง สล็อต ผ่าน เป็นการ แนบ บน เสา หลัก features:ของส่วน ประกอบ โดย แต่ละ รายการ เป็น Feature ที่ ติด ป้าย กำกับ feature.aggrega.ai/kind: secretแยกจาก valuesของแอปพลิเคชัน featuresSchemaของ Component ประกาศสล็อต root_passwordแบบ Black-Box และสล็อต user_passwordแบบโปร่งใส
การส่งมอบข้อมูลรับรองบน Kubernetes
root_password เป็นinject: []) Recipe ควบคุม.context.inject.env.MYSQL_ROOT_PASSWORD แล้ว
user_password เป็นinject: [env, file]) แบบcontainers.attachments ซึ่งsecretKeyRef ของ env Secret ที่.features.user_password.provides.name การuser_password ไว้MYSQL_PASSWORD: apppass) และ
ร่างตัวอย่าง
คุณ
เขียน
aggrega draft --example mysql-standaloneจาก
cd mysql-standaloneบิลด์
พื้นที่.aggrega-config.yaml เอนทิตีhub.aggrega.ai และ--auto-pull เขียน
# Kubernetes — synthesized helm StatefulSet (base: root credential only)aggrega build --release release-helm-synth.yaml --auto-pull
# Kubernetes — synthesized helm StatefulSet (full: both credential slots)aggrega build --release release-helm-synth-auth.yaml --auto-pull
# Local development (Docker Compose)aggrega build --release release-compose.yaml --auto-pullอาร์ติแฟกต์dist/
กับผู้ช่วย AI
ผู้
ใช้เครื่องมือของ Aggrega เท่านั้น และอย่าสร้างโฟลเดอร์เอง หากโฟลเดอร์ Workspace ยังไม่มีโฟลเดอร์ `mysql-standalone` เรียกเครื่องมือ `draft` หนึ่งครั้งโดยตั้ง `example` เป็น `mysql-standalone` และไม่ระบุ `dir`: เครื่องมือจะเขียนตัวอย่างลงในโฟลเดอร์ `mysql-standalone` ใหม่ จากนั้นเรียกเครื่องมือ `build` หนึ่งครั้งต่อ Release แต่ละรายการตามลำดับนี้ — `release-helm-synth.yaml`, `release-helm-synth-auth.yaml` และ `release-compose.yaml` — โดยแต่ละครั้งตั้ง `workspace_root` เป็น `mysql-standalone` ตั้ง `release` เป็นไฟล์นั้น ตั้ง `auto_pull` เป็น true และตั้ง `write` เป็น true บอกฉันว่าแต่ละบิลด์เขียนไฟล์ใดบ้าง ไฟล์เหล่านั้นอยู่ใต้ `mysql-standalone/dist/`การกำหนดขนาดโดยผู้ดำเนินการ
Releases ของ Kubernetes เติมinfra.engine_version (mysql:8.4) และinfra.storage Aggregate ของ
การแทนที่เฉพาะ Provider
เสาengine_version และ storage ดังinfra.overrides คือ
release-compose.yaml ใช้image และengine_version:
infra: engine_version: "8.4" overrides: image: "registry.internal.example/library/mysql:8.4"บริการ
services: db: image: registry.internal.example/library/mysql:8.4 [… omitted: the service's environment, labels, volume, network and health check]นี่image และ Recipe ที่