カスタム制約を使用する
Google Cloud 組織のポリシーを使用すると、組織のリソースをプログラマティックに一元管理できます。組織のポリシー管理者は組織のポリシーを定義できます。組織のポリシーは、Google Cloud リソース階層内のGoogle Cloud リソースやそれらのリソースの子孫に適用される、制約と呼ばれる一連の制限です。組織のポリシーは、組織レベル、フォルダレベル、またはプロジェクト レベルで適用できます。
組織のポリシーは、さまざまなGoogle Cloud サービスに事前に定義された制約を提供します。ただし、組織のポリシーで制限されている特定のフィールドをきめ細かく制御する必要がある場合は、カスタム制約を作成して、組織のポリシーでそれらのカスタム制約を使用することもできます。
利点
カスタムの組織のポリシーを使用すると、Dataproc サーバーレス バッチとセッションに対する特定のオペレーションを許可または拒否できます。たとえば、バッチ ワークロードの作成リクエストが、組織のポリシーによって設定されたカスタム制約検証を満たしていない場合、リクエストは失敗し、エラーが呼び出し元に返されます。
ポリシーの継承
デフォルトでは、組織のポリシーは、そのポリシーを適用したリソースの子孫に継承されます。たとえば、フォルダにポリシーを適用した場合、 Google Cloud はそのフォルダ内のすべてのプロジェクトにそのポリシーを適用します。この動作の詳細と変更方法については、階層評価ルールをご覧ください。
料金
事前に定義された制約やカスタム制約を含む組織のポリシー サービスは無料です。
準備
- プロジェクトを設定する
- Sign in to your Google Cloud account. If you're new to Google Cloud, create an account to evaluate how our products perform in real-world scenarios. New customers also get $300 in free credits to run, test, and deploy workloads.
-
In the Google Cloud console, on the project selector page, select or create a Google Cloud project.
-
Make sure that billing is enabled for your Google Cloud project.
-
Enable the Dataproc Serverless API.
- Install the Google Cloud CLI.
-
To initialize the gcloud CLI, run the following command:
gcloud init
-
In the Google Cloud console, on the project selector page, select or create a Google Cloud project.
-
Make sure that billing is enabled for your Google Cloud project.
-
Enable the Dataproc Serverless API.
- Install the Google Cloud CLI.
-
To initialize the gcloud CLI, run the following command:
gcloud init
- 組織 ID を確実に把握します。
必要なロール
組織のポリシーを管理するために必要な権限を取得するには、組織リソースに対する組織ポリシー管理者 (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 ファイルで定義されます。Dataproc Serverless は、バッチ リソースとセッション リソースの CREATE
メソッドに適用されるカスタム制約をサポートしています。
カスタム制約の作成方法については、カスタム制約の定義をご覧ください。
バッチリソースのカスタム制約を作成する
バッチ リソースの Dataproc Serverless カスタム制約の YAML ファイルを作成するには、次の形式を使用します。
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
: 組織 ID(123456789
など)。CONSTRAINT_NAME
: 新しいカスタム制約に付ける名前。カスタム制約はcustom.
で始まる必要があり、大文字、小文字、数字のみを含めることができます(例:custom.batchMustHaveSpecifiedCategoryLabel
)。このフィールドの最大長は 70 文字です。接頭辞(例:organizations/123456789/customConstraints/custom
)はカウントされません。CONDITION
: サポート対象のサービス リソースの表現に対して書き込まれる CEL 条件。このフィールドの最大長は 1,000 文字です。条件の書き込み先として使用できるリソースの詳細については、リソースとオペレーションに対する Dataproc サーバーレスの制約をご覧ください。サンプルの状態:("category" in resource.labels) && (resource.labels['category'] in ['retail', 'ads', 'service'])
。ACTION
: 条件が満たされている場合に実行するアクション。ALLOW
またはDENY
になります。DISPLAY_NAME
: 制約の名前。わかりやすい名前を入力してください。表示名の例: 「バッチの「category」ラベルの要件を適用する」。このフィールドの最大長は 200 文字です。DESCRIPTION
: ポリシー違反時にエラー メッセージとして表示される制約の説明。わかりやすい説明を入力してください。このフィールドの最大長は 2,000 文字です。説明の例: 「「retail」、「ads」、「service」の値を持つ「category」ラベルがある場合にのみ、Dataproc のバッチ作成を許可します」。
セッション リソースのカスタム制約を作成する
セッション リソースの Dataproc Serverless カスタム制約の YAML ファイルを作成するには、次の形式を使用します。
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
: 組織 ID(123456789
など)。CONSTRAINT_NAME
: 新しいカスタム制約に付ける名前。カスタム制約はcustom.
で始まる必要があり、大文字、小文字、数字のみを含めることができます(例:custom.SessionNameMustStartWithTeamName
)。このフィールドの最大長は 70 文字です。接頭辞organizations/123456789/customConstraints/
はカウントされません。例:organizations/123456789/customConstraints/custom
CONDITION
: サポート対象のサービス リソースの表現に対して書き込まれる CEL 条件。このフィールドの最大長は 1,000 文字です。条件の書き込み先として使用できるリソースの詳細については、リソースとオペレーションに対する Dataproc サーバーレスの制約をご覧ください。サンプル条件:(resource.name.startsWith("dataproc")
。ACTION
: 条件が満たされている場合に実行するアクション。ALLOW
またはDENY
になります。DISPLAY_NAME
: 制約の名前。わかりやすい名前を入力してください。表示名の例: 「Enforce session must have a ttl < 2 hours」このフィールドの最大長は 200 文字です。DESCRIPTION
: ポリシー違反時にエラー メッセージとして表示される制約の説明。わかりやすい説明を入力してください。このフィールドの最大長は 2,000 文字です。説明の例: 「許容される TTL が設定されている場合にのみ、セッションの作成を許可します」。
カスタム制約を設定する
新しいカスタム制約の YAML ファイルを作成したら、組織内の組織のポリシーで使用できるように設定する必要があります。カスタム制約を設定するには、gcloud org-policies set-custom-constraint
コマンドを使用します。gcloud org-policies set-custom-constraint CONSTRAINT_PATH
CONSTRAINT_PATH
は、カスタム制約ファイルのフルパスに置き換えます。たとえば、/home/user/customconstraint.yaml
です。完了すると、カスタム制約が組織のポリシーとして Google Cloud 組織のポリシーのリストに表示されます。カスタム制約が存在することを確認するには、gcloud org-policies list-custom-constraints
コマンドを使用します。gcloud org-policies list-custom-constraints --organization=ORGANIZATION_ID
ORGANIZATION_ID
は、組織リソースの ID に置き換えます。詳細については、組織のポリシーの表示をご覧ください。カスタム制約を適用する
ブール型制約を適用するには、それを参照する組織のポリシーを作成し、その組織のポリシーを Google Cloud リソースに適用します。Console
- Google Cloud コンソールで、[組織のポリシー] ページに移動します。
- プロジェクト選択ツールで、組織のポリシーを設定するプロジェクトを選択します。
- [組織のポリシー] ページのリストで制約を選択して、その制約の [ポリシーの詳細] ページを表示します。
- このリソースの組織のポリシーを構成するには、[ポリシーを管理] をクリックします。
- [ポリシーの編集] ページで、[Override parent's policy] を選択します。
- [ルールを追加] をクリックします。
- [適用] セクションで、この組織のポリシーの適用を有効にするかどうかを選択します。
- 省略可: タグで組織のポリシーに条件を設定するには、[条件を追加] をクリックします。組織のポリシーに条件付きルールを追加する場合は、少なくとも 1 つは無条件のルールを追加する必要があります。そうしないとポリシーを保存できないのでご注意ください。詳細については、タグ付きの組織のポリシーの設定をご覧ください。
- カスタム制約の場合は、[変更内容をテスト] をクリックして、組織のポリシーの効果をシミュレートできます。詳細については、Policy Simulator で組織のポリシーの変更をテストするをご覧ください。
- 組織のポリシーを完成させて適用するには、[ポリシーを設定] をクリックします。ポリシーが有効になるまでに最大 15 分かかります。
gcloud
ブール型制約を適用する組織のポリシーを作成するには、制約を参照するポリシー YAML ファイルを作成します。
name: projects/PROJECT_ID/policies/CONSTRAINT_NAME spec: rules: - enforce: true
次のように置き換えます。
-
PROJECT_ID
: 制約を適用するプロジェクト。 -
CONSTRAINT_NAME
: カスタム制約に定義した名前。たとえば、
のようにします。custom.batchMustHaveSpecifiedCategoryLabel
制約を含む組織のポリシーを適用するには、次のコマンドを実行します。
gcloud org-policies set-policy POLICY_PATH
POLICY_PATH
は、組織のポリシーの YAML ファイルのパスに置き換えます。ポリシーが有効になるまでに最大 15 分かかります。
カスタム制約をテストする
このセクションでは、バッチ リソースとセッション リソースのカスタム制約をテストする方法について説明します。
バッチリソースのカスタム制約をテストする
次のバッチ作成例では、カスタム制約が作成され、バッチ作成時に適用され、バッチに「retail」、「ads」、「service」の値が設定された「category」ラベルが付加されている必要があります: ("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""]
セッション リソースのカスタム制約をテストする
次のセッション作成例では、カスタム制約が作成され、セッション作成時に適用され、セッションに orgName
で始まる name
が含まれている必要があります。
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'"]
リソースとオペレーションに対する Dataproc サーバーレスの制約
このセクションでは、バッチ リソースとセッション リソースで使用可能な Dataproc Serverless カスタム制約について説明します。
サポートされている Dataproc Serverless バッチ制約
次の Dataproc サーバーレスのカスタム制約は、バッチ ワークロードを作成(送信)するときに使用できます。
全般
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
PeripheralsConfig
resource.environmentConfig.peripheralsConfig.metastoreService
resource.environmentConfig.peripheralsConfig.sparkHistoryServerConfig.dataprocCluster
サポートされている Dataproc Serverless セッションの制約
サーバーレス セッションにカスタム制約を作成するときに、次の Dataproc サーバーレス セッション属性を使用できます。
全般
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
PeripheralsConfig
resource.environmentConfig.peripheralsConfig.metastoreService
resource.environmentConfig.peripheralsConfig.sparkHistoryServerConfig.dataprocCluster
一般的なユースケースのカスタム制約の例
このセクションでは、バッチ リソースとセッション リソースの一般的なユースケースのカスタム制約の例を示します。
バッチリソースのカスタム制約の例
次の表に、Dataproc サーバーレス バッチのカスタム制約の例を示します。
説明 | 制約の構文 |
---|---|
Batch には、許可された値を含む「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. |
バッチでは、TTL を 2 時間未満に設定する必要があります。 |
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 では、ステージング バケットの接頭辞を許可された値に設定する必要があります。 |
name: organizations/ORGANIZATION_ID/customConstraints/custom.batchStagingBucketPrefix
resourceTypes:
- dataproc.googleapis.com/Batch
methodTypes:
- CREATE
condition: resource.environmentConfig.executionConfig.stagingBucket.startsWith( |
バッチ エグゼキュータのメモリ設定は、末尾が m で、20,000 m 未満にする必要があります。 |
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. |
セッション リソースのカスタム制約の例
次の表に、Dataproc サーバーレス セッションのカスタム制約の例を示します。
説明 | 制約の構文 |
---|---|
セッションで 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 は、承認済みのテンプレート ID と等しい必要があります。 |
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/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 を 2 時間未満に設定する必要があります。 |
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. |
セッションで設定できる Spark 動的割り当て初期エグゼキュータは 20 個までです。 |
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. |
Session では、ステージング バケットの接頭辞を許可された値に設定する必要があります。 |
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 batch creation if it sets the staging bucket prefix to ALLOWED_PREFIX. |
セッション エグゼキュータのメモリ設定は、末尾が m で、20,000 m 未満にする必要があります。 |
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. |
次のステップ
- 組織のポリシーの詳細については、組織ポリシー サービスの概要をご覧ください。
- 組織のポリシーの作成と管理の方法について学習する。
- 事前定義された組織のポリシーの制約の完全なリストを確認する。