ניהול משאבי פונקציות באמצעות אילוצים בהתאמה אישית

בדף הזה תמצאו מידע נוסף על הגדרת אילוצים מותאמים אישית בפונקציות שנוצרו באמצעות Cloud Functions v2 API, למשל באמצעות הפקודות gcloud functions.

מגבלות

המגבלות הבאות חלות על שימוש במדיניות ארגון בהתאמה אישית עבור פונקציות של Cloud Functions v2 API:

דוגמאות נפוצות למדיניות הארגון

בטבלה הבאה מפורט התחביר של כמה כללי מדיניות ארגוניים בהתאמה אישית שיכולים להיות שימושיים:

תיאור תחביר של אילוצים
איך מונעים יצירה של פונקציות בשפה מסוימת
    name: organizations/ORGANIZATION_ID/customConstraints/custom.cloudFunctionRuntimeBlock
    resource_types: cloudfunctions.googleapis.com/Function
    method_types:
      - CREATE
      - UPDATE
    condition: resource.buildConfig.runtime == "python312"
    action_type: DENY
    display_name: Deny functions using Python 3.12
    description: Functions cannot be created with Python 3.12 as the language runtime
דרישה להשתמש במאגר עובדים ספציפי עבור פונקציות
    name: organizations/ORGANIZATION_ID/customConstraints/custom.cloudFunctionsWorkerPool
    resource_types: cloudfunctions.googleapis.com/Function
    method_types:
      - CREATE
      - UPDATE
    condition: resource.buildConfig.workerPool == "WORKER_POOL"
    action_type: DENY
    display_name: Require worker pool
    description: Functions must use a worker pool
מחליפים את WORKER_POOL בשם של מאגר העובדים של Cloud Build.
דרישה שפונקציות יאחסנו את כל תמונות הקונטיינרים במאגר תמונות ספציפי
    name: organizations/ORGANIZATION_ID/customConstraints/custom.cloudFunctionsRepository
    resource_types: cloudfunctions.googleapis.com/Function
    method_types:
      - CREATE
      - UPDATE
    condition: resource.buildConfig.dockerRepository.startsWith("REPO_PATH")
    action_type: DENY
    display_name: Image repository constraint
    description: Functions must push images to a central image repository under REPO_PATH
מחליפים את REPO_PATH ב-URI של כתובת ה-URL של מאגר התמונות שבו רוצים שכל הפונקציות יאחסנו את קובצי האימג' שלהן בקונטיינר.

המאמרים הבאים