17.5. LDAP 组同步示例
本节包含 RFC 2307、Active Directory 和增强 Active Directory 模式的示例。
这些示例假定所有用户都是其各自组的直接成员。具体而言,没有任何组的成员是其他组。如需有关如何同步嵌套组的信息,请参见嵌套成员资格同步示例。
17.5.1. 使用 RFC 2307 模式同步组 复制链接链接已复制到粘贴板!
对于 RFC 2307 模式,以下示例将同步名为 admins 的组,该组有两个成员 Jane 和 Jim。这些示例阐述了:
- 如何将组和用户添加到 LDAP 服务器中。
- 同步之后 OpenShift Container Platform 中会生成什么组记录。
这些示例假定所有用户都是其各自组的直接成员。具体而言,没有任何组的成员是其他组。如需有关如何同步嵌套组的信息,请参见嵌套成员资格同步示例。
在 RFC 2307 模式中,用户(Jane 和 Jim)和组都作为第一类条目存在于 LDAP 服务器上,组成员资格则存储在组的属性中。以下 ldif 片段定义了这个模式的用户和组:
使用 RFC 2307 模式的 LDAP 条目:rfc2307.ldif
dn: ou=users,dc=example,dc=com
objectClass: organizationalUnit
ou: users
dn: cn=Jane,ou=users,dc=example,dc=com
objectClass: person
objectClass: organizationalPerson
objectClass: inetOrgPerson
cn: Jane
sn: Smith
displayName: Jane Smith
mail: jane.smith@example.com
dn: cn=Jim,ou=users,dc=example,dc=com
objectClass: person
objectClass: organizationalPerson
objectClass: inetOrgPerson
cn: Jim
sn: Adams
displayName: Jim Adams
mail: jim.adams@example.com
dn: ou=groups,dc=example,dc=com
objectClass: organizationalUnit
ou: groups
dn: cn=admins,ou=groups,dc=example,dc=com
objectClass: groupOfNames
cn: admins
owner: cn=admin,dc=example,dc=com
description: System Administrators
member: cn=Jane,ou=users,dc=example,dc=com
member: cn=Jim,ou=users,dc=example,dc=com
先决条件
- 创建配置文件。
流程
使用
rfc2307_config.yaml文件运行同步:$ oc adm groups sync --sync-config=rfc2307_config.yaml --confirmOpenShift Container Platform 创建以下组记录作为上述同步操作的结果:
使用
rfc2307_config.yaml文件创建的 OpenShift Container Platform 组apiVersion: user.openshift.io/v1 kind: Group metadata: annotations: openshift.io/ldap.sync-time: 2015-10-13T10:08:38-04001 openshift.io/ldap.uid: cn=admins,ou=groups,dc=example,dc=com2 openshift.io/ldap.url: LDAP_SERVER_IP:3893 creationTimestamp: name: admins4 users:5 - jane.smith@example.com - jim.adams@example.com