การส่งมอบข้อมูลรับรอง — `secretKeyRef` ตั้งแต่ต้นจนจบ
ฐานpassword เดียวกันcore/datastore/postgres รับ
ร่างตัวอย่าง
คุณ
เขียน
aggrega draft --example credential-secretkeyrefจาก
cd credential-secretkeyrefบิลด์
ตัวอย่าง
aggrega build --release release-helm.yaml --auto-pullaggrega build --release release-compose.yaml --auto-pullaggrega build --release release-negative.yaml --auto-pull # expected to fail (see below)Release ทุก.aggrega-config.yaml ของ--catalog และ --auto-pull เขียน
กับผู้ช่วย AI
ผู้
ใช้เครื่องมือของ Aggrega เท่านั้น และอย่าสร้างโฟลเดอร์เอง หากโฟลเดอร์พื้นที่ทำงานยังไม่มีโฟลเดอร์ `credential-secretkeyref` เรียกเครื่องมือ `draft` หนึ่งครั้งโดยตั้ง `example` เป็น `credential-secretkeyref` และไม่ระบุ `dir` เครื่องมือจะเขียนตัวอย่างลงในโฟลเดอร์ `credential-secretkeyref` ใหม่ จากนั้นเรียกเครื่องมือ `build` หนึ่งครั้งต่อ Release ตามลำดับนี้ — `release-helm.yaml`, `release-compose.yaml` — โดยแต่ละครั้งตั้ง `workspace_root` เป็น `credential-secretkeyref` ตั้ง `release` เป็นไฟล์นั้น ตั้ง `auto_pull` เป็น true และตั้ง `write` เป็น true จากนั้นเรียกเครื่องมือ `build` แบบเดียวกันโดยตั้ง `release` เป็น `release-negative.yaml` ซึ่งตั้งใจให้ถูกปฏิเสธ จึงอ่านการปฏิเสธนั้นให้ฉันฟัง บอกฉันว่าการบิลด์แต่ละครั้งเขียนไฟล์ใดบ้าง ไฟล์เหล่านั้นอยู่ใต้ `credential-secretkeyref/dist/`Helm — Secret ที่อ้างอิงได้ + secretKeyRef
aggregate-helm.yaml แนบ core/referenced-secret กับpassword Manifest แมปk8s-secret-from-parameter ซึ่งprovides {name, key} Recipe helm ของ postgres อ้างอิงcontainers.attachments ซึ่งsecretKeyRef ของ env
aggrega build --release release-helm.yaml --auto-pullSecret ที่dist/helm/helm/db--password--db-secret-db-password.yaml) และ secretKeyRef ของdist/helm/helm/db-statefulset.yaml) ระบุ.features.password.provides.name ไม่มี
[… omitted: the apiVersion and the Secret kind]metadata: name: db-password [… omitted: the labels and annotations every rendered document carries]stringData: POSTGRES_PASSWORD: "dev-pw-change-me"
# db-statefulset.yaml (container env)- name: POSTGRES_PASSWORD valueFrom: secretKeyRef: name: db-password # == the Secret's metadata.name key: POSTGRES_PASSWORD # == the Secret's data keyCompose — ข้อมูลรับรองแบบ inject-value
aggregate-compose.yaml แนบ core/secret-value Compose ไม่มีsecretKeyRef Manifest จึงdotenv-secret ซึ่งvalues.key คือ POSTGRES_PASSWORD ที่
aggrega build --release release-compose.yaml --auto-pull# dist/compose/compose/docker-compose.yaml → POSTGRES_PASSWORD: dev-pw-change-meเชิงลบ — การเติมที่อ้างอิงไม่ได้ถูกปฏิเสธจากการอ้างอิง
aggregate-negative.yaml แนบ core/secret-value แบบ inject-value กับpassword จากcontainers.attachments (secretKeyRef) secretKeyRef ต้อง
aggrega build --release release-negative.yaml --auto-pull# [… omitted: the pull's lines, which carry the same halt, and two lint notices]# [CATALOG_ERROR E0212] instance db# rendering node "db"# [… omitted: the cause, "workload attachment slot is not referenceable", naming the Recipe and its path in your catalog, then one line each for the "name" and the "key" the slot's provides does not expose]Release นี้1 แทนที่
มีcore/referenced-secret) ดังaggregate-helm.yaml หรือcore/secret-value ไว้k8s-secret-from-value ซึ่งcore/secret-value ที่env-secret ข้อมูลcontainers.attachments เลย