从Atlas Kubernetes Operator版本 2.6 开始,以前采用参数形式的各种资源配置已转换为自己的 CRD。 对基于参数的父资源配置的支持已弃用。 现有的基于参数的父资源配置将继续有效,但未来发布将删除对这些配置的支持。
如需将来继续通过Atlas Kubernetes Operator管理这些资源,迁移到相应的 CRD。
受影响的配置
以下配置会受到影响:
Parameter | CRD |
|---|---|
| |
|
特定于资源的注意事项
在将参数迁移到资源之前,请考虑特定于这些参数的任何实施细节。
网络对等
以下注意事项应用于 atlasNetworkPeering 资源:
atlasNetworkPeeringCRD 可以通过Kubernetes名称引用或ID引用其相应的atlasNetworkContainer。atlasNetworkPeeringCRD 可以通过Kubernetes名称引用或ID来引用托管它的atlasProject。The spec.networkPeers parameter of an
atlasProjectCRD contains details of both the peering connection itself and the container that supports it. When you migrate from this parameter to anatlasNetworkPeeringCRD, you might need to create anatlasNetworkContainerCRD for the container that supports it. To learn more, see Network Container.
网络容器
以下注意事项应用于 atlasNetworkContainer 资源:
如果出现以下任一情况,则在将
atlasNetworkPeering连接从参数迁移到资源时,无需创建新的atlasNetworkContainer资源:您管理支持Atlas Kubernetes Operator
atlasProject之外的atlasNetworkPeering连接的网络容器,您可以在其中管理atlasNetworkPeering连接atlasNetworkPeering连接容器的atlasNetworkContainer资源已存在。
atlasNetworkContainerCRD 可以通过Kubernetes名称引用或ID引用其托管atlasProject。
第三方集成
以下注意事项应用于 AtlasThirdPartyIntegration 资源:
每个第三方集成都需要自己的
AtlasThirdPartyIntegration资源。您不能在同一资源中定义多个集成。每个项目只能有特定类型第三方集成的一个实例,无论是由
AtlasProject资源中该类型的spec.integrations条目配置,还是由具有该值的spec.type的AtlasThirdPartyIntegration资源配置。示例,如果您的
AtlasThirdPartyIntegrationCRD 为spec.typeDATADOG,则无法在AtlasProject资源中声明spec.integrations.type为DATADOG。
迁移过程
要从参数级资源管理迁移到 CRD管理:
禁用项目协调并编辑子资源引用。
将
mongodb.com/atlas-reconciliation-policy: "skip"注解添加到父资源的metadata。 这可以防止Atlas Kubernetes Operator尝试协调父资源及其子资源。为防止与您创建的新 CRD 发生冲突,您必须从父资源中删除与要迁移的资源对应的参数。
考虑以下具有 customRoles 配置的 atlasProject示例:
apiVersion: atlas.mongodb.com/v1 kind: AtlasProject metadata: name: my-project spec: name: Test project connectionSecretRef: name: my-atlas-key customRoles: 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 projectIpAccessList: - cidrBlock: "203.0.113.0/24" comment: "CIDR block for Application Server B - D"
确保您已在第 5 和 6 行中添加 annotations区块,并删除上示例中所示的 customRoles区块。
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 KubernetesAtlas Kubernetes Operator AtlasOperator在您删除atlasProject 资源时删除Atlas项目,或者在尝试删除具有活动子资源的项目时进入阻止状态例如数据库用户或部署。
从父 CRD 中删除参数。
为防止与您创建的新 CRD 发生冲突,您必须先从父资源中删除与要迁移的资源对应的参数。 示例,从之前显示的 atlasProject CRD 中删除customRoles 参数:
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"
创建新的 CRD。
根据要迁移的参数的语法,为该参数创建相应的 kind CRD。 示例,要迁移前面显示的customRoles atlasProjectCRD 的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。