14.3. 为新角色创建 NIC 模板


在 Red Hat OpenStack Platform (RHOSP) 16.2 中,tripleo NIC 模板默认包含 InterfaceRoutes 参数。您通常会设置在 Networking 服务(neutron)网络的 host_routes 属性的 environments/network-environment.yaml 配置文件中呈现的 routes 参数。然后,将其添加到 InterfaceRoutes 参数。

在 director Operator 中,Networking 服务(neutron)不存在。要为新角色创建新的 NIC 模板,您必须将特定网络的路由添加到 NIC 模板,并串联列表。

14.3.1. 创建默认网络路由

通过将网络路由添加到 NIC 模板来创建默认网络路由,然后串联列表。

流程

  1. 打开 NIC 模板。
  2. 将网络路由添加到模板,然后串联列表:

    parameters:
      ...
      {{ $net.Name }}Routes:
        default: []
        description: >
          Routes for the storage network traffic.
          JSON route e.g. [{'destination':'10.0.0.0/16', 'nexthop':'10.0.0.1'}]
          Unless the default is changed, the parameter is automatically resolved
          from the subnet host_routes attribute.
        type: json
      ...
                  - type: interface
                    ...
                    routes:
                      list_concat_unique:
                        - get_param: {{ $net.Name }}Routes
                        - get_param: {{ $net.Name }}InterfaceRoutes
    Copy to Clipboard Toggle word wrap

14.3.2. 子网路由

路由子网信息会自动呈现到由 Ansible playbook 使用的 tripleo 环境文件 环境/network-environment.yaml。在 NIC 模板中,使用 Routes_<subnet_name > 参数在主机上设置正确的路由,如 StorageRoutes_storage_leaf1

14.3.3. 修改 spine-leaf 网络的 NIC 模板

要配置 spine-leaf 网络,请修改每个角色的 NIC 模板并重新创建 ConfigMap。

前提条件

  • OpenShift Container Platform 集群可以正常工作,且您已正确安装了 director Operator。
  • 您已在工作站上安装了 oc 命令行工具。

流程

  1. 为每个 Compute 角色创建 NIC 模板:

    ...
      StorageRoutes_storage_leaf1:
        default: []
        description: >
          Routes for the storage network traffic.
          JSON route e.g. [{'destination':'10.0.0.0/16', 'nexthop':'10.0.0.1'}]
          Unless the default is changed, the parameter is automatically resolved
          from the subnet host_routes attribute.
        type: json
    ...
      InternalApiRoutes_internal_api_leaf1:
        default: []
        description: >
          Routes for the internal_api network traffic.
          JSON route e.g. [{'destination':'10.0.0.0/16', 'nexthop':'10.0.0.1'}]
          Unless the default is changed, the parameter is automatically resolved
          from the subnet host_routes attribute.
        type: json
    ...
      TenantRoutes_tenant_leaf1:
        default: []
        description: >
          Routes for the internal_api network traffic.
          JSON route e.g. [{'destination':'10.0.0.0/16', 'nexthop':'10.0.0.1'}]
          Unless the default is changed, the parameter is automatically resolved
          from the subnet host_routes attribute.
        type: json
    ...
                           get_param: StorageIpSubnet
                       routes:
                         list_concat_unique:
                          - get_param: StorageRoutes_storage_leaf1
                     - type: vlan
    ...
                           get_param: InternalApiIpSubnet
                       routes:
                         list_concat_unique:
                          - get_param: InternalApiRoutes_internal_api_leaf1
    ...
                           get_param: TenantIpSubnet
                       routes:
                         list_concat_unique:
                          - get_param: TenantRoutes_tenant_leaf1
                   - type: ovs_bridge
    ...
    Copy to Clipboard Toggle word wrap
  2. ~/custom_environment_files 目录中,将模板归档到 tarball 中:

    $ tar -cvzf custom-config.tar.gz *.yaml
    Copy to Clipboard Toggle word wrap
  3. 创建 tripleo-tarball-config ConfigMap:

    $ oc create configmap tripleo-tarball-config --from-file=custom-config.tar.gz -n openstack
    Copy to Clipboard Toggle word wrap

14.3.4. 创建或更新环境文件以注册 NIC 模板

要创建或更新环境文件,请将新节点的 NIC 模板添加到资源 registry 中并重新创建 ConfigMap。

前提条件

  • OpenShift Container Platform 集群可以正常工作,且您已正确安装了 director Operator。
  • 您已在工作站上安装了 oc 命令行工具。
  • tripleo-tarball-config ConfigMap 使用角色所需的 roles_data.yaml 和 NIC 模板进行更新。

流程

  1. 将新节点的 NIC 模板添加到 resource_registry 部分中的环境文件中:

    resource_registry:
      OS::TripleO::Compute::Net::SoftwareConfig: net-config-two-nic-vlan-compute.yaml
      OS::TripleO::ComputeLeaf1::Net::SoftwareConfig: net-config-two-nic-vlan-compute_leaf1.yaml
      OS::TripleO::ComputeLeaf2::Net::SoftwareConfig: net-config-two-nic-vlan-compute_leaf2.yaml
    Copy to Clipboard Toggle word wrap
  2. ~/custom_environment_files 目录中,将模板归档到 tarball 中:

    $ tar -cvzf custom-config.tar.gz *.yaml
    Copy to Clipboard Toggle word wrap
  3. 创建 tripleo-tarball-config ConfigMap:

    $ oc create configmap tripleo-tarball-config --from-file=custom-config.tar.gz -n openstack
    Copy to Clipboard Toggle word wrap
返回顶部
Red Hat logoGithubredditYoutubeTwitter

学习

尝试、购买和销售

社区

关于红帽文档

通过我们的产品和服务,以及可以信赖的内容,帮助红帽用户创新并实现他们的目标。 了解我们当前的更新.

让开源更具包容性

红帽致力于替换我们的代码、文档和 Web 属性中存在问题的语言。欲了解更多详情,请参阅红帽博客.

關於紅帽

我们提供强化的解决方案,使企业能够更轻松地跨平台和环境(从核心数据中心到网络边缘)工作。

Theme

© 2025 Red Hat