From f35479563af337005b11b99848d51528a75bfa3a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Harald=20Jens=C3=A5s?= Date: Mon, 9 Nov 2020 00:51:38 +0100 Subject: [PATCH] Set tags on all OS::Neutron::Port resources This combines several changes that added tags to port resources into one commit. Set up tag hints on all OS::Neutron::Port resources. The network-data-v2 work uses tags on neutron resources to find existing resources so that we update instead of create. Also for generating environment files info in the neutron tag field is utilized. Conflicts: network/ports/deployed_port.j2 Related: blueprint network-data-v2-ports (cherry picked from commit 28f2a709124f62469acafb64110f755edec82636) (cherry picked from commit 6d39c90a22d850cf449f1900cff32e8b2a1803c3) (cherry picked from commit cea78ad4fd84984528e990694342ba2dc38b6959) (cherry picked from commit 73684d0a894599e331e323597c3705453baab4d0) (cherry picked from commit d3b8515c4f389fbd8ff0cf9eb65b0b73f730724a) (cherry picked from commit b4b2bc5d7047b6e4ed843af34d3219ba14356c7f) (cherry picked from commit 659cc552772241ba95cbd7ea809040606f162b13) Change-Id: I178ac067e4fd77ddfa0eed963c79603576994433 --- deployed-server/ctlplane-port.yaml | 8 +++++ deployed-server/deployed-neutron-port.yaml | 11 ++++++ deployed-server/deployed-server.yaml | 8 +++++ network/ports/ctlplane_vip.yaml | 16 ++++++++- network/ports/from_service.yaml | 3 ++ network/ports/from_service_v6.yaml | 3 ++ network/ports/noop.yaml | 13 ++++++++ network/ports/ovn_mac_addr_port.yaml | 16 +++++++++ network/ports/port.j2 | 39 ++++++++++++++++++++++ network/ports/port_from_pool.j2 | 13 ++++++++ network/ports/vip.yaml | 15 +++++++++ network/ports/vip_v6.yaml | 16 ++++++++- overcloud.j2.yaml | 7 ++++ puppet/role.role.j2.yaml | 4 +++ 14 files changed, 170 insertions(+), 2 deletions(-) diff --git a/deployed-server/ctlplane-port.yaml b/deployed-server/ctlplane-port.yaml index a351248fca..19e7f56a9c 100644 --- a/deployed-server/ctlplane-port.yaml +++ b/deployed-server/ctlplane-port.yaml @@ -1,6 +1,9 @@ heat_template_version: rocky parameters: + RootStackName: + description: The name of the stack/plan. + type: string network: type: string default: ctlplane @@ -33,6 +36,11 @@ resources: - - {get_param: name} - port replacement_policy: AUTO + tags: + - str_replace: + template: tripleo_stack_name=$STACK_NAME + params: + $STACK_NAME: {get_param: RootStackName} outputs: fixed_ips: diff --git a/deployed-server/deployed-neutron-port.yaml b/deployed-server/deployed-neutron-port.yaml index 662bc4e4ec..af7bae810c 100644 --- a/deployed-server/deployed-neutron-port.yaml +++ b/deployed-server/deployed-neutron-port.yaml @@ -33,9 +33,20 @@ parameters: replacement_policy: default: '' type: string + tags: + default: [] + type: comma_delimited_list DeployedServerPortMap: default: {} type: json + IsVirtualIP: # Here for compatibility + default: false + type: boolean + Role: # Here for compatibility + description: > + The TripleO Role Name + type: string + default: '' outputs: diff --git a/deployed-server/deployed-server.yaml b/deployed-server/deployed-server.yaml index 0ece475438..75448a5c0f 100644 --- a/deployed-server/deployed-server.yaml +++ b/deployed-server/deployed-server.yaml @@ -1,5 +1,8 @@ heat_template_version: rocky parameters: + RootStackName: + description: The name of the stack/plan. + type: string image: type: string default: unused @@ -76,6 +79,11 @@ resources: - - {get_param: name} - ctlplane replacement_policy: AUTO + tags: + - str_replace: + template: tripleo_stack_name=$STACK_NAME + params: + $STACK_NAME: {get_param: RootStackName} outputs: OS::stack_id: diff --git a/network/ports/ctlplane_vip.yaml b/network/ports/ctlplane_vip.yaml index d0f527bf1d..90682edb7b 100644 --- a/network/ports/ctlplane_vip.yaml +++ b/network/ports/ctlplane_vip.yaml @@ -5,6 +5,9 @@ description: > The IP address will be chosen automatically if FixedIPs is empty. parameters: + RootStackName: + description: The name of the stack/plan. + type: string ServiceName: # Here for compatibility with from_service.yaml description: Name of the service to lookup default: '' @@ -45,6 +48,9 @@ parameters: [{'ip_address':'1.2.3.4'}] default: [] type: json + IsVirtualIP: # Here for compatibility + type: boolean + default: false conditions: fixed_ip_not_set: @@ -67,7 +73,15 @@ resources: - [{subnet: {get_param: ControlPlaneSubnet}}] - get_param: FixedIPs replacement_policy: AUTO - + tags: + - str_replace: + template: tripleo_vip_net=$NET_NAME + params: + $NET_NAME: {get_param: ControlPlaneNetwork} + - str_replace: + template: tripleo_stack_name=$STACK_NAME + params: + $STACK_NAME: {get_param: RootStackName} outputs: ip_address: description: Virtual IP network IP diff --git a/network/ports/from_service.yaml b/network/ports/from_service.yaml index 2e257a4118..e4c1f7e179 100644 --- a/network/ports/from_service.yaml +++ b/network/ports/from_service.yaml @@ -44,6 +44,9 @@ parameters: [{'ip_address':'1.2.3.4'}] default: [] type: json + IsVirtualIP: # Here for compatibility + type: boolean + default: false ServiceVips: default: {} type: json diff --git a/network/ports/from_service_v6.yaml b/network/ports/from_service_v6.yaml index 7b9a29a044..28ec742b0c 100644 --- a/network/ports/from_service_v6.yaml +++ b/network/ports/from_service_v6.yaml @@ -40,6 +40,9 @@ parameters: [{'ip_address':'1.2.3.4'}] default: [] type: json + IsVirtualIP: # Here for compatibility + type: boolean + default: false ServiceVips: default: {} type: json diff --git a/network/ports/noop.yaml b/network/ports/noop.yaml index e3d6a6474a..8c958aac4a 100644 --- a/network/ports/noop.yaml +++ b/network/ports/noop.yaml @@ -57,6 +57,19 @@ parameters: default: 0 description: Index of the IP to get from Pool type: number + IsVirtualIP: # Here for compatibility + type: boolean + default: false + DefaultRoute: # Here for compatibility + description: > + Whether this interface is used for the default route + type: boolean + default: false + Role: # Here for compatibility + description: > + The TripleO Role Name + type: string + default: '' outputs: ip_address: diff --git a/network/ports/ovn_mac_addr_port.yaml b/network/ports/ovn_mac_addr_port.yaml index 455161df1a..80f9fbe9b1 100644 --- a/network/ports/ovn_mac_addr_port.yaml +++ b/network/ports/ovn_mac_addr_port.yaml @@ -4,6 +4,9 @@ description: > Port without IP address, used to allocate MAC addresses for OVN chassis. parameters: + RootStackName: + description: The name of the stack/plan. + type: string PortName: description: Name of the port default: '' @@ -20,6 +23,19 @@ resources: name: {get_param: PortName} network: {get_param: OVNMacAddressNetworkName} fixed_ips: [] + tags: + - str_replace: + template: tripleo_ovn_mac_port_name=$PORT_NAME + params: + $PORT_NAME: {get_param: PortName} + - str_replace: + template: tripleo_ovn_mac_net=$NET_NAME + params: + $NET_NAME: {get_param: OVNMacAddressNetworkName} + - str_replace: + template: tripleo_stack_name=$STACK_NAME + params: + $STACK_NAME: {get_param: RootStackName} outputs: mac_address: diff --git a/network/ports/port.j2 b/network/ports/port.j2 index 0ed3a9120e..9cb6e0b02d 100644 --- a/network/ports/port.j2 +++ b/network/ports/port.j2 @@ -5,6 +5,9 @@ description: > automatically if FixedIPs is empty. parameters: + RootStackName: + description: The name of the stack/plan. + type: string {{network.name}}NetName: description: The name of the {{network.name_lower}} network. default: {{network.name_lower|default(network.name|lower)}} @@ -47,6 +50,19 @@ parameters: NodeIndex: # Here for compatibility with from_pool.yaml default: 0 type: number + DefaultRoute: + description: > + Whether this interface is used for the default route + type: boolean + default: false + IsVirtualIP: + type: boolean + default: false + Role: + description: > + The TripleO Role Name + type: string + default: '' conditions: network_is_ctlplane: @@ -81,6 +97,29 @@ resources: - [{subnet: {get_param: ControlPlaneSubnet}}] - get_param: FixedIPs replacement_policy: AUTO + tags: + if: + - {get_param: IsVirtualIP} + - - str_replace: + template: tripleo_vip_net=$NET_NAME + params: + $NET_NAME: {get_param: {{network.name}}NetName} + - str_replace: + template: tripleo_stack_name=$STACK_NAME + params: + $STACK_NAME: {get_param: RootStackName} + - - str_replace: + template: tripleo_stack_name=$STACK_NAME + params: + $STACK_NAME: {get_param: RootStackName} + - str_replace: + template: tripleo_default_route=$BOOL + params: + $BOOL: {get_param: DefaultRoute} + - str_replace: + template: tripleo_role=$ROLE + params: + $ROLE: {get_param: Role} outputs: ip_address: diff --git a/network/ports/port_from_pool.j2 b/network/ports/port_from_pool.j2 index 748eba64f4..abf4befc26 100644 --- a/network/ports/port_from_pool.j2 +++ b/network/ports/port_from_pool.j2 @@ -60,6 +60,19 @@ parameters: {%- endif %} description: Cidr for the {{network.name_lower}} network. type: string + DefaultRoute: # Here for compatibility + description: > + Whether this interface is used for the default route + type: boolean + default: false + IsVirtualIP: # Here for compatibility + default: false + type: boolean + Role: # Here for compatibility + description: > + The TripleO Role Name + type: string + default: '' outputs: ip_address: diff --git a/network/ports/vip.yaml b/network/ports/vip.yaml index 64fd745912..9ea2c6158c 100644 --- a/network/ports/vip.yaml +++ b/network/ports/vip.yaml @@ -5,6 +5,9 @@ description: > The IP address will be chosen automatically if FixedIPs is empty. parameters: + RootStackName: + description: The name of the stack/plan. + type: string ServiceName: # Here for compatibility with from_service.yaml description: Name of the service to lookup default: '' @@ -45,6 +48,9 @@ parameters: [{'ip_address':'1.2.3.4'}] default: [] type: json + IsVirtualIP: # Here for compatibility + type: boolean + default: false conditions: network_is_ctlplane: @@ -74,6 +80,15 @@ resources: - [{subnet: {get_param: ControlPlaneSubnet}}] - get_param: FixedIPs replacement_policy: AUTO + tags: + - str_replace: + template: tripleo_service_vip=$SERVICE_NAME + params: + $SERVICE_NAME: {get_param: ServiceName} + - str_replace: + template: tripleo_stack_name=$STACK_NAME + params: + $STACK_NAME: {get_param: RootStackName} outputs: ip_address: diff --git a/network/ports/vip_v6.yaml b/network/ports/vip_v6.yaml index 42956557c9..65ffae8cc3 100644 --- a/network/ports/vip_v6.yaml +++ b/network/ports/vip_v6.yaml @@ -5,6 +5,9 @@ description: > The IP address will be chosen automatically if FixedIPs is empty. parameters: + RootStackName: + description: The name of the stack/plan. + type: string ServiceName: # Here for compatibility with from_service.yaml description: Name of the service to lookup default: '' @@ -45,6 +48,9 @@ parameters: [{'ip_address':'1.2.3.4'}] default: [] type: json + IsVirtualIP: # Here for compatibility + type: boolean + default: false conditions: network_is_ctlplane: @@ -74,7 +80,15 @@ resources: - [{subnet: {get_param: ControlPlaneSubnet}}] - get_param: FixedIPs replacement_policy: AUTO - + tags: + - str_replace: + template: tripleo_service_vip=$SERVICE_NAME + params: + $SERVICE_NAME: {get_param: ServiceName} + - str_replace: + template: tripleo_stack_name=$STACK_NAME + params: + $STACK_NAME: {get_param: RootStackName} outputs: ip_address: description: Virtual IP network IP diff --git a/overcloud.j2.yaml b/overcloud.j2.yaml index 1d90b05719..9071ff0e41 100644 --- a/overcloud.j2.yaml +++ b/overcloud.j2.yaml @@ -1139,6 +1139,12 @@ resources: - [{subnet: {get_attr: [ServiceNetMap, vip_subnet_map, ctlplane]}}] - get_param: ControlFixedIPs replacement_policy: AUTO + tags: + - tripleo_vip_net=ctlplane + - str_replace: + template: tripleo_stack_name=$STACK_NAME + params: + $STACK_NAME: {get_param: 'OS::stack_name'} RedisVirtualIP: depends_on: [Networks, ServiceNetMap] @@ -1206,6 +1212,7 @@ resources: - {get_param: {{network.name}}VirtualFixedIPs} {%- endif %} - [{subnet: {get_attr: [ServiceNetMap, vip_subnet_map, {{network.name}}]}}] + IsVirtualIP: true {%- endfor %} VipMap: diff --git a/puppet/role.role.j2.yaml b/puppet/role.role.j2.yaml index 3990af5035..e2a2fdb08a 100644 --- a/puppet/role.role.j2.yaml +++ b/puppet/role.role.j2.yaml @@ -338,6 +338,10 @@ resources: {%- endif %} - {get_param: {{role.name}}IPs} NodeIndex: {get_param: NodeIndex} +{%- if role.default_route_networks is defined and network.name in role.default_route_networks %} + DefaultRoute: true +{%- endif %} + Role: {{role.name}} {%- endif %} {%- endfor %}