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类型:字符串
Database for which the privilege
spec.privileges.actionsapply.If you provide a value for this setting, you must also provide a value for
spec.privileges.resource.
spec.privileges.actions类型:数组
授予此角色的用户可以执行的操作列表。有关接受值的列表,请参阅使用Kubernetes Operator部署的MongoDB版本的MongoDB Server文档中的特权操作。
spec.privileges.resource类型:集合
Resources for which the privilege
spec.privileges.actionsapply.此集合必须包含以下任一项:
spec.security.roles.privileges.resource.cluster值为true的 设置。
spec.privileges.resource.db类型:字符串
Database for which the privilege
spec.privileges.actionsapply.If you provide a value for this setting, you must also provide a value for
spec.privileges.resource.collection.
spec.privileges.resource.collection类型:字符串
Collection in the
spec.privileges.resource.dbfor which the privilegespec.privileges.actionsapply.If you provide a value for this setting, you must also provide a value for
spec.privileges.resource.db.