יצירת אילוצים בהתאמה אישית

Google Cloud מדיניות הארגון מאפשרת לכם שליטה מרוכזת ופרוגרמטית על המשאבים של הארגון. אדמינים של מדיניות הארגון יכולים להגדיר מדיניות ארגונית, שהיא קבוצה של הגבלות שנקראות אילוצים, שחלות על משאביGoogle Cloud ועל הצאצאים של המשאבים האלה בהיררכיית המשאבים שלGoogle Cloud . אפשר לאכוף את מדיניות הארגון ברמת הארגון, התיקייה או הפרויקט.

מדיניות הארגון מספקת אילוצים מוגדרים מראש לשירותים שונים שלGoogle Cloud . עם זאת, אם אתם רוצים שליטה מפורטת יותר וניתנת להתאמה אישית על השדות הספציפיים שמוגבלים במדיניות הארגון, אתם יכולים גם ליצור אילוצים בהתאמה אישית ולהשתמש בהם במדיניות הארגון.

יתרונות

אתם יכולים להשתמש במדיניות ארגונית בהתאמה אישית כדי לאשר או לדחות פעולות ספציפיות באצוות, בסשנים ובתבניות של סשנים (שנקראות פרופילי זמן ריצה במסוף Google Cloud ) ב-Managed Service for Apache Spark. לדוגמה, אם בקשה ליצירת עומס עבודה של Batch לא עומדת באימות של אילוץ מותאם אישית שהוגדר במדיניות הארגון, הבקשה תיכשל ותוחזר שגיאה למבצע הקריאה החוזרת.

ירושה של מדיניות

כברירת מחדל, מדיניות הארגון עוברת בירושה לצאצאים של המשאבים שעליהם אתם אוכפים את המדיניות. לדוגמה, אם אוכפים מדיניות בתיקייה, Google Cloud אוכף את המדיניות בכל הפרויקטים שבתיקייה. במאמר כללי הערכה של היררכיה מוסבר בהרחבה על ההתנהגות הזו ואיך לשנות אותה.

תמחור

שירות מדיניות הארגון, כולל אילוצים מוגדרים מראש ואילוצים בהתאמה אישית, מוצע ללא תשלום.

לפני שמתחילים

  1. הגדרת הפרויקט
    1. In the Google Cloud console, on the project selector page, select or create a Google Cloud project.

      Roles required to select or create a project

      • Select a project: Selecting a project doesn't require a specific IAM role—you can select any project that you've been granted a role on.
      • Create a project: To create a project, you need the Project Creator role (roles/resourcemanager.projectCreator), which contains the resourcemanager.projects.create permission. Learn how to grant roles.

      Go to project selector

    2. Verify that billing is enabled for your Google Cloud project.

    3. Enable the Managed Service for Apache Spark API, if it is not already enabled.

      Roles required to enable APIs

      To enable APIs, you need the serviceusage.services.enable permission. If you created the project, then you likely already have this permission through the Owner role (roles/owner). Otherwise, you can get this permission through the Service Usage Admin role (roles/serviceusage.serviceUsageAdmin). Learn how to grant roles.

      Enable the API

    4. Install the Google Cloud CLI.

    5. Configure the gcloud CLI to use your federated identity.

      For more information, see Sign in to the gcloud CLI with your federated identity.

    6. To initialize the gcloud CLI, run the following command:

      gcloud init
    7. מוודאים שאתם יודעים מהו מזהה הארגון שלכם.

התפקידים הנדרשים

כדי לקבל את ההרשאות שדרושות לניהול מדיניות הארגון, בקשו מהאדמין להקצות לכם את התפקיד אדמין של מדיניות הארגון (roles/orgpolicy.policyAdmin) ב-IAM במשאב הארגון. כדי לקרוא הסבר על מתן תפקידים, ראו איך מנהלים את הגישה ברמת הפרויקט, התיקייה והארגון.

זהו תפקיד מוגדר מראש שכולל את ההרשאות שנדרשות לניהול מדיניות הארגון. כדי לראות בדיוק אילו הרשאות נדרשות, אפשר להרחיב את הקטע ההרשאות הנדרשות:

ההרשאות הנדרשות

כדי לנהל את מדיניות הארגון, נדרשות ההרשאות הבאות:

  • orgpolicy.constraints.list
  • orgpolicy.policies.create
  • orgpolicy.policies.delete
  • orgpolicy.policies.list
  • orgpolicy.policies.update
  • orgpolicy.policy.get
  • orgpolicy.policy.set

יכול להיות שתקבלו את ההרשאות האלה באמצעות תפקידים בהתאמה אישית או תפקידים מוגדרים מראש אחרים.

יצירת אילוץ בהתאמה אישית

אילוץ בהתאמה אישית מוגדר בקובץ YAML לפי המשאבים, השיטות, התנאים והפעולות שעליהם הוא חל. ב-Managed Service for Apache Spark אפשר להחיל אילוצים מותאמים אישית על ה-method‏ CREATE של משאבי הסשן והאצווה, ועל ה-methods‏ CREATE ו-UPDATE של משאב תבנית הסשן (פרופיל זמן הריצה).

מידע נוסף על יצירת אילוץ בהתאמה אישית זמין במאמר יצירה וניהול של מדיניות ארגונית בהתאמה אישית.

יצירת אילוץ בהתאמה אישית למשאב באצ'

כדי ליצור קובץ YAML לאילוץ מותאם אישית של Managed Service for Apache Spark למשאב אצווה, משתמשים בפורמט הבא:

name: organizations/ORGANIZATION_ID/customConstraints/CONSTRAINT_NAME
resourceTypes:
- dataproc.googleapis.com/Batch
methodTypes: 
- CREATE
condition: CONDITION
actionType: ACTION
displayName: DISPLAY_NAME
description: DESCRIPTION

מחליפים את מה שכתוב בשדות הבאים:

  • ‫ORGANIZATION_ID: מזהה הארגון, למשל 123456789.

  • ‫CONSTRAINT_NAME: השם שרוצים לתת לאילוץ החדש בהתאמה אישית. אילוץ בהתאמה אישית חייב להתחיל ב-custom., ויכול לכלול רק אותיות רישיות, אותיות קטנות או מספרים, לדוגמה, custom.batchMustHaveSpecifiedCategoryLabel. האורך המקסימלי של השדה הזה הוא 70 תווים, לא כולל הקידומת, לדוגמה, organizations/123456789/customConstraints/custom..

  • ‫CONDITION: תנאי CEL שנכתב כנגד ייצוג של משאב שירות נתמך. האורך המקסימלי של השדה הזה הוא 1,500 תווים. למידע נוסף על המשאבים הזמינים לכתיבת תנאים, ראו אילוצים של Dataproc Serverless על משאבים ופעולות. תנאי לדוגמה: ("category" in resource.labels) && (resource.labels['category'] in ['retail', 'ads', 'service']).

  • ‫ACTION: הפעולה שתתבצע אם התנאי יתקיים. הערך יכול להיות ALLOW או DENY.

  • ‫DISPLAY_NAME: שם קריא לאנשים של האילוץ. שם תצוגה לדוגמה: "אכיפת דרישת תווית 'קטגוריה' באצווה". האורך המקסימלי של השדה הזה הוא 200 תווים.

  • ‫DESCRIPTION: תיאור ידידותי למשתמש של האילוץ, שיוצג כהודעת שגיאה במקרה של הפרת המדיניות. האורך המקסימלי של השדה הזה הוא 2,000 תווים. תיאור לדוגמה: "Only allow Dataproc batch creation if it has a 'category' label with a 'retail', 'ads', or 'service' value".

יצירת אילוץ בהתאמה אישית למשאב של סשן

כדי ליצור קובץ YAML לאילוץ מותאם אישית של Managed Service for Apache Spark למשאב סשן, משתמשים בפורמט הבא:

name: organizations/ORGANIZATION_ID/customConstraints/CONSTRAINT_NAME
resourceTypes:
- dataproc.googleapis.com/Session
methodTypes: 
- CREATE
condition: CONDITION
actionType: ACTION
displayName: DISPLAY_NAME
description: DESCRIPTION

מחליפים את מה שכתוב בשדות הבאים:

  • ‫ORGANIZATION_ID: מזהה הארגון, למשל 123456789.

  • ‫CONSTRAINT_NAME: השם שרוצים לתת לאילוץ המותאם אישית החדש. אילוץ בהתאמה אישית חייב להתחיל ב-custom., ויכול לכלול רק אותיות רישיות, אותיות קטנות או מספרים, לדוגמה, custom.SessionNameMustStartWithTeamName. האורך המקסימלי של השדה הזה הוא 70 תווים, לא כולל הקידומת, לדוגמה, organizations/123456789/customConstraints/custom..

  • ‫CONDITION: תנאי CEL שנכתב כנגד ייצוג של משאב שירות נתמך. האורך המקסימלי של השדה הזה הוא 1,500 תווים. למידע נוסף על המשאבים הזמינים לכתיבת תנאים, ראו אילוצים של Dataproc Serverless על משאבים ופעולות. תנאי לדוגמה: (resource.name.startsWith("dataproc").

  • ‫ACTION: הפעולה שתתבצע אם התנאי יתקיים. הערך יכול להיות ALLOW או DENY.

  • ‫DISPLAY_NAME: שם קריא לאנשים של האילוץ. שם לדוגמה: "Enforce session to have a ttl < 2 hours". האורך המקסימלי של השדה הזה הוא 200 תווים.

  • ‫DESCRIPTION: תיאור ידידותי למשתמש של האילוץ, שיוצג כהודעת שגיאה במקרה של הפרת המדיניות. האורך המקסימלי של השדה הזה הוא 2,000 תווים. תיאור לדוגמה: "Only allow session creation if it sets an allowable TTL".

יצירת אילוץ בהתאמה אישית למשאב של תבנית סשן (פרופיל זמן ריצה)

כדי ליצור קובץ YAML לאילוץ בהתאמה אישית של Managed Service for Apache Spark למשאב של תבנית סשן (פרופיל זמן ריצה), משתמשים בפורמט הבא:

name: organizations/ORGANIZATION_ID/customConstraints/CONSTRAINT_NAME
resourceTypes:
- dataproc.googleapis.com/SessionTemplate
methodTypes: 
- CREATE
- UPDATE
condition: CONDITION
actionType: ACTION
displayName: DISPLAY_NAME
description: DESCRIPTION

מחליפים את מה שכתוב בשדות הבאים:

  • ‫ORGANIZATION_ID: מזהה הארגון, למשל 123456789.

  • ‫CONSTRAINT_NAME: השם שרוצים לתת לאילוץ החדש בהתאמה אישית. אילוץ בהתאמה אישית חייב להתחיל ב-custom., ויכול לכלול רק אותיות רישיות, אותיות קטנות או מספרים, לדוגמה, custom.SessionTemplateNameMustStartWithTeamName. האורך המקסימלי של השדה הזה הוא 70 תווים, לא כולל הקידומת, לדוגמה, organizations/123456789/customConstraints/custom..

  • ‫CONDITION: תנאי CEL שנכתב כנגד ייצוג של משאב שירות נתמך. האורך המקסימלי של השדה הזה הוא 1,500 תווים. במאמר הזה מוסבר בהרחבה על המשאבים שאפשר לכתוב להם תנאים. תנאי לדוגמה: (resource.name.startsWith("dataproc").

  • ‫ACTION: הפעולה שתתבצע אם התנאי יתקיים. הערך יכול להיות ALLOW או DENY.

  • ‫DISPLAY_NAME: שם קריא לאנשים של האילוץ. שם לדוגמה לתצוגה: "אכיפת תבנית סשן עם ttl < שעתיים". האורך המקסימלי של השדה הזה הוא 200 תווים.

  • ‫DESCRIPTION: תיאור ידידותי למשתמש של האילוץ, שיוצג כהודעת שגיאה במקרה של הפרת המדיניות. האורך המקסימלי של השדה הזה הוא 2,000 תווים. תיאור לדוגמה: "Only allow session template creation if it sets an allowable TTL".

הגדרת אילוץ בהתאמה אישית

המסוף

כדי ליצור אילוץ בהתאמה אישית:

  1. במסוף Google Cloud , נכנסים לדף מדיניות הארגון.

    כניסה לדף Organization policies

  2. בכלי לבחירת פרויקטים, בוחרים את הפרויקט שרוצים להגדיר לו את מדיניות הארגון.
  3. לוחצים על Custom constraint.
  4. בתיבה Display name, מזינים שם לאילוץ שיהיה קריא לאנשים. השם הזה מופיע בהודעות שגיאה ואפשר להשתמש בו לזיהוי ולניפוי באגים. אל תשתמשו בפרטים אישיים מזהים (PII) או במידע רגיש בשמות לתצוגה, כי השם הזה עלול להיחשף בהודעות שגיאה. השדה הזה יכול להכיל עד 200 תווים.
  5. בתיבה Constraint ID, מזינים את המזהה שרוצים לתת לאילוץ החדש בהתאמה אישית. אילוץ בהתאמה אישית יכול להכיל רק אותיות (כולל אותיות רישיות וקטנות) או מספרים, לדוגמה custom.batchMustHaveSpecifiedCategoryLabel. השדה הזה יכול להכיל עד 70 תווים, לא כולל הקידומת (custom.), לדוגמה, organizations/123456789/customConstraints/custom. אל תכללו פרטים אישיים מזהים או מידע רגיש במזהה האילוץ, כי הם עלולים להיחשף בהודעות שגיאה.
  6. בתיבה Description, מזינים תיאור של האילוץ שקריא לאנשים. התיאור הזה משמש כהודעת שגיאה כשיש הפרה של המדיניות. ציינו פרטים על הסיבה להפרת המדיניות ואיך לפתור את הבעיה. אל תכללו פרטים אישיים מזהים או מידע רגיש בתיאור, כי הם עלולים להיחשף בהודעות שגיאה. השדה הזה יכול להכיל עד 2,000 תווים.
  7. בתיבה Resource type, בוחרים את השם של משאב ה- Google Cloud REST שמכיל את האובייקט והשדה שרוצים להגביל, לדוגמה container.googleapis.com/Cluster. רוב סוגי המשאבים תומכים בעד 20 אילוצים בהתאמה אישית. אם תנסו ליצור יותר אילוצים בהתאמה אישית, הפעולה תיכשל.
  8. אפשר לאכוף את האילוץ הזה רק ב-REST CREATE.
  9. כדי לראות את השיטות הנתמכות בכל שירות, חפשו את השירות במאמר שירותים שתומכים באילוצים בהתאמה אישית.

  10. כדי להגדיר תנאי, לוחצים על עריכת התנאי.
    1. בחלונית Add condition, יוצרים תנאי CEL שמתייחס למשאב שירות נתמך, לדוגמה resource.autopilot.enabled == false. השדה הזה יכול להכיל עד 1,500 תווים. לפרטים על השימוש ב-CEL, ראו Common Expression Language. מידע נוסף על משאבי השירות שבהם אפשר להשתמש באילוצים מותאמים אישית מופיע במאמר שירותים שנתמכים באילוצים מותאמים אישית.
    2. לוחצים על Save.
  11. בקטע Action, בוחרים אם לאשר או לדחות את השיטה שנבדקה אם התנאי מתקיים.
  12. פעולת הדחייה פירושה שהפעולה ליצירה או לעדכון של המשאב נחסמת אם התנאי מקבל את הערך True.

    פעולת ההרשאה מאפשרת ליצור או לעדכן את המשאב רק אם התנאי מתקיים. כל מקרה אחר, מלבד אלה שרשומים במפורש בתנאי, נחסם.

  13. לוחצים על Create constraint.
  14. אחרי שמזינים ערך בכל שדה, הגדרת ה-YAML המקבילה לאילוץ המותאם אישית הזה מופיעה בצד שמאל.

gcloud

  1. כדי ליצור אילוץ בהתאמה אישית, יוצרים קובץ YAML בפורמט הבא:
  2. name: organizations/ORGANIZATION_ID/customConstraints/CONSTRAINT_NAME
    resourceTypes: RESOURCE_NAME
    methodTypes:
      - CREATE
    condition: "CONDITION"
    actionType: ACTION
    displayName: DISPLAY_NAME
    description: DESCRIPTION

    מחליפים את מה שכתוב בשדות הבאים:

    • ‫ORGANIZATION_ID: מזהה הארגון, למשל 123456789.
    • ‫CONSTRAINT_NAME: השם שרוצים לתת לאילוץ החדש בהתאמה אישית. אילוץ בהתאמה אישית יכול להכיל רק אותיות (כולל אותיות רישיות וקטנות) או מספרים, לדוגמה, custom.batchMustHaveSpecifiedCategoryLabel. השדה הזה יכול להכיל עד 70 תווים, לא כולל הקידומת (custom.) – לדוגמה, organizations/123456789/customConstraints/custom. אל תכללו פרטים אישיים מזהים או מידע רגיש במזהה האילוץ, כי הם עלולים להיחשף בהודעות שגיאה.
    • ‫RESOURCE_NAME: השם המלא של המשאב ב- Google Cloudשמכיל את האובייקט והשדה שרוצים להגביל. לדוגמה, dataproc.googleapis.com/batch. רוב סוגי המשאבים תומכים בעד 20 אילוצים בהתאמה אישית. אם תנסו ליצור יותר אילוצים בהתאמה אישית, הפעולה תיכשל.
    • ‫methodTypes: השיטות של REST שעליהן נאכף האילוץ. הערך יכול להיות רק CREATE.
    • כדי לראות את השיטות הנתמכות לכל שירות, חפשו את השירות במאמר שירותים שתומכים באילוצים בהתאמה אישית.

    • ‫CONDITION: תנאי CEL שנכתב כנגד ייצוג של משאב שירות נתמך. השדה הזה יכול להכיל עד 1,500 תווים. לדוגמה, ("category" in resource.labels) && (resource.labels['category'] in ['retail', 'ads', 'service']).
    • למידע נוסף על המשאבים הזמינים לכתיבת תנאים, ראו משאבים נתמכים.

    • ‫ACTION: הפעולה שצריך לבצע אם התנאי condition מתקיים. הערך יכול להיות רק ALLOW.
    • הפעולה allow פירושה שאם התנאי מקבל את הערך true, מותר ליצור או לעדכן את המשאב. זה גם אומר שכל מקרה אחר, מלבד המקרה שמופיע במפורש בתנאי, נחסם.

    • ‫DISPLAY_NAME: שם קריא לאנשים של האילוץ. השם הזה מופיע בהודעות שגיאה ואפשר להשתמש בו לזיהוי ולניפוי באגים. אל תשתמשו בפרטים אישיים מזהים או במידע רגיש בשמות המוצגים, כי השם הזה עלול להיחשף בהודעות שגיאה. השדה הזה יכול להכיל עד 200 תווים.
    • ‫DESCRIPTION: תיאור קריא של האילוץ שיוצג כהודעת שגיאה במקרה של הפרת המדיניות. השדה הזה יכול להכיל עד 2,000 תווים.
  3. אחרי שיוצרים את קובץ ה-YAML לאילוץ חדש בהתאמה אישית, צריך להגדיר אותו כדי שיהיה זמין למדיניות הארגון. כדי להגדיר אילוץ בהתאמה אישית, משתמשים בפקודה gcloud org-policies set-custom-constraint:
  4. gcloud org-policies set-custom-constraint CONSTRAINT_PATH

    מחליפים את CONSTRAINT_PATH בנתיב המלא לקובץ האילוץ בהתאמה אישית. לדוגמה, /home/user/customconstraint.yaml.

    בסיום הפעולה, האילוצים המותאמים אישית יהיו זמינים כמדיניות של הארגון ברשימת Google Cloud מדיניות הארגון.

  5. כדי לוודא שהאילוץ המותאם אישית קיים, משתמשים בפקודה gcloud org-policies list-custom-constraints:
  6. gcloud org-policies list-custom-constraints --organization=ORGANIZATION_ID

    מחליפים את ORGANIZATION_ID במזהה של משאב הארגון.

    איך בודקים את מדיניות הארגון

אכיפה של אילוץ בהתאמה אישית

כדי לאכוף אילוץ, אתם יכולים ליצור מדיניות ארגון שמפנה אליו, ואז להחיל את מדיניות הארגון על משאב Google Cloud .

המסוף

  1. במסוף Google Cloud , נכנסים לדף מדיניות הארגון.

    כניסה לדף Organization policies

  2. בכלי לבחירת פרויקטים, בוחרים את הפרויקט שרוצים להגדיר לו את מדיניות הארגון.
  3. ברשימה שבדף מדיניות הארגון, בוחרים את האילוץ כדי להציג את הדף Policy details של אותו אילוץ.
  4. כדי להגדיר את מדיניות הארגון למשאב הזה, לוחצים על ניהול המדיניות.
  5. בדף עריכת המדיניות, בוחרים באפשרות במקום המדיניות של המשאב הראשי.
  6. לוחצים על Add a rule.
  7. בקטע Enforcement, בוחרים אם לאכוף את מדיניות הארגון הזו או לא.
  8. אופציונלי: כדי להוסיף תנאי למדיניות הארגון שמבוסס על תג, לוחצים על Add condition. שימו לב: אם מוסיפים כלל מותנה למדיניות הארגון, צריך להוסיף לפחות כלל אחד לא מותנה, אחרת אי אפשר לשמור את המדיניות. מידע נוסף זמין במאמר הגדרת ההיקף של מדיניות הארגון באמצעות תגים.
  9. לוחצים על בדיקת השינויים כדי לדמות את ההשפעה של מדיניות הארגון. למידע נוסף, קראו את המאמר בדיקת שינויים במדיניות הארגון באמצעות סימולטור המדיניות.
  10. כדי לאכוף את מדיניות הארגון במצב פרימטר לבדיקות, לוחצים על הגדרת המדיניות להרצת בדיקה. למידע נוסף, קראו את המאמר בדיקת כללי מדיניות של הארגון.
  11. אחרי שמוודאים שמדיניות הארגון במצב פרימטר לבדיקות פועלת כמו שצריך, לוחצים על Set policy כדי להגדיר את המדיניות הפעילה.

gcloud

  1. כדי ליצור מדיניות ארגונית עם כללים בוליאניים, יוצרים קובץ YAML של מדיניות שמפנה לאילוץ:
  2. name: projects/PROJECT_ID/policies/CONSTRAINT_NAME
    spec:
      rules:
      - enforce: true
    
    dryRunSpec:
      rules:
      - enforce: true

    מחליפים את מה שכתוב בשדות הבאים:

    • ‫PROJECT_ID: הפרויקט שבו רוצים לאכוף את האילוץ.
    • ‫CONSTRAINT_NAME: השם שהגדרתם לאילוץ המותאם אישית. לדוגמה, custom.batchMustHaveSpecifiedCategoryLabel.
  3. כדי לאכוף את מדיניות הארגון במצב פרימטר לבדיקות, מריצים את הפקודה הבאה עם הדגל dryRunSpec:
  4. gcloud org-policies set-policy POLICY_PATH --update-mask=dryRunSpec

    מחליפים את POLICY_PATH בנתיב המלא לקובץ ה-YAML של מדיניות הארגון. המדיניות תיכנס לתוקף תוך 15 דקות לכל היותר.

  5. אחרי שמוודאים שמדיניות הארגון במצב פרימטר לבדיקות פועלת כמצופה, מגדירים את המדיניות הפעילה באמצעות הפקודה org-policies set-policy והדגל spec:
  6. gcloud org-policies set-policy POLICY_PATH --update-mask=spec

    מחליפים את POLICY_PATH בנתיב המלא לקובץ ה-YAML של מדיניות הארגון. המדיניות תיכנס לתוקף תוך 15 דקות לכל היותר.

בדיקת האילוץ המותאם אישית

בקטע הזה מוסבר איך לבדוק אילוצים בהתאמה אישית למשאבים של אצווה, סשן ותבנית סשן (פרופיל זמן ריצה).

בדיקת האילוץ המותאם אישית למשאב באצ'

בדוגמה הבאה ליצירת אצווה, נניח שיצרנו אילוץ מותאם אישית ואכפנו אותו על יצירת אצווה, כדי לדרוש שלאצווה תהיה תווית "category" עם הערך "retail",‏ "ads" או "service": ("category" in resource.labels) && (resource.labels['category'] in ['retail', 'ads', 'service']).

gcloud dataproc batches submit spark \
  --region us-west1
  --jars file:///usr/lib/spark/examples/jars/spark-examples.jar \
  --class org.apache.spark.examples.SparkPi  \
  --network default \
  --labels category=foo \
  --100

פלט לדוגמה:

Operation denied by custom org policies: ["customConstraints/custom.batchMustHaveSpecifiedCategoryLabel": ""Only allow Dataproc batch creation if it has a 'category' label with
  a 'retail', 'ads', or 'service' value""]

בדיקת האילוץ המותאם אישית למשאב של סשן

בדוגמה הבאה ליצירת סשן, אנחנו מניחים שאילוץ מותאם אישית נוצר ונאכף על יצירת הסשן, כדי לדרוש שלסשן יהיה name שמתחיל ב-orgName.

gcloud beta dataproc sessions create spark test-session
  --location us-central1

פלט לדוגמה:

Operation denied by custom org policy:
["customConstraints/custom.denySessionNameNotStartingWithOrgName": "Deny session
creation if its name does not start with 'orgName'"]

בדיקת האילוץ המותאם אישית למשאב של תבנית סשן (פרופיל זמן ריצה)

בדוגמה הבאה ליצירת תבנית סשן, נניח שיצרתם אילוץ בהתאמה אישית ואכפתם אותו על יצירה ועדכון של תבנית סשן, כדי לדרוש שלתבנית הסשן יהיה name שמתחיל ב-orgName.

gcloud beta dataproc session-templates import test-session-template
--source=saved-template.yaml

פלט לדוגמה:

Operation denied by custom org policy:
["customConstraints/custom.denySessionTemplateNameNotStartingWithOrgName":
"Deny session template creation or update if its name does not start with
'orgName'"]

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

בקטע הזה מפורטים האילוצים המותאמים אישית שאפשר להגדיר ב-Managed Service for Apache Spark למשאבים של אצווה וסשן.

אילוצים נתמכים של אצווה

אפשר להשתמש באילוצים הבאים בהתאמה אישית של Managed Service for Apache Spark כשיוצרים (שולחים) עומס עבודה באצווה:

כללי

  • resource.labels

PySparkBatch

  • resource.pysparkBatch.mainPythonFileUri
  • resource.pysparkBatch.args
  • resource.pysparkBatch.pythonFileUris
  • resource.pysparkBatch.jarFileUris
  • resource.pysparkBatch.fileUris
  • resource.pysparkBatch.archiveUris

SparkBatch

  • resource.sparkBatch.mainJarFileUri
  • resource.sparkBatch.mainClass
  • resource.sparkBatch.args
  • resource.sparkBatch.jarFileUris
  • resource.sparkBatch.fileUris
  • resource.sparkBatch.archiveUris

SparRBatch

  • resource.sparkRBatch.mainRFileUri
  • resource.sparkRBatch.args
  • resource.sparkRBatch.fileUris
  • resource.sparkRBatch.archiveUris

SparkSqlBatch

  • resource.sparkSqlBatch.queryFileUri
  • resource.sparkSqlBatch.queryVariables
  • resource.sparkSqlBatch.jarFileUris

RuntimeConfig

  • resource.runtimeConfig.version
  • resource.runtimeConfig.containerImage
  • resource.runtimeConfig.properties
  • resource.runtimeConfig.repositoryConfig.pypiRepositoryConfig.pypiRepository
  • resource.runtimeConfig.autotuningConfig.scenarios
  • resource.runtimeConfig.cohort

ExecutionConfig

  • resource.environmentConfig.executionConfig.serviceAccount
  • resource.environmentConfig.executionConfig.networkUri
  • resource.environmentConfig.executionConfig.subnetworkUri
  • resource.environmentConfig.executionConfig.networkTags
  • resource.environmentConfig.executionConfig.kmsKey
  • resource.environmentConfig.executionConfig.idleTtl
  • resource.environmentConfig.executionConfig.ttl
  • resource.environmentConfig.executionConfig.stagingBucket
  • resource.environmentConfig.executionConfig.authenticationConfig.userWorkloadAuthenticationType

PeripheralsConfig

  • resource.environmentConfig.peripheralsConfig.metastoreService
  • resource.environmentConfig.peripheralsConfig.sparkHistoryServerConfig.dataprocCluster

אילוצי סשן נתמכים

אפשר להשתמש במאפייני הסשן הבאים כשיוצרים אילוצים מותאמים אישית בסשנים ללא שרת:

כללי

  • resource.name
  • resource.sparkConnectSession
  • resource.user
  • resource.sessionTemplate

JupyterSession

  • resource.jupyterSession.kernel
  • resource.jupyterSession.displayName

RuntimeConfig

  • resource.runtimeConfig.version
  • resource.runtimeConfig.containerImage
  • resource.runtimeConfig.properties
  • resource.runtimeConfig.repositoryConfig.pypiRepositoryConfig.pypiRepository
  • resource.runtimeConfig.autotuningConfig.scenarios
  • resource.runtimeConfig.cohort

ExecutionConfig

  • resource.environmentConfig.executionConfig.serviceAccount
  • resource.environmentConfig.executionConfig.networkUri
  • resource.environmentConfig.executionConfig.subnetworkUri
  • resource.environmentConfig.executionConfig.networkTags
  • resource.environmentConfig.executionConfig.kmsKey
  • resource.environmentConfig.executionConfig.idleTtl
  • resource.environmentConfig.executionConfig.ttl
  • resource.environmentConfig.executionConfig.stagingBucket
  • resource.environmentConfig.executionConfig.authenticationConfig.userWorkloadAuthenticationType

PeripheralsConfig

  • resource.environmentConfig.peripheralsConfig.metastoreService
  • resource.environmentConfig.peripheralsConfig.sparkHistoryServerConfig.dataprocCluster

אילוצים נתמכים של תבנית סשן (פרופיל זמן ריצה)

אפשר להשתמש במאפיינים הבאים של תבניות סשנים כשיוצרים אילוצים בהתאמה אישית בתבניות סשנים ללא שרת (פרופילים של סביבות זמן ריצה):

כללי

  • resource.name
  • resource.description
  • resource.sparkConnectSession

JupyterSession

  • resource.jupyterSession.kernel
  • resource.jupyterSession.displayName

RuntimeConfig

  • resource.runtimeConfig.version
  • resource.runtimeConfig.containerImage
  • resource.runtimeConfig.properties
  • resource.runtimeConfig.repositoryConfig.pypiRepositoryConfig.pypiRepository
  • resource.runtimeConfig.autotuningConfig.scenarios
  • resource.runtimeConfig.cohort

ExecutionConfig

  • resource.environmentConfig.executionConfig.serviceAccount
  • resource.environmentConfig.executionConfig.networkUri
  • resource.environmentConfig.executionConfig.subnetworkUri
  • resource.environmentConfig.executionConfig.networkTags
  • resource.environmentConfig.executionConfig.kmsKey
  • resource.environmentConfig.executionConfig.idleTtl
  • resource.environmentConfig.executionConfig.ttl
  • resource.environmentConfig.executionConfig.stagingBucket
  • resource.environmentConfig.executionConfig.authenticationConfig.userWorkloadAuthenticationType

PeripheralsConfig

  • resource.environmentConfig.peripheralsConfig.metastoreService
  • resource.environmentConfig.peripheralsConfig.sparkHistoryServerConfig.dataprocCluster

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

בקטע הזה מופיעות דוגמאות לאילוצים בהתאמה אישית לתרחישים נפוצים של משאבי אצווה וסשן.

דוגמה לאילוצים בהתאמה אישית למשאב באצ'

בטבלה הבאה מופיעות דוגמאות לאילוצים מותאמים אישית של אצווה ב-Managed Service for Apache Spark:

תיאור תחביר האילוץ
צריך לצרף לאצווה תווית "category" עם ערכים מותרים.
    name: organizations/ORGANIZATION_ID/customConstraints/custom.batchMustHaveSpecifiedCategoryLabel
    resourceTypes:
    - dataproc.googleapis.com/Batch
    methodTypes:
    - CREATE
    condition: ("category" in resource.labels) && (resource.labels['category'] in ['retail', 'ads', 'service'])
    actionType: ALLOW
    displayName: Enforce batch "category" label requirement.
    description: Only allow batch creation if it attaches a "category" label with an allowable value.
צריך להגדיר ב-Batch גרסת זמן ריצה מותרת.
    name: organizations/ORGANIZATION_ID/customConstraints/custom.batchMustUseAllowedVersion
    resourceTypes:
    - dataproc.googleapis.com/Batch
    methodTypes:
    - CREATE
    condition:  (has(resource.runtimeConfig.version)) && (resource.runtimeConfig.version in ["2.0.45", "2.0.48"])
    actionType: ALLOW
    displayName: Enforce batch runtime version.
    description: Only allow batch creation if it sets an allowable runtime version.
צריך להשתמש ב-SparkSQL.
    name: organizations/ORGANIZATION_ID/customConstraints/custom.batchMustUseSparkSQL
    resourceTypes:
    - dataproc.googleapis.com/Batch
    methodTypes:
    - CREATE
    condition: (has(resource.sparkSqlBatch))
    actionType: ALLOW
    displayName: Enforce batch only use SparkSQL Batch.
    description: Only allow creation of SparkSQL Batch.
צריך להגדיר ב-Batch ערך TTL של פחות משעתיים.
    name: organizations/ORGANIZATION_ID/customConstraints/custom.batchMustSetLessThan2hTtl
    resourceTypes:
    - dataproc.googleapis.com/Batch
    methodTypes:
    - CREATE
    condition:  (has(resource.environmentConfig.executionConfig.ttl)) && (resource.environmentConfig.executionConfig.ttl <= duration('2h'))
    actionType: ALLOW
    displayName: Enforce batch TTL.
    description: Only allow batch creation if it sets an allowable TTL.
ב-Batch אי אפשר להגדיר יותר מ-20 מנהלי משימות ראשוניים של Spark.
    name: organizations/ORGANIZATION_ID/customConstraints/custom.batchInitialExecutorMax20
    resourceTypes:
    - dataproc.googleapis.com/Batch
    methodTypes:
    - CREATE
    condition: (has(resource.runtimeConfig.properties)) && ('spark.executor.instances' in resource.runtimeConfig.properties)
     && (int(resource.runtimeConfig.properties['spark.executor.instances'])>20)
    actionType: DENY
    displayName: Enforce maximum number of batch Spark executor instances.
    description: Deny batch creation if it specifies more than 20 Spark executor instances.
ב-Batch אי אפשר להגדיר יותר מ-20 מנהלי משימות ראשוניים להקצאה דינמית של Spark.
    name: organizations/ORGANIZATION_ID/customConstraints/custom.batchDynamicAllocationInitialExecutorMax20
    resourceTypes:
    - dataproc.googleapis.com/Batch
    methodTypes:
    - CREATE
    condition: (has(resource.runtimeConfig.properties)) && ('spark.dynamicAllocation.initialExecutors' in resource.runtimeConfig.properties)
     && (int(resource.runtimeConfig.properties['spark.dynamicAllocation.initialExecutors'])>20)
    actionType: DENY
    displayName: Enforce maximum number of batch dynamic allocation initial executors.
    description: Deny batch creation if it specifies more than 20 Spark dynamic allocation initial executors.
ב-Batch אי אפשר להגדיר יותר מ-20 מנהלי משימות להקצאה דינמית.
    name: organizations/ORGANIZATION_ID/customConstraints/custom.batchDynamicAllocationMaxExecutorMax20
    resourceTypes:
    - dataproc.googleapis.com/Batch
    methodTypes:
    - CREATE
    condition: (resource.runtimeConfig.properties['spark.dynamicAllocation.enabled']=='false') || (('spark.dynamicAllocation.maxExecutors' in resource.runtimeConfig.properties) && (int(resource.runtimeConfig.properties['spark.dynamicAllocation.maxExecutors'])<=20))
    actionType: ALLOW
    displayName: Enforce batch maximum number of dynamic allocation executors.
    description:  Only allow batch creation if dynamic allocation is disabled or
    the maximum number of dynamic allocation executors is set to less than or equal to 20.
ב-Batch צריך להגדיר את מפתח ה-KMS לתבנית מותרת.
    name: organizations/ORGANIZATION_ID/custom.batchKmsPattern
    resourceTypes:
    - dataproc.googleapis.com/Batch
    methodTypes:
    - CREATE
    condition:  matches(resource.environmentConfig.executionConfig.kmsKey, '^keypattern[a-z]$')
    actionType: ALLOW
    displayName: Enforce batch KMS Key pattern.
    description: Only allow batch creation if it sets the KMS key to an allowable pattern.
ב-Batch, צריך להגדיר את הקידומת של קטגוריית ה-Staging לערך מותר.
    name: organizations/ORGANIZATION_ID/customConstraints/custom.batchStagingBucketPrefix
    resourceTypes:
    - dataproc.googleapis.com/Batch
    methodTypes:
    - CREATE
    condition:  resource.environmentConfig.executionConfig.stagingBucket.startsWith(ALLOWED_PREFIX)
    actionType: ALLOW
    displayName: Enforce batch staging bucket prefix.
    description: Only allow batch creation if it sets the staging bucket prefix to ALLOWED_PREFIX.
הגדרת הזיכרון של מפעיל ה-Batch צריכה להסתיים בסיומת m ולהיות קטנה מ-20,000m.
    name: organizations/ORGANIZATION_ID/customConstraints/custom.batchExecutorMemoryMax
    resourceTypes:
    - dataproc.googleapis.com/Batch
    methodTypes:
    - CREATE
    condition:  ('spark.executor.memory' in resource.runtimeConfig.properties) && (resource.runtimeConfig.properties['spark.executor.memory'].endsWith('m')) && (int(resource.runtimeConfig.properties['spark.executor.memory'].split('m')[0])<20000)
    actionType: ALLOW
    displayName: Enforce batch executor maximum memory.
    description: Only allow batch creation if the executor memory setting ends with a suffix 'm' and is less than 20000 m.

דוגמה לאילוצים בהתאמה אישית למשאב של סשן

בטבלה הבאה מפורטות דוגמאות לאילוצים מותאמים אישית של סשנים ב-Managed Service for Apache Spark:

תיאור תחביר האילוץ
בסשן צריך להגדיר את sessionTemplate כמחרוזת ריקה.
    name: organizations/ORGANIZATION_ID/customConstraints/custom.sessionTemplateMustBeEmpty
    resourceTypes:
    - dataproc.googleapis.com/Session
    methodTypes:
    - CREATE
    condition: resource.sessionTemplate == ""
    actionType: ALLOW
    displayName: Enforce empty session templates.
    description: Only allow session creation if session template is empty string.
הערך של sessionTemplate חייב להיות זהה למזהי התבניות שאושרו.
    name: organizations/ORGANIZATION_ID/customConstraints/custom.sessionTemplateIdMustBeApproved
    resourceTypes:
    - dataproc.googleapis.com/Session
    methodTypes:
    - CREATE
    condition:
    resource.sessionTemplate.startsWith("https://www.googleapis.com/compute/v1/projects/")
      &&
      resource.sessionTemplate.contains("/locations/") &&
      resource.sessionTemplate.contains("/sessionTemplates/") &&
       (
         resource.sessionTemplate.endsWith("/1") ||
         resource.sessionTemplate.endsWith("/2") ||
         resource.sessionTemplate.endsWith("/13")
       )
    actionType: ALLOW
    displayName: Enforce templateId must be 1, 2, or 13.
    description: Only allow session creation if session template ID is in the
    approved list, that is, 1, 2 and 13.
הסשן חייב להשתמש בפרטי הכניסה של משתמש הקצה כדי לאמת את עומס העבודה.
    name: organizations/ORGANIZATION_ID/customConstraints/custom.AllowEUCSessions
    resourceTypes:
    - dataproc.googleapis.com/Session
    methodTypes:
    - CREATE
    condition:
    resource.environmentConfig.executionConfig.authenticationConfig.userWorkloadAuthenticationType=="END_USER_CREDENTIALS"
    actionType: ALLOW
    displayName: Require end user credential authenticated sessions.
    description: Allow session creation only if the workload is authenticated
    using end-user credentials.
בסשן צריך להגדיר גרסה מותרת של סביבת זמן ריצה.
    name: organizations/ORGANIZATION_ID/custom.sessionMustUseAllowedVersion
    resourceTypes:
    - dataproc.googleapis.com/Session
    methodTypes:
    - CREATE
    condition: (has(resource.runtimeConfig.version)) &&
    (resource.runtimeConfig.version in ["2.0.45", "2.0.48"])
    actionType: ALLOW
    displayName: Enforce session runtime version.
    description: Only allow session creation if it sets an allowable runtime
    version.
הסשן חייב להגדיר TTL של פחות משעתיים.
    name: organizations/ORGANIZATION_ID/customConstraints/custom.sessionMustSetLessThan2hTtl
    resourceTypes:
    - dataproc.googleapis.com/Session
    methodTypes:
    - CREATE
    condition: (has(resource.environmentConfig.executionConfig.ttl)) &&
    (resource.environmentConfig.executionConfig.ttl <= duration('2h'))
    actionType: ALLOW
    displayName: Enforce session TTL.
    description: Only allow session creation if it sets an allowable TTL.
בסשן אי אפשר להגדיר יותר מ-20 מנהלי משימות ראשוניים של Spark.
    name: organizations/ORGANIZATION_ID/customConstraints/custom.sessionInitialExecutorMax20
    resourceTypes:
    - dataproc.googleapis.com/Session
    methodTypes:
    - CREATE
    condition: (has(resource.runtimeConfig.properties)) &&
    ('spark.executor.instances' in resource.runtimeConfig.properties) &&
    (int(resource.runtimeConfig.properties['spark.executor.instances'])>20)
    actionType: DENY
    displayName: Enforce maximum number of session Spark executor instances.
    description: Deny session creation if it specifies more than 20 Spark executor
    instances.
בסשן אי אפשר להגדיר יותר מ-20 מנהלי משימות ראשוניים להקצאה דינמית של Spark.
    name: organizations/ORGANIZATION_ID/customConstraints/custom.sessionDynamicAllocationInitialExecutorMax20
    resourceTypes:
    - dataproc.googleapis.com/Session
    methodTypes:
    - CREATE
    condition: (has(resource.runtimeConfig.properties)) &&
    ('spark.dynamicAllocation.initialExecutors' in resource.runtimeConfig.properties)
    && (int(resource.runtimeConfig.properties['spark.dynamicAllocation.initialExecutors'])>20)
    actionType: DENY
    displayName: Enforce maximum number of session dynamic allocation initial executors.
    description: Deny session creation if it specifies more than 20 Spark dynamic
    allocation initial executors.
בסשן צריך להגדיר את מפתח ה-KMS לתבנית מותרת.
    name: organizations/ORGANIZATION_ID/customConstraints/custom.sessionKmsPattern
    resourceTypes:
    - dataproc.googleapis.com/Session
    methodTypes:
    - CREATE
    condition: matches(resource.environmentConfig.executionConfig.kmsKey, '^keypattern[a-z]$')
    actionType: ALLOW
    displayName: Enforce session KMS Key pattern.
    description: Only allow session creation if it sets the KMS key to an
    allowable pattern.
בסשן צריך להגדיר את הקידומת של קטגוריית ה-staging לערך מותר.
    name: organizations/ORGANIZATION_ID/customConstraints/custom.sessionStagingBucketPrefix
    resourceTypes:
    - dataproc.googleapis.com/Session
    methodTypes:
    - CREATE
    condition: resource.environmentConfig.executionConfig.stagingBucket.startsWith(ALLOWED_PREFIX)
    actionType: ALLOW
    displayName: Enforce session staging bucket prefix.
    description: Only allow session creation if it sets the staging bucket prefix
    to ALLOWED_PREFIX.
הגדרת הזיכרון של מפעיל הסשן חייבת להסתיים בסיומת m ולהיות קטנה מ-20,000 מ'.
    name: organizations/ORGANIZATION_ID/customConstraints/custom.sessionExecutorMemoryMax
    resourceTypes:
    - dataproc.googleapis.com/Session
    methodTypes:
    - CREATE
    condition: ('spark.executor.memory' in resource.runtimeConfig.properties) &&
    (resource.runtimeConfig.properties['spark.executor.memory'].endsWith('m')) &&
    (int(resource.runtimeConfig.properties['spark.executor.memory'].split('m')[0])<20000)
    actionType: ALLOW
    displayName: Enforce session executor maximum memory.
    description: Only allow session creation if the executor memory setting ends
    with a suffix 'm' and is less than 20000 m.

דוגמה לאילוצים מותאמים אישית למשאב של תבנית סשן (פרופיל זמן ריצה)

בטבלה הבאה מפורטות דוגמאות לאילוצים בהתאמה אישית של תבניות סשנים (פרופילי זמן ריצה) ב-Managed Service for Apache Spark:

תיאור תחביר האילוץ
שם התבנית של הסשן חייב להסתיים ב-org-name.
    name: organizations/ORGANIZATION_ID/customConstraints/custom.denySessionTemplateNameNotEndingWithOrgName
    resourceTypes:
    - dataproc.googleapis.com/SessionTemplate
    methodTypes:
    - CREATE
    - UPDATE
    condition: '!resource.name.endsWith(''org-name'')'
    actionType: DENY
    displayName: DenySessionTemplateNameNotEndingWithOrgName
    description: Deny session template creation/update if its name does not end with 'org-name'
בתבנית הסשן צריך להגדיר גרסה מותרת של סביבת זמן ריצה.
    name: organizations/ORGANIZATION_ID/custom.sessionTemplateMustUseAllowedVersion
    resourceTypes:
    - dataproc.googleapis.com/SessionTemplate
    methodTypes:
    - CREATE
    - UPDATE
    condition: (has(resource.runtimeConfig.version)) &&
    (resource.runtimeConfig.version in ["2.0.45", "2.0.48"])
    actionType: ALLOW
    displayName: Enforce session template runtime version.
    description: Only allow session template creation or update if it sets an
    allowable runtime version.
בתבנית הסשן צריך להגדיר TTL של פחות משעתיים.
    name: organizations/ORGANIZATION_ID/customConstraints/custom.sessionTemplateMustSetLessThan2hTtl
    resourceTypes:
    - dataproc.googleapis.com/SessionTemplate
    methodTypes:
    - CREATE
    - UPDATE
    condition: (has(resource.environmentConfig.executionConfig.ttl)) &&
    (resource.environmentConfig.executionConfig.ttl <= duration('2h'))
    actionType: ALLOW
    displayName: Enforce session template TTL.
    description: Only allow session template creation or update if it sets an
    allowable TTL.
בתבנית הסשן אי אפשר להגדיר יותר מ-20 מנהלי משימות ראשוניים של Spark.
    name: organizations/ORGANIZATION_ID/customConstraints/custom.sessionTemplateInitialExecutorMax20
    resourceTypes:
    - dataproc.googleapis.com/SessionTemplate
    methodTypes:
    - CREATE
    - UPDATE
    condition: (has(resource.runtimeConfig.properties)) &&
    ('spark.executor.instances' in resource.runtimeConfig.properties) &&
    (int(resource.runtimeConfig.properties['spark.executor.instances'])>20)
    actionType: DENY
    displayName: Enforce maximum number of session Spark executor instances.
    description: Deny session template creation or update if it specifies more
    than 20 Spark executor instances.
בתבנית הסשן אי אפשר להגדיר יותר מ-20 מנהלי משימות ראשוניים להקצאה דינמית של Spark.
    name: organizations/ORGANIZATION_ID/customConstraints/custom.sessionTemplateDynamicAllocationInitialExecutorMax20
    resourceTypes:
    - dataproc.googleapis.com/SessionTemplate
    methodTypes:
    - CREATE
    - UPDATE
    condition: (has(resource.runtimeConfig.properties)) &&
    ('spark.dynamicAllocation.initialExecutors' in resource.runtimeConfig.properties)
    && (int(resource.runtimeConfig.properties['spark.dynamicAllocation.initialExecutors'])>20)
    actionType: DENY
    displayName: Enforce maximum number of session dynamic allocation initial executors.
    description: Deny session template creation or update if it specifies more than 20
    Spark dynamic allocation initial executors.
בתבנית הסשן צריך להגדיר את מפתח ה-KMS לתבנית מותרת.
    name: organizations/ORGANIZATION_ID/customConstraints/custom.sessionTemplateKmsPattern
    resourceTypes:
    - dataproc.googleapis.com/SessionTemplate
    methodTypes:
    - CREATE
    - UPDATE
    condition: matches(resource.environmentConfig.executionConfig.kmsKey, '^keypattern[a-z]$')
    actionType: ALLOW
    displayName: Enforce session KMS Key pattern.
    description: Only allow session template creation or update if it sets the KMS key to an
    allowable pattern.
בתבנית הסשן צריך להגדיר את הקידומת של קטגוריית ה-Staging לערך מותר.
    name: organizations/ORGANIZATION_ID/customConstraints/custom.sessionTemplateStagingBucketPrefix
    resourceTypes:
    - dataproc.googleapis.com/SessionTemplate
    methodTypes:
    - CREATE
    - UPDATE
    condition: resource.environmentConfig.executionConfig.stagingBucket.startsWith(ALLOWED_PREFIX)
    actionType: ALLOW
    displayName: Enforce session staging bucket prefix.
    description: Only allow session template creation or update if it sets the staging
    bucket prefix to ALLOWED_PREFIX.
הגדרת הזיכרון של מפעיל תבנית הסשן חייבת להסתיים בסיומת m ולהיות קטנה מ-20,000 מ'.
    name: organizations/ORGANIZATION_ID/customConstraints/custom.sessionTemplateExecutorMemoryMax
    resourceTypes:
    - dataproc.googleapis.com/SessionTemplate
    methodTypes:
    - CREATE
    - UPDATE
    condition: ('spark.executor.memory' in resource.runtimeConfig.properties) &&
    (resource.runtimeConfig.properties['spark.executor.memory'].endsWith('m')) &&
    (int(resource.runtimeConfig.properties['spark.executor.memory'].split('m')[0])<20000)
    actionType: ALLOW
    displayName: Enforce session executor maximum memory.
    description: Only allow session template creation or update if the executor memory setting ends
    with a suffix 'm' and is less than 20000 m.

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