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 프로젝트 관리 를 사용자 및 배포와 같은 하위 리소스 관리 에서 분리함으로써 필요에 따라 이러한 책임을 조직 내의 다른 직원이나 다른 팀에 할당할 수 있습니다.
고려 사항
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.
예시
atlasProject spec.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 Operator 에서 새 기본값: 삭제 보호 2.0 기능이 비활성화된 사용자의 경우, 리소스 를 제거 할 때 Atlas Kubernetes Operator 가 Atlas 프로젝트 를
atlasProject제거하거나 활성 하위 리소스가 있는 프로젝트 를 제거 하려고 시도하는 차단된 상태 가 될 수 있습니다. 예를 들어 데이터베이스 사용자 또는 배포서버입니다.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