18.2. 运行 LDAP 同步

创建了同步配置文件后,您可以开始同步。OpenShift Container Platform 允许管理员与同一服务器进行多种不同类型的同步。

18.2.1. 将 LDAP 服务器与 OpenShift Container Platform 同步

您可以将 LDAP 服务器上的所有组与 OpenShift Container Platform 同步。

先决条件

  • 创建同步配置文件。

流程

  • 将 LDAP 服务器上的所有组与 OpenShift Container Platform 同步:

    $ oc adm groups sync --sync-config=config.yaml --confirm
    注意

    默认情况下,所有组同步操作都是空运行(dry-run),因此您必须在 oc adm groups sync 命令上设置 --confirm 标志,才能更改 OpenShift Container Platform 组记录。

18.2.2. 将 OpenShift Container Platform 组与 LDAP 服务器同步

您可以同步所有已在 OpenShift Container Platform 中并与配置文件中指定的 LDAP 服务器中的组相对应的组。

先决条件

  • 创建同步配置文件。

流程

  • 将 OpenShift Container Platform 组与 LDAP 服务器同步:

    $ oc adm groups sync --type=openshift --sync-config=config.yaml --confirm
    注意

    默认情况下,所有组同步操作都是空运行(dry-run),因此您必须在 oc adm groups sync 命令上设置 --confirm 标志,才能更改 OpenShift Container Platform 组记录。

18.2.3. 将 LDAP 服务器上的子组与 OpenShift Container Platform 同步

您可以使用白名单文件和/或黑名单文件,将 LDAP 组的子集与 OpenShift Container Platform 同步。

注意

您可以使用黑名单文件、白名单文件或白名单字面量的任意组合。白名单和黑名单文件必须每行包含一个唯一组标识符,您可以在该命令本身中直接包含白名单字面量。这些准则适用于在 LDAP 服务器上找到的组,以及 OpenShift Container Platform 中已存在的组。

先决条件

  • 创建同步配置文件。

流程

  • 要将 LDAP 组的子集与 OpenShift Container Platform 同步,请使用以下任一命令:

    $ oc adm groups sync --whitelist=<whitelist_file> \
                       --sync-config=config.yaml      \
                       --confirm
    $ oc adm groups sync --blacklist=<blacklist_file> \
                       --sync-config=config.yaml      \
                       --confirm
    $ oc adm groups sync <group_unique_identifier>    \
                       --sync-config=config.yaml      \
                       --confirm
    $ oc adm groups sync <group_unique_identifier>  \
                       --whitelist=<whitelist_file> \
                       --blacklist=<blacklist_file> \
                       --sync-config=config.yaml    \
                       --confirm
    $ oc adm groups sync --type=openshift           \
                       --whitelist=<whitelist_file> \
                       --sync-config=config.yaml    \
                       --confirm
    注意

    默认情况下,所有组同步操作都是空运行(dry-run),因此您必须在 oc adm groups sync 命令上设置 --confirm 标志,才能更改 OpenShift Container Platform 组记录。