ClusterMongoDBRole
自定义资源允许您配置用户访问 MongoDB 数据库所需的 角色。
例子
以下示例显示了ClusterMongoDBRole
自定义资源的资源规范:
1 2 apiVersion: mongodb.com/v1 3 kind: ClusterMongoDBRole 4 metadata: 5 name: ldap-user-1 6 spec: 7 role: "customRole" 8 db: admin 9 privileges: 10 - actions: 11 - insert 12 resource: 13 collection: cats 14 db: pets 15 - actions: 16 - insert 17 - find 18 resource: 19 collection: dogs 20 db: pets 21 ...
所需的ClusterMongoDBRole
资源设置
spec.authenticationRestrictions
类型:数组
定义分配此
spec.security.roles.role
的用户可以连接的IP解决的数组。
spec.db
类型:字符串
应用权限
spec.privileges.actions
的数据库。如果您为此设置提供了值,则还必须为
spec.privileges.resource
提供一个值。
spec.privileges.actions
类型:数组
授予此角色的用户可以执行的操作列表。有关接受值的列表,请参阅使用Kubernetes Operator部署的MongoDB版本的MongoDB Server文档中的特权操作。
spec.privileges.resource
类型:集合
特权
spec.privileges.actions
适用的资源。此集合必须包含以下任一项:
spec.privileges.resource.db
类型:字符串
应用权限
spec.privileges.actions
的数据库。如果您为此设置提供了值,则还必须为
spec.privileges.resource.collection
提供一个值。
spec.privileges.resource.collection
类型:字符串
spec.privileges.resource.db
中适用权限spec.privileges.actions
的集合。如果您为此设置提供了值,则还必须为
spec.privileges.resource.db
提供一个值。