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 模板来创建默认网络路由,然后串联列表。
流程
- 打开 NIC 模板。
将网络路由添加到模板,然后串联列表:
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
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命令行工具。
流程
为每个 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 ...在
~/custom_environment_files目录中,将模板归档到 tarball 中:$ tar -cvzf custom-config.tar.gz *.yaml创建
tripleo-tarball-configConfigMap:$ oc create configmap tripleo-tarball-config --from-file=custom-config.tar.gz -n openstack
14.3.4. 创建或更新环境文件以注册 NIC 模板 复制链接链接已复制到粘贴板!
要创建或更新环境文件,请将新节点的 NIC 模板添加到资源 registry 中并重新创建 ConfigMap。
前提条件
- OpenShift Container Platform 集群可以正常工作,且您已正确安装了 director Operator。
-
您已在工作站上安装了
oc命令行工具。 -
tripleo-tarball-configConfigMap 使用角色所需的roles_data.yaml和 NIC 模板进行更新。
流程
将新节点的 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在
~/custom_environment_files目录中,将模板归档到 tarball 中:$ tar -cvzf custom-config.tar.gz *.yaml创建
tripleo-tarball-configConfigMap:$ oc create configmap tripleo-tarball-config --from-file=custom-config.tar.gz -n openstack