From cea78ad4fd84984528e990694342ba2dc38b6959 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Harald=20Jens=C3=A5s?= Date: Thu, 21 Jan 2021 23:23:59 +0100 Subject: [PATCH] Add neutron port tag hint for default_route_network Adds a tag tripleo_default_route=$BOOL to neutron ports created by heat indicating if the ports interface is used for the default route. The value is controlled by the 'default_route_networks' in roles data. With network-data-v2 the same tag will be used to set up ansible vars appropriately. Having the heat driven process add the tag can be useful for upgrade/migration automation. Related: blueprint network-data-v2-ports Change-Id: I20d48b3a29193dbcb70ec5cb13daf153bb0aeff2 --- network/ports/port.j2 | 9 +++++++++ network/ports/port_from_pool.j2 | 5 +++++ puppet/role.role.j2.yaml | 3 +++ 3 files changed, 17 insertions(+) diff --git a/network/ports/port.j2 b/network/ports/port.j2 index 25c63c57e3..074f822cc9 100644 --- a/network/ports/port.j2 +++ b/network/ports/port.j2 @@ -58,6 +58,11 @@ parameters: default: delete constraints: - allowed_values: [delete, retain] + DefaultRoute: + description: > + Whether this interface is used for the default route + type: boolean + default: false conditions: network_is_ctlplane: @@ -98,6 +103,10 @@ resources: template: tripleo_stack_name=$STACK_NAME params: $STACK_NAME: {get_param: RootStackName} + - str_replace: + template: tripleo_default_route=$BOOL + params: + $BOOL: {get_param: DefaultRoute} outputs: ip_address: diff --git a/network/ports/port_from_pool.j2 b/network/ports/port_from_pool.j2 index 748eba64f4..1919e4b4e2 100644 --- a/network/ports/port_from_pool.j2 +++ b/network/ports/port_from_pool.j2 @@ -60,6 +60,11 @@ 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 outputs: ip_address: diff --git a/puppet/role.role.j2.yaml b/puppet/role.role.j2.yaml index 3990af5035..42a24d8816 100644 --- a/puppet/role.role.j2.yaml +++ b/puppet/role.role.j2.yaml @@ -338,6 +338,9 @@ 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 %} {%- endif %} {%- endfor %}