Memcached — Aggregate เดียว สองเป้าหมาย และรหัสผ่านที่ถูกปฏิเสธ
ตัวอย่างAggregate หนึ่ง
- Docker Compose สำหรับ
การ พัฒนา ภายใน เครื่อง และ - Recipe แบบ helm ที่
สังเคราะห์ ที่ขึ้น รัน อิมเมจ ต้นทาง ทางการ memcachedโดยตรงบน Kubernetes (ไม่มี chart ภายนอก)
Recipe แบบ helm ที่
aggregate.yaml ไฟล์
ไฟล์
| ไฟล์ | บทบาท |
|---|---|
aggregate.yaml | เจตนาcache หนึ่งcore/datastore/memcached ไม่มี |
aggregate-auth.yaml | แคชpassword ที่ |
aggregate-helm-synth-auth.yaml | แคช |
manifest-compose.yaml | แมปcompose/memcached) และdotenv-secret |
manifest-helm-synth.yaml | แมปhelm/memcached) และk8s-secret-from-parameter |
release-compose.yaml / release-helm-synth.yaml | บันทึก |
release-negative-compose-auth.yaml / release-negative-helm-synth-auth.yaml | บันทึก |
สิ่งที่ตัวอย่างนี้แสดง
- พื้น
ผิว Aggregate เดียวการ เขียน เดียว หลาย เป้า หมาย เป็น คือแหล่ง ความ จริง ว่า สแตก อะไร Manifest แต่ละรายการ อย่างไรบอก ว่า จะ ทำให้ เป็น รูป ธรรม - ที่
จัด Memcached เก็บเก็บ ข้อมูล แบบ ไม่มี สถานะ รายการ ไว้ ใน หน่วย ความ จำ และ ไม่ จัด เก็บ สิ่ง ใด อย่าง คงทน ส่วน ประกอบ จึง มี ชนิด เป็น serverธรรมดา ไม่ใช่stateful-serverบน Kubernetes Recipe เรนเดอร์ Deployment ไม่ใช่ StatefulSet และไม่ ขอ วอลุ่ม ถาวร บน Compose บริการ ไม่ ประกาศ วอลุ่ม ข้อมูล - การ
สังเคราะห์ Workload (Kubernetes) Recipe แบบ helm ที่สังเคราะห์ ขึ้น ประกาศ Workload — Deployment พร้อม Service ประเภท ClusterIP ที่ รัน อิมเมจ ทางการ memcached— ที่ผู้ ให้ บริการ helm แปลง เป็น แมนิเฟสต์ Kubernetes โดย ไม่มี chart ภายนอก ชุด ทรัพยากร ที่ เรนเดอร์ คือ สิ่ง ที่ Workload ประกาศ พอดี เนื่องจาก ทั้ง Recipe ของ Compose และ Recipe แบบ helm ที่ สังเคราะห์ ขึ้น ใช้ ชื่อ memcachedเหมือนกัน Manifests จึง อ้างอิง ด้วย ตัว กำกับ ผู้ ให้ บริการ เป็น compose/memcachedและhelm/memcached - การ
ป้องกัน ส่วนที่ การ ทำให้ เป็น รูป ธรรม ให้ ไม่ ได้ จะ ถูก ปฏิเสธ ไม่ใช่ ละทิ้ง ประกอบ ประกาศ สล็อต passwordที่ไม่ บังคับ อิมเมจ memcachedไม่บังคับ ใช้ รหัส ผ่าน ใด เลย: โหมด การ ยืนยัน ตัว ตน สอง แบบ ของ มัน คือ SASL ซึ่ง พูด ผ่าน โปรโตคอล ไบนารี เท่านั้น และ ไฟล์ ยืนยัน ตัว ตน แบบ ASCII และ ไคลเอนต์ Memcached ของ แค็ตตาล็อก ไม่ ใช้ ทั้ง สอง แบบ Recipe ที่ ยอมรับ การ แนบ จะ เรนเดอร์ แคช ที่ ตอบ ทุก ไคลเอนต์ ขณะ ที่ Aggregate บอก ว่า มี การ ป้องกัน Recipe แต่ละ รายการ จึง หยุด บิลด์ แทน โดย ระบุ สล็อต
ร่างตัวอย่าง
คุณ
เขียน
aggrega draft --example memcached-cacheจาก
cd memcached-cacheบิลด์
พื้นที่.aggrega-config.yaml เอนทิตีhub.aggrega.ai และ--auto-pull เขียน
# Local development (Docker Compose)aggrega build --release release-compose.yaml --auto-pull
# Kubernetes (synthesized helm Recipe, official image)aggrega build --release release-helm-synth.yaml --auto-pullอาร์ติแฟกต์dist/
กับผู้ช่วย AI
ผู้
ใช้เฉพาะเครื่องมือของ Aggrega และอย่าสร้างโฟลเดอร์เอง หากโฟลเดอร์พื้นที่ทำงานยังไม่มีโฟลเดอร์ `memcached-cache` เรียกเครื่องมือ `draft` หนึ่งครั้งโดยตั้ง `example` เป็น `memcached-cache` และไม่ระบุ `dir` เครื่องมือจะเขียนตัวอย่างลงในโฟลเดอร์ `memcached-cache` ใหม่ จากนั้นเรียกเครื่องมือ `build` หนึ่งครั้งต่อ Release แต่ละรายการ ตามลำดับนี้ คือ `release-compose.yaml` และ `release-helm-synth.yaml` โดยแต่ละครั้งตั้ง `workspace_root` เป็น `memcached-cache` ตั้ง `release` เป็นไฟล์นั้น ตั้ง `auto_pull` เป็น true และตั้ง `write` เป็น true บอกฉันว่าการบิลด์แต่ละครั้งเขียนไฟล์ใดบ้าง ไฟล์เหล่านั้นอยู่ใต้ `memcached-cache/dist/`กรณีควบคุม: รหัสผ่านที่แคชบังคับใช้ไม่ได้
Releases เชิง
aggrega build --release release-negative-compose-auth.yaml --auto-pullaggrega build --release release-negative-helm-synth-auth.yaml --auto-pullแต่ละ
a password is attached to the password slot of "cache", but the memcachedimage this Recipe runs cannot enforce a password: it authenticates only throughSASL over the binary protocol or an ASCII authentication file, which thecatalog's Memcached clients do not use, so the cache would accept every clientanyway; remove the attachment, and restrict who can reach the cache through itsnetworkการaggregate.yaml พื้น