diff --git a/puppet/role.role.j2.yaml b/puppet/role.role.j2.yaml index 05b4079fa6..47573bb6a5 100644 --- a/puppet/role.role.j2.yaml +++ b/puppet/role.role.j2.yaml @@ -267,6 +267,16 @@ parameters: If not set the nameservers configured in the ctlplane subnet's dns_nameservers attribute will be used. type: comma_delimited_list +{%- for network in networks %} + {{network.name}}InterfaceRoutes: + default: [] + description: > + Routes for the {{network.name_lower}} 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 +{%- endfor %} ServerDeletionPolicy: description: Whether to retain or delete servers on deletion of the stack @@ -337,6 +347,11 @@ conditions: equals: - {get_param: [{{role.name}}IPs, '{{network.name_lower}}', {get_param: NodeIndex}]} - '' + {{network.name_lower}}_interface_routes_set: + not: + equals: + - {get_param: {{network.name}}InterfaceRoutes} + - [] {%- endfor %} ctlplane_subnet_cidr_set: not: @@ -512,6 +527,11 @@ resources: {%- for network in networks %} {{network.name}}IpSubnet: {get_attr: [{{network.name}}Port, ip_subnet]} + {{network.name}}InterfaceRoutes: + if: + - {{network.name_lower}}_interface_routes_set + - {get_param: {{network.name}}InterfaceRoutes} + - {get_attr: [{{network.name}}Port, host_routes]} {%- endfor %} NetIpMap: diff --git a/releasenotes/notes/use-attr-interface-routes-dfbe74adce15da1d.yaml b/releasenotes/notes/use-attr-interface-routes-dfbe74adce15da1d.yaml new file mode 100644 index 0000000000..feb59f8804 --- /dev/null +++ b/releasenotes/notes/use-attr-interface-routes-dfbe74adce15da1d.yaml @@ -0,0 +1,7 @@ +--- +features: + - | + Routes specified in the ``host_routes`` attribute of neutron subnets is + passed to ``{{network.name}}InterfaceRoutes`` in network templates. (The + routes in neutron subnet's ``host_routes`` can be configured by setting the + ``routes`` field in ``network_data.yaml``.)