AtlasFederatedAuth自定义资源为您的 Atlas 组织配置联合身份验证。
When you create the AtlasFederatedAuth custom resource, Atlas Kubernetes Operator uses the Federated Authentication API Resource to update the organization configuration for the federation. In the organization configuration, you specify federation settings for your Atlas organization such as organization and role mappings.
重要
自定义资源不再默认删除对象
Atlas Kubernetes Operator使用自定义资源配置文件来管理Atlas配置,但从Atlas Kubernetes Operator2.0 开始,您在Kubernetes中删除的自定义资源不再(默认)在Atlas中删除。相反, Atlas Kubernetes Operator只是停止管理Atlas中的这些资源。
AtlasProject示例,如果您在Kubernetes中删除 自定义资源,默认默认, Atlas Kubernetes Operator不再自动从Atlas中删除相应的项目。这种行为更改旨在帮助防止意外删除。 要学习;了解详情,包括如何将此行为恢复为在Atlas Kubernetes Operator.2 0之前使用的默认,请参阅新默认值: Atlas Kubernetes2 Operator.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 组织的现有身份提供商 ( IdP )。 要了解更多信息,请参阅利用 Kubernetes 的联合身份验证。
示例
以下示例配置了执行以下操作的AtlasFederatedAuth自定义资源:
将
my-org-domain.com添加为已批准的域。为组织启用域限制。
禁用SSO调试。
Grants the
Organization Memberrole to users after authenticating.Maps the
Organization Ownerrole for the organization and applies the role mapping to an IdP group namedorg-admin.Maps the
Organization Project CreatorandProject Ownerroles for a project in the organization nameddev-projectand applies the role mapping to an IdP group nameddev-team.
apiVersion: atlas.mongodb.com/v1 kind: AtlasFederatedAuth metadata: name: atlas-default-federated-auth namespace: mongodb-atlas-system spec: enabled: true dataAccessIdentityProviders: - 32b6e34b3d91647abb20e7b8 - 42d8v92k5a34184rnv93f0c1 connectionSecretRef: name: my-org-secret namespace: mongodb-atlas-system domainAllowList: - my-org-domain.com domainRestrictionEnabled: true ssoDebugEnabled: false postAuthRoleGrants: - ORG_MEMBER roleMappings: - externalGroupName: org-admin roleAssignments: - role: ORG_OWNER - externalGroupName: dev-team roleAssignments: - role: ORG_GROUP_CREATOR - projectName: dev-project role: GROUP_OWNER status: conditions: - type: Ready status: True - type: RolesReady status: True - type: UsersReady status: True
注意
前面的示例包括描述更新过程的status部分。 要了解更多信息,请参阅创建和更新进程。
参数
This section describes the parameters available for the AtlasFederatedAuth custom resource. For detailed descriptions of the parameters, see the Atlas Federated Authentication API Resource.
请参阅这些说明、本页上的示例以及 API 文档来自定义您的规范。
metadata.name类型:字符串
必需
用于标识 Atlas Kubernetes Operator 为组织配置联合身份验证的
AtlasFederatedAuth资源的名称。
metadata.namespace类型:字符串
Optional
要包含
atlasFederatedAuth自定义资源的命名空间。如果未指定, Atlas Kubernetes Operator将使用kubectl设立的当前命名空间。
spec.enabled类型:布尔值
必需
用于确定是否为组织启用联合身份验证的标志。 默认为
false。
spec.dataAccessIdentityProviders类型:列表
Optional
字符串值列表,用于标识Atlas Kubernetes Operator用来为组织配置联合身份验证的身份提供商。
注意
dataAccessIdentityProviders参数定义用于数据访问的一个或多个身份提供者。 这意味着它们用于访问权限实际的MongoDB 数据库实例,如 AtlasDatabaseUser资源中的配置。这与 AtlasFederatedAuth资源中的现有选项不同,后者用于配置为Atlas用户界面使用身份提供程序。
spec.connectionSecretRef.name类型:字符串
必需
不透明密钥的名称,其中包含单个
password字段,其中包含Atlas Kubernetes Operator用于连接到Atlas 的组织ID和API密钥。创建密钥时,请指定orgID、publicApiKey和privateApiKey字段。The secret's API keys must have the
Organization Ownerrole. You can use the same secret from anAtlasProjectCustom Resource only if the secret hasOrganization Ownerpermissions.Atlas Kubernetes Operator 仅监视带有标签
atlas.mongodb.com/type=credentials的密钥,以避免监视不必要的密钥。以下示例标记了密钥:
kubectl label secret the-user-password atlas.mongodb.com/type=credentials 注意
默认下, Atlas Kubernetes Operator将连接密钥保存在与
AtlasProject自定义资源相同的命名空间中。要将密钥存储在其他命名空间中,请指定 spec.connectionSecretRef。命名空间参数。
spec.connectionSecretRef.namespace类型:字符串
Optional
包含密钥的命名空间,该密钥具有组织ID和Atlas Kubernetes Operator用于连接到Atlas 的API密钥。如果省略或未指定此参数, Atlas Kubernetes Operator将连接密钥保存在与
AtlasProject自定义资源相同的命名空间中。
spec.domainAllowList类型:字符串数组
Optional
根据电子邮件地址限制用户加入组织的批准域。
spec.domainRestrictionEnabled类型:布尔值
必需
指示是否为连接的组织启用域限制的标志。 默认为
false。如果您将此参数设置为
true,Atlas 将返回属于联合以外组织的用户列表。 要了解详情,请参阅用户冲突。
spec.ssoDebugEnabled类型:布尔值
Optional
标志,用于指示身份提供程序是否已启用 SSO 调试。默认为
false。
spec.postAuthRoleGrants类型:字符串数组
Optional
身份验证后向该组织中的用户授予的 Atlas 角色。例如:
ORG_MEMBERORG_READ_ONLYORG_BILLING_ADMINORG_GROUP_CREATORORG_OWNERORG_BILLING_READ_ONLY
有关接受值的完整列表,请参阅联合身份验证 API 资源。
spec.roleMappings类型:对象数组
Optional
在此组织中配置的角色映射。
The spec.roleMappings.roleAssignments parameter must include at least one organization role within the current organization or the projects in the organization.
spec.roleMappings.externalGroupName类型:字符串
必需
唯一的人类可读标签,用于标识应用此角色映射的身份提供程序群组。
spec.roleMappings.roleAssignments类型:对象数组
Optional
Atlas 角色以及与每个角色关联的群组和组织的唯一标识符。 此参数必须至少包含当前组织或组织中的项目中的一个组织角色。
spec.roleMappings.roleAssignments.projectName类型:字符串
Optional
同一组织中与角色关联的 Atlas 项目。
spec.roleMappings.roleAssignments.role类型:字符串
Optional
人类可读标签,用于标识 Atlas 授予特定 API 密钥、用户或团队的权限集合。 这些角色包括组织和项目级别的权限。
Atlas Kubernetes Operator 接受以下值:
ORG_MEMBERORG_READ_ONLYORG_BILLING_ADMINORG_GROUP_CREATORORG_OWNERORG_BILLING_READ_ONLYGROUP_OWNERGROUP_READ_ONLYGROUP_DATA_ACCESS_ADMINGROUP_DATA_ACCESS_READ_ONLYGROUP_DATA_ACCESS_READ_WRITEGROUP_CLUSTER_MANAGERGROUP_SEARCH_INDEX_EDITOR