重要
レガシー サブリソースは、対応する CRD のリリース時点で非推奨となります。構成が現在、このリソース定義のサブリソース形式に依存している場合は、CRD に移行します。
The AtlasCustomRole custom resource defines a custom database role to allocate privileges to your database users.
特定のプロジェクト内でこのカスタムロールを作成するには、次のいずれかを行う必要があります。
Atlas Kubernetes Operator で管理するプロジェクトで、 カスタムリソースで カスタム
AtlasProjectリソース名を参照します。AtlasCustomRoleReference the project ID of your Atlas project in the
AtlasCustomRolecustom resource, for projects you don't manage with Atlas Kubernetes Operator
重要
カスタム リソースはデフォルトでオブジェクトを削除しなくなりました
Atlas Kubernetes Operator はカスタムリソース構成ファイルを使用して Atlas 構成を管理しますが、Atlas Kubernetes Operator2.0 以降、 Kubernetesで削除したカスタム リソースは Atlas で削除されなくなりました(デフォルトでは )。代わりに、Atlas Kubernetes Operator は Atlas 内のそれらのリソースの管理を停止します。 例、 Kubernetesで カスタム リソースを削除すると、デフォルトでは、Atlas Kubernetes Operator は Atlas
AtlasProjectから対応するプロジェクトを自動的に削除しなくなります。この動作の変更は、誤ってまたは予期せずに削除されるのを防ぐことを目的としています。 この動作を Atlas Kubernetes Operator. 以前に使用されていたデフォルトに戻す方法などの詳細については、「2 0新しいデフォルト: Atlas Kubernetes Operator. の削除保護2 0」を参照してください。同様に、Atlas Kubernetes Operator を使用してKubernetesの Atlasプロジェクトからチームを削除しても、Atlas Kubernetes Operator は Atlas からチームを削除しません。
デフォルトのAtlas 構成値が暗黙的に使用されるのを避けるために、必要な構成の詳細を明示的に定義します。 場合によっては、Atlas のデフォルトを継承すると調整ループが発生し、カスタムリソースが
READY状態に達しなくなります。 例、含まれている例に示すように、AtlasDeploymentカスタムリソースで必要なオートスケーリング動作を明示的に定義すると、カスタムリソース内の静的インスタンスサイズが、オートスケーリングが有効になっている Atlas 配置に繰り返し適用されないことが保証されます。autoScaling: diskGB: enabled: true compute: enabled: true scaleDownEnabled: true minInstanceSize: M30 maxInstanceSize: M40
Atlas Kubernetes Operator は、Atlas カスタム データベース ロールAPIリソースを使用して次のいずれかのアクションを実行します。
新しいカスタムデータベースロールを作成します。
既存のカスタムデータベースロールをアップデートします。
例
基本的な例
次の例では、 my-projectプロジェクト内の シャーディングされたクラスター をバックアップとモニタリングの特権を持つ shard-operatorカスタムロールを定義する AtlasCustomRole カスタムリソースが示されています。
apiVersion: atlas.mongodb.com/v1 kind: AtlasCustomRole metadata: name: shard-operator-role namespace: mongodb-atlas-system labels: mongodb.com/atlas-reconciliation-policy: keep spec: projectRef: name: my-project namespace: my-operator-namespace role: name: my-role actions: - name: getShardMap resources: cluster: true - name: shardingState resources: cluster: true - name: connPoolStats resources: cluster: true - name: getLog resources: cluster: true inheritedRoles: - name: operator-role-1 role: backup
独立した CRD の例
The following example shows an AtlasCustomRole independent CRD that defines the same shard-operator custom role defined in the Basic Example. This custom resource definition allows you to create this role in a project you don't manage in the same instance of Atlas Kubernetes Operator with which you define this resource. To enable independent operation, you must use an externalProjectRef instead of a projectRef, and you must supply a connectionSecret directly since this resource can't inherit API credentials from its parent project.
apiVersion: atlas.mongodb.com/v1 kind: AtlasCustomRole metadata: name: shard-operator-role namespace: mongodb-atlas-system labels: mongodb.com/atlas-reconciliation-policy: keep spec: externalProjectRef: id: 671998971c8520583f24f411 connectionSecret: name: my-atlas-key role: name: my-role actions: - name: getShardMap resources: cluster: true - name: shardingState resources: cluster: true - name: connPoolStats resources: cluster: true - name: getLog resources: cluster: true inheritedRoles: - name: operator-role-1 role: backup
パラメーター
AtlascustomRole
AtlasCustomRole は、AtlasCustomRole APIのスキーマです
Name | タイプ | 説明 | 必須 |
|---|---|---|---|
| string | atlas.mongodb.com/v1 | true |
| string |
| true |
| オブジェクト |
| true |
| オブジェクト |
| false |
| オブジェクト |
| false |
AtlascustomRole.spec
AtlasCustomRoleSpec は、Atlas の CustomRole の状態を定義します。
Name | タイプ | 説明 | 必須 |
|---|---|---|---|
| オブジェクト | ロールは Atlas のカスタムロールを表します。 | true |
| オブジェクト | Atlas | false |
| オブジェクト |
| false |
| オブジェクト |
| false |
AtlasCustomRole.spec.ロール
ロールは Atlas のカスタムロールを表します。
Name | タイプ | 説明 | 必須 |
|---|---|---|---|
| string | ロールを識別する、人間が判読できるラベル。この | true |
| []オブジェクト | ロールが付与する個々の権限 | false |
| []オブジェクト | このカスタムロールが継承する組み込みロールのリスト。 | false |
AtlasCustomRole.spec.ロール.アクション
Name | タイプ | 説明 | 必須 |
|---|---|---|---|
| string | 特権アクションを識別する、人間が判読可能なラベル。 | true |
| []オブジェクト | アクションを付与する | true |
AtlasCustomRole.spec.ロール.アクション.リソース
Name | タイプ | 説明 | 必須 |
|---|---|---|---|
| ブール値 |
| false |
| string | 1 人の | false |
| string | 1 人の | false |
Atlas
Name | タイプ | 説明 | 必須 |
|---|---|---|---|
| string | 誰かが 1 人の | true |
| string | 継承されたロールを識別する、人間が判読できるラベル。 | true |
AtlasCustomRole.spec. connectionSecret
Atlas API の秘密キーと公開キーを含むシークレットの名前。
Name | タイプ | 説明 | 必須 |
|---|---|---|---|
| string | 参照されているリソースの名前の詳細情報: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names | true |
AtlasCustomRole.spec.externalProjectRef
externalProjectRef は親 AtlasプロジェクトIDを保持します。"projectRef"フィールドと排他関係にあります。
Name | タイプ | 説明 | 必須 |
|---|---|---|---|
| string |
| true |
AtlascustomRole.spec.projectRef
projectRef は、親の Atlas Projectリソースへの参照です。"external ProjectRef"フィールドと排他関係にあります。
Name | タイプ | 説明 | 必須 |
|---|---|---|---|
| string | Kubernetesリソースの名前 | true |
| string | Kubernetesリソースの名前空間 | false |
AtlasCustomRole.status
AtlasCustomRoleStatus は、 AtlascustomRole カスタムリソースのステータスです。Atlas プロジェクト に含まれていないもの
Name | タイプ | 説明 | 必須 |
|---|---|---|---|
| []オブジェクト | 条件は、Atlas カスタム リソースの現在の状態を示すステータスのリストです | true |
| integer |
| false |
AtlascustomRole.status.条件
条件 は、 特定の点における Atlas カスタム リソースの状態を表します。
Name | タイプ | 説明 | 必須 |
|---|---|---|---|
| string | 条件のステータス。 True、False、Unknown のいずれか 1 つ。 | true |
| string | Atlas カスタム リソース条件のタイプ。 | true |
| string | 条件があるステータスから別のステータスに最後に移行した時刻。 | false |
| string | 移行に関する詳細を提供する | false |
| string | 条件の最後の移行の | false |