Merge "Drop templates to create Neutron resources"

This commit is contained in:
Zuul 2022-10-30 14:00:38 +00:00 committed by Gerrit Code Review
commit ae365c45b8
14 changed files with 11 additions and 517 deletions

View File

@ -27,10 +27,6 @@ parameter_defaults:
# Type: comma_delimited_list
GlanceEnabledImportMethods: web-download,copy-image
# Manage the network and related resources (subnets and segments) with either create, update, or delete operations (depending on the stack operation). Does not apply to ports which will always be managed as needed. Defaults to true. For multi-stack use cases where the network related resources have already been managed by a separate stack, this parameter can be set to false.
# Type: boolean
ManageNetworks: False
# The availability zone where new Nova compute nodes will be added. If the zone does not already exist, it will be created. If left unset, it will default to the value of the stack name.
# Type: string
NovaComputeAvailabilityZone: ''

View File

@ -9,10 +9,6 @@
# Environment file for deploying a remote site of distributed compute nodes
# (DCN) in a separate stack (multi-stack) deployment.
parameter_defaults:
# Manage the network and related resources (subnets and segments) with either create, update, or delete operations (depending on the stack operation). Does not apply to ports which will always be managed as needed. Defaults to true. For multi-stack use cases where the network related resources have already been managed by a separate stack, this parameter can be set to false.
# Type: boolean
ManageNetworks: False
# The availability zone where new Nova compute nodes will be added. If the zone does not already exist, it will be created. If left unset, it will default to the value of the stack name.
# Type: string
NovaComputeAvailabilityZone: ''

View File

@ -9,10 +9,6 @@
# Environment file for deploying additional compute cell
# in a separate stack (multi-stack) deployment.
parameter_defaults:
# Manage the network and related resources (subnets and segments) with either create, update, or delete operations (depending on the stack operation). Does not apply to ports which will always be managed as needed. Defaults to true. For multi-stack use cases where the network related resources have already been managed by a separate stack, this parameter can be set to false.
# Type: boolean
ManageNetworks: False
# Whether this is an cell additional to the default cell.
# Type: boolean
NovaAdditionalCell: True

View File

@ -1,333 +0,0 @@
{%- if ipv6_override is not defined %}
{%- set ipv6_override = false %}
{%- endif %}
heat_template_version: wallaby
description: >
{{network.name}} network definition (automatically generated).
parameters:
# the defaults here work for static IP assignment (IPAM) only
{{network.name}}NetCidr:
{%- if network.ipv6|default(false) or ipv6_override %}
default: "{{network.ipv6_subnet|default(network.ip_subnet|default(""))}}"
{%- else %}
default: "{{network.ip_subnet|default("")}}"
{%- endif %}
description: Cidr for the {{network.name_lower}} network.
type: string
{{network.name}}NetValueSpecs:
default: {'provider:physical_network': '{{network.name_lower}}', 'provider:network_type': 'flat'}
description: Value specs for the {{network.name_lower}} network.
type: json
{{network.name}}NetEnableDHCP:
default: false
description: Whether to enable DHCP on the associated subnet.
type: boolean
{{network.name}}NetAdminStateUp:
default: false
description: The admin state of the network.
type: boolean
{{network.name}}NetShared:
default: false
description: Whether this network is shared across all tenants.
type: boolean
{{network.name}}NetName:
default: {{network.name_lower}}
description: The name of the {{network.name_lower}} network.
type: string
{{network.name}}SubnetName:
default: {{network.name_lower}}_subnet
description: The name of the {{network.name_lower}} subnet in Neutron.
type: string
{{network.name}}AllocationPools:
{%- if ":" in network.ip_subnet|default("") or network.ipv6|default(false) or ipv6_override %}
default: {{network.ipv6_allocation_pools|default(network.allocation_pools|default([]))}}
{%- else %}
default: {{network.allocation_pools|default([])}}
{%- endif %}
description: Ip allocation pool range for the {{network.name_lower}} network.
type: json
{%- if ":" in network.ip_subnet|default("") or network.ipv6|default(false) or ipv6_override %}
IPv6AddressMode:
default: dhcpv6-stateful
description: Neutron subnet IPv6 address mode
type: string
IPv6RAMode:
default: dhcpv6-stateful
description: Neutron subnet IPv6 router advertisement mode
type: string
{%- endif %}
{{network.name}}InterfaceDefaultRoute:
{%- if network.ipv6|default(false) or ipv6_override %}
default: "{{network.gateway_ipv6|default(network.gateway_ip|default(''))}}"
{%- else %}
default: "{{network.gateway_ip|default('')}}"
{%- endif %}
description: default route for the {{network.name_lower}} network
type: string
{{network.name}}NetworkVlanID:
default: {{network.vlan|default(1)}}
description: Vlan ID for the {{network.name_lower}} network traffic.
type: number
{{network.name}}Routes:
default: {{network.routes|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'}]
Routes are added to the host_routes property on the subnet in neutron
when the network and subnet is created.
type: json
{{network.name}}Mtu:
default: {{network.mtu|default('1500')}}
description: The maximum transmission unit (MTU) size(in bytes) that is
guaranteed to pass through the data path of the segments in the
{{network.name}} network.
type: number
{%- for subnet in network.subnets|default({}) if network.subnets[subnet].enabled|default(true) %}
{{network.name}}SubnetCidr_{{subnet}}:
{%- if network.ipv6|default(false) or ipv6_override %}
default: "{{network.subnets[subnet]['ipv6_subnet']|default(network.subnets[subnet]['ip_subnet']|default(""))}}"
{%- else %}
default: "{{network.subnets[subnet]['ip_subnet']|default("")}}"
{%- endif %}
description: |
Cidr for the {{network.name_lower}} network's {{subnet}} subnet.
type: string
{{network.name}}AllocationPools_{{subnet}}:
{%- if network.ipv6|default(false) or ipv6_override or ":" in network.subnets[subnet]['ip_subnet'] %}
default: {{network.subnets[subnet]['ipv6_allocation_pools']|default(network.subnets[subnet]['allocation_pools']|default([]))}}
{%- else %}
default: {{network.subnets[subnet]['allocation_pools']|default([])}}
{%- endif %}
description: |
Ip allocation pool range for the {{network.name_lower}} network's {{subnet}} subnet.
type: json
{{network.name}}InterfaceDefaultRoute_{{subnet}}:
{%- if network.ipv6|default(false) or ipv6_override or ":" in network.subnets[subnet]['ip_subnet'] %}
default: "{{network.subnets[subnet]['gateway_ipv6']|default(network.subnets[subnet]['gateway_ip']|default([]))}}"
{%- else %}
default: "{{network.subnets[subnet]['gateway_ip']|default([])}}"
{%- endif %}
description: |
default route for the {{network.name_lower}} network's {{subnet}} subnet.
type: string
{{network.name}}NetworkVlanID_{{subnet}}:
default: {{network.subnets[subnet]['vlan']|default(1)}}
description: |
Vlan ID for the {{network.name_lower}} network's {{subnet}} subnet.
type: number
{{network.name}}Routes_{{subnet}}:
default: {{network.subnets[subnet]['routes']|default([])}}
description: >
Routes for the {{subnet}} subnet on {{network.name_lower}} network
traffic. JSON route e.g. [{'destination':'10.0.0.0/16', 'nexthop':'10.0.0.1'}]
Routes are added to the host_routes property on the subnet in neutron
when the subnet is created.
type: json
{%- endfor %}
ManageNetworks:
default: true
type: boolean
description: >
Manage the network and related resources (subnets and segments) with
either create, update, or delete operations (depending on the stack
operation). Does not apply to ports which will always be managed as
needed. Defaults to true. For multi-stack use cases where the network
related resources have already been managed by a separate stack, this
parameter can be set to false.
CloudDomain:
default: 'localdomain'
type: string
description: >
The DNS domain used for the hosts. This must match the
overcloud_domain_name configured on the undercloud.
NetworkDeletionPolicy:
description: >
Whether to retain or delete network resource on deletion of the stack
type: string
default: delete
constraints:
- allowed_values: [delete, retain]
conditions:
manage_networks: {get_param: ManageNetworks}
is_ipv6:
yaql:
expression: '":" in $.data'
data: {get_param: {{network.name}}NetCidr}
resources:
{{network.name}}Network:
type: OS::Neutron::Net
deletion_policy: {get_param: NetworkDeletionPolicy}
condition: manage_networks
{%- if network.external_resource_network_id|default('') %}
external_id: {{ network.external_resource_network_id }}
{%- endif %}
properties:
admin_state_up: {get_param: {{network.name}}NetAdminStateUp}
name: {get_param: {{network.name}}NetName}
dns_domain:
list_join:
- '.'
- - {{network.name.lower()}}
- {get_param: CloudDomain}
- ''
shared: {get_param: {{network.name}}NetShared}
value_specs:
map_merge:
- {get_param: {{network.name}}NetValueSpecs}
- {'mtu': {get_param: {{network.name}}Mtu}}
tags:
- tripleo_net_idx={{network.idx}}
- tripleo_network_name={{network.name}}
- tripleo_vip={{network.vip|default(false)}}
{%- if network.service_net_map_replace|default('') %}
- tripleo_service_net_map_replace={{network.service_net_map_replace}}
{%- endif %}
{%- if network.ipv6|default(false) or ipv6_override %}
- tripleo_ipv6=true
{%- endif %}
{{network.name}}Subnet:
type: OS::Neutron::Subnet
deletion_policy: {get_param: NetworkDeletionPolicy}
condition: manage_networks
{%- if network.external_resource_subnet_id|default('') %}
external_id: {{ network.external_resource_subnet_id }}
{%- endif %}
properties:
cidr: {get_param: {{network.name}}NetCidr}
name: {get_param: {{network.name}}SubnetName}
network: {get_resource: {{network.name}}Network}
allocation_pools: {get_param: {{network.name}}AllocationPools}
gateway_ip: {get_param: {{network.name}}InterfaceDefaultRoute}
host_routes: {get_param: {{network.name}}Routes}
# All networks have an implicit network segment when created, map this subnet to that segment.
segment: {get_attr: [{{network.name}}Network, segments, 0, id]}
ip_version: {if: [is_ipv6, 6, 4]}
{%- if network.ipv6|default(false) or ipv6_override or ":" in network.ip_subnet|default("") %}
ipv6_address_mode: {get_param: IPv6AddressMode}
ipv6_ra_mode: {get_param: IPv6RAMode}
{%- else %}
enable_dhcp: {get_param: {{network.name}}NetEnableDHCP}
{%- endif %}
tags:
- str_replace:
template: tripleo_vlan_id=$vlan_id
params:
$vlan_id: {get_param: {{network.name}}NetworkVlanID}
{% for subnet in network.subnets|default({}) if network.subnets[subnet].enabled|default(true) %}
{{network.name}}Segment_{{subnet}}:
type: OS::Neutron::Segment
deletion_policy: {get_param: NetworkDeletionPolicy}
condition: manage_networks
# NOTE(hjensas): Depends-On here to ensure we always create the base subnet
# first. We can only set the segment for existing subnet if there is only
# one segment and only one existing subnet on the network.
{%- if network.subnets[subnet].external_resource_segment_id|default('') %}
external_id: {{ network.subnets[subnet].external_resource_segment_id }}
{%- else %}
depends_on: {{network.name}}Subnet
{%- endif %}
properties:
name: {{network.name_lower}}_{{subnet}}
network: {get_resource: {{network.name}}Network}
network_type: flat
physical_network: {{network.name_lower}}_{{subnet}}
{{network.name}}Subnet_{{subnet}}:
type: OS::Neutron::Subnet
deletion_policy: {get_param: NetworkDeletionPolicy}
condition: manage_networks
{%- if network.subnets[subnet].external_resource_subnet_id|default('') %}
external_id: {{ network.subnets[subnet].external_resource_subnet_id }}
{%- endif %}
properties:
cidr: {get_param: {{network.name}}SubnetCidr_{{subnet}}}
name: {{subnet}}
network: {get_resource: {{network.name}}Network}
allocation_pools: {get_param: {{network.name}}AllocationPools_{{subnet}}}
gateway_ip: {get_param: {{network.name}}InterfaceDefaultRoute_{{subnet}}}
host_routes: {get_param: {{network.name}}Routes_{{subnet}}}
segment: {get_resource: {{network.name}}Segment_{{subnet}}}
ip_version: {if: [is_ipv6, 6, 4]}
{%- if network.ipv6|default(false) or ipv6_override or ":" in network.ip_subnet|default("") %}
ipv6_address_mode: {get_param: IPv6AddressMode}
ipv6_ra_mode: {get_param: IPv6RAMode}
{%- else %}
enable_dhcp: {get_param: {{network.name}}NetEnableDHCP}
{%- endif %}
tags:
- str_replace:
template: tripleo_vlan_id=$vlan_id
params:
$vlan_id: {get_param: {{network.name}}NetworkVlanID_{{subnet}}}
{% endfor %}
outputs:
OS::stack_id:
description: {{network.name_lower}} network
value: {get_resource: {{network.name}}Network}
ip_version:
description: IP version of {{network.name}} network.
value: {if: [is_ipv6, 6, 4]}
network_cidrs:
description: List of {{network.name}} network's subnets in CIDR notation.
value:
if:
- manage_networks
- - {get_attr: [{{network.name}}Subnet, cidr]}
{%- for subnet in network.subnets|default({}) if network.subnets[subnet].enabled|default(true) %}
- {get_attr: [{{network.name}}Subnet_{{subnet}}, cidr]}
{%- endfor %}
- - {get_param: {{network.name}}NetCidr}
{%- for subnet in network.subnets|default({}) if network.subnets[subnet].enabled|default(true) %}
- {get_param: {{network.name}}SubnetCidr_{{subnet}}}
{%- endfor %}
network_attrs:
description: {{network.name}} network's attributes
value:
if:
- manage_networks
- {get_attr: [{{network.name}}Network, show]}
- name: {{network.name_lower}}
dns_domain:
list_join:
- '.'
- - {{network.name.lower()}}
- {get_param: CloudDomain}
- ''
mtu: {{network.mtu|default('1500')}}
subnet_attrs:
description: Map of attributes for subnets in the {{network.name}} network
value:
if:
- manage_networks
- {{network.name_lower}}_subnet: {get_attr: [{{network.name}}Subnet, show]}
{%- for subnet in network.subnets|default({}) if network.subnets[subnet].enabled|default(true) %}
{{subnet}}: {get_attr: [{{network.name}}Subnet_{{subnet}}, show]}
{%- endfor %}
- {{network.name_lower}}_subnet:
name: {{network.name_lower}}_subnet
cidr: {get_param: {{network.name}}NetCidr}
dns_nameservers: []
gateway_ip: {get_param: {{network.name}}InterfaceDefaultRoute}
host_routes: {get_param: {{network.name}}Routes}
ip_version: {if: [is_ipv6, 6, 4]}
{%- for subnet in network.subnets|default({}) if network.subnets[subnet].enabled|default(true) %}
{{subnet}}:
name: {{subnet}}
cidr: {get_param: {{network.name}}SubnetCidr_{{subnet}}}
dns_nameservers: []
gateway_ip: {get_param: {{network.name}}InterfaceDefaultRoute_{{subnet}}}
host_routes: {get_param: {{network.name}}Routes_{{subnet}}}
ip_version: {if: [is_ipv6, 6, 4]}
{%- endfor %}

View File

@ -1 +0,0 @@
{% include 'network.j2' %}

View File

@ -1,2 +0,0 @@
{% set ipv6_override = true -%}
{% include 'network.j2' %}

View File

@ -1,2 +0,0 @@
{% set set_external_id = true -%}
{% include 'port.j2' %}

View File

@ -1,3 +0,0 @@
{% set ipv6_override = true -%}
{% set set_external_id = true -%}
{% include 'port.j2' %}

View File

@ -1,153 +0,0 @@
heat_template_version: wallaby
description: >
Creates a port on the {{network.name}} network. The IP address will be chosen
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)}}
type: string
PortName:
description: Name of the port
default: ''
type: string
DnsName:
description: DNS name of the port
default: ''
type: string
ControlPlaneIP: # Here for compatibility with noop.yaml
description: IP address on the control plane
default: ''
type: string
ControlPlaneSubnetCidr: # Here for compatibility with noop.yaml
default: ''
description: >
The subnet CIDR of the control plane network. (The parameter is
automatically resolved from the ctlplane subnet's cidr attribute.)
type: string
ControlPlaneNetwork: # Here for compatibility with ctlplane_vip.yaml
description: The name of the undercloud Neutron control plane
default: ctlplane
type: string
ControlPlaneSubnet: # Here for compatibility with ctlplane_vip.yaml
description: The name of the undercloud Neutron control plane subnet
default: ctlplane-subnet
type: string
FixedIPs:
description: >
Control the IP allocation for the VIP port. E.g.
[{'ip_address':'1.2.3.4'}]
default: []
type: json
IPPool: # Here for compatibility with from_pool.yaml
default: {}
type: json
NodeIndex: # Here for compatibility with from_pool.yaml
default: 0
type: number
PortDeletionPolicy:
description: >
Whether to retain or delete the neutron port resource on deletion of the
stack
type: string
default: delete
constraints:
- allowed_values: [delete, retain]
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:
equals:
- get_param: {{network.name}}NetName
- ctlplane
fixed_ip_not_set:
equals:
- yaql:
expression: $.data.where($.get('ip_address'))
data: {get_param: FixedIPs}
- []
net_is_ctlplane_and_fixed_ip_not_set:
and:
- network_is_ctlplane
- fixed_ip_not_set
resources:
{{network.name}}Port:
type: OS::Neutron::Port
deletion_policy: {get_param: PortDeletionPolicy}
{%- if set_external_id|default(false) and network.external_resource_vip_id|default('') %}
external_id: {{network.external_resource_vip_id}}
{%- endif %}
properties:
network: {get_param: {{network.name}}NetName}
name: {get_param: PortName}
dns_name: {get_param: DnsName}
fixed_ips:
if:
- net_is_ctlplane_and_fixed_ip_not_set
- [{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:
description: {{network.name}} network IP
value: {get_attr: [{{network.name}}Port, fixed_ips, 0, ip_address]}
ip_address_uri:
description: {{network.name}} network IP (with brackets for IPv6 URLs)
value:
str_replace:
template:
make_url:
host: {get_attr: [{{network.name}}Port, fixed_ips, 0, ip_address]}
params:
//: ''
ip_subnet:
description: IP/Subnet CIDR for the {{network.name}} network IP
value:
list_join:
- ''
- - {get_attr: [{{network.name}}Port, fixed_ips, 0, ip_address]}
- '/'
- {str_split: ['/', {get_attr: [{{network.name}}Port, subnets, 0, cidr]}, 1]}

View File

@ -1 +0,0 @@
{% include 'port.j2' %}

View File

@ -1,2 +0,0 @@
{% set ipv6_override = true -%}
{% include 'port.j2' %}

View File

@ -0,0 +1,11 @@
---
upgrade:
- |
The template files to manage network resources(eg. ports) by heat have been
all removed. All network resources should be pre-created by
the separate network privisioning process.
- |
The ``ManageNetwork`` parameter has been removed. This parameter had no
effect when network resources are pre-deployed by the network provisioning
process.

View File

@ -8,9 +8,6 @@ environments:
deployment/nova/nova-az-config.yaml:
parameters:
- NovaComputeAvailabilityZone
network/external.yaml:
parameters:
- ManageNetworks
deployment/nova/nova-base-puppet.yaml:
parameters:
- NovaCrossAZAttach
@ -18,7 +15,6 @@ environments:
parameters:
- NovaDisableImageDownloadToRbd
sample_values: &sample_values
ManageNetworks: false
NovaCrossAZAttach: false
NovaDisableImageDownloadToRbd: true
resource_registry: &dcn_resource_registry

View File

@ -5,9 +5,6 @@ environments:
Environment file for deploying additional compute cell
in a separate stack (multi-stack) deployment.
files: &cell_files
network/external.yaml:
parameters:
- ManageNetworks
deployment/nova/nova-metadata-container-puppet.yaml:
parameters:
- NovaLocalMetadataPerCell
@ -17,4 +14,3 @@ environments:
sample_values: &sample_values
NovaAdditionalCell: True
NovaLocalMetadataPerCell: True
ManageNetworks: False