You can use Atlas Kubernetes Operator to manage resources in an Atlas project without using Atlas Kubernetes Operator to manage the project itself. In this independent custom resource definition ("independent CRD") model, you associate resources such as AtlasDeployment Custom Resource and AtlasDatabaseUser Custom Resource with an Atlas project directly by its Atlas ID.
独立した CRD を使用すると、プロジェクトにさまざまなプログラムによるインフラストラクチャ管理システムを使用できますが、Atlas Kubernetes Operator を使用して、データベースユーザーや個別の配置など、より頻繁に変更されるリソースを管理できます。
独立した CRD によって、Atlasプロジェクトのマネジメントをユーザーや配置などのサブリソースのマネジメントから分離することで、ニーズに合わせて組織内の別の担当者やチームにこれらの権限を割り当てることができます。
Considerations
Atlas Kubernetes Operator を使用してプロジェクトを管理する場合、 リソースの パラメータを使用して Atlas Administration API認証を構成するか、このパラメータを未設定のままにしてspec.connectionSecretRef.name atlasProjectグローバル Atlas 認証情報 をデフォルトに設定できます。独立した CRD を使用する場合は、各リソースに対して spec.connectionSecret.name を指定できます。このパラメータを設定すると、spec.connectionSecretRef.name またはグローバル Atlas 認証情報よりも優先されます。
Setting this parameter is required for any resource whose parent resource is referenced using an Atlas project ID, and optional otherwise.
例
atlasProjectspec.name パラメータではなく、Atlas IDで親プロジェクトを参照する atlasDeployment CRD を定義します。次のように、 atlasDeploymentリソースの spec.connectSecret.name を定義する必要があります。
apiVersion: atlas.mongodb.com/v1 kind: AtlasDeployment metadata: name: test-cluster-name namespace: mongodb-atlas-system spec: externalProjectRef: id: 671998971c8520583f24f411 connectionSecret: name: my-atlas-key deploymentSpec: clusterType: REPLICASET name: service-name tags: - key: "environment" value: "production" backupEnabled: true replicationSpecs: - zoneName: US-Zone numShards: 3 regionConfigs: - regionName: CENTRAL_US providerName: GCP backingProviderName: GCP priority: 7 electableSpecs: instanceSize: M10 nodeCount: 3
独立した CRD への移行
既存の CRD を atlasProject レベルのマネジメントから独立したマネジメントに移行するには、次の手順に従います。
プロジェクト調整を無効にし、サブリソース参照を編集する
親リソースの
metadataにmongodb.com/atlas-reconciliation-policy: "skip"アノテーションを追加します。これにより、Atlas Kubernetes Operator が親リソースとそのサブリソースの調整を試みるのを防止します。 次の点を考慮してください。apiVersion: atlas.mongodb.com/v1 kind: AtlasProject metadata: name: my-project annotations: mongodb.com/atlas-reconciliation-policy: "skip" spec: name: Test project connectionSecretRef: name: my-atlas-key projectIpAccessList: - cidrBlock: "203.0.113.0/24" comment: "CIDR block for Application Server B - D" 警告
この注釈を適用しない場合、他のリソースを変更する際に、Atlas Kubernetes Operator は引き続き調整を試行します。 新しいデフォルト: Atlas Kubernetes OperatorAtlas Kubernetes Operator2.0 の削除保護が無効になっているユーザーの場合、これにより、Atlas Kubernetes Operator リソースを削除するとAtlas
atlasProjectAtlas Kubernetes Operator が Atlasプロジェクトを削除するか、アクティブなサブリソースを持つプロジェクトを削除しようとすると ブロック状態になる可能性があります。データベースユーザーや配置など。Modify the project reference to point to an Atlas project ID instead of an
atlasProjectname.例、
atlasDatabaseUserリソースを減算するには次のようにします。apiVersion: atlas.mongodb.com/v1 kind: AtlasDatabaseUser metadata: name: my-database-user spec: roles: - roleName: readWriteAnyDatabase databaseName: admin externalProjectRef: id: 671998971c8520583f24f411 username: theuser passwordSecretRef: name: the-user-password