From 6ab86a3ebe7734beb0f16ce3a7375336032fe928 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Harald=20Jens=C3=A5s?= Date: Fri, 18 May 2018 18:11:38 +0200 Subject: [PATCH] ControlPlaneSubnetCidr using get_attr Use get_attr on the server resource to resolve attribute value from the subnet(s) and pass it to the parameter 'ControlPlaneSubnetCidr' used in the THT/network/config/* templates. As the value is now resolved from resource attributes, this changes the default for 'ControlPlaneSubnetCidr' to '' as well as the comment that these value should be overriden in parameters_defaults. It also removes the parameter from network-environment templates. A conditinal is used in puppet/role.role.j2.yaml so that the parameter value is used whenever it is not '' (the default) to provide backwards compatibility in case the user set a different value (different from the one used in undercloud.conf) for this parameter in network-environment.yaml. When deploying a routed control plane the network config templates would previously need to be updated to carry 'ControlPlaneXSubnetCidr' parameter (in case the subnet mask is not the same for all the routed network leafs). With 8 Leafs in addition to the network local to the undercloud that is 8 parameters less to place in the configuration. By getting the value to pass from the server resource this change reduces the required nic-config template customisation (reduces the risk of user error). Partial: blueprint tripleo-routed-networks-templates Change-Id: I92ee0f9a2107cdf1ca5903d3756a235a79c36c73 --- .../net-config-multinode-os-net-config.yaml | 8 +++-- ci/common/net-config-multinode.yaml | 8 +++-- ci/common/net-config-simple-bridge.yaml | 8 +++-- .../network-environment.yaml | 1 - .../nic-configs/ceph-storage.yaml | 8 +++-- .../nic-configs/cinder-storage.yaml | 8 +++-- .../nic-configs/compute.yaml | 8 +++-- .../nic-configs/controller.yaml | 8 +++-- .../nic-configs/swift-storage.yaml | 8 +++-- .../multiple-nics/network-environment.yaml | 1 - .../nic-configs/ceph-storage.yaml | 8 +++-- .../nic-configs/cinder-storage.yaml | 8 +++-- .../multiple-nics/nic-configs/compute.yaml | 8 +++-- .../multiple-nics/nic-configs/controller.yaml | 8 +++-- .../nic-configs/swift-storage.yaml | 8 +++-- .../public-bond/network-environment.yaml | 1 - .../public-bond/nic-configs/ceph-storage.yaml | 8 +++-- .../nic-configs/cinder-storage.yaml | 8 +++-- .../public-bond/nic-configs/compute.yaml | 8 +++-- .../public-bond/nic-configs/controller.yaml | 8 +++-- .../nic-configs/swift-storage.yaml | 8 +++-- deployed-server/deployed-server.yaml | 4 +++ environments/network-environment-v6.j2.yaml | 8 +++-- environments/network-environment.j2.yaml | 8 +++-- net-config-bond.j2.yaml | 6 ++++ net-config-bridge.j2.yaml | 6 ++++ net-config-linux-bridge.j2.yaml | 6 ++++ net-config-noop.j2.yaml | 6 ++++ net-config-standalone.j2.yaml | 8 +++-- ...g-static-bridge-with-external-dhcp.j2.yaml | 8 +++-- net-config-static-bridge.j2.yaml | 8 +++-- net-config-static.j2.yaml | 8 +++-- net-config-undercloud.j2.yaml | 8 +++-- .../controller-no-external.j2.yaml | 8 +++-- .../bond-with-vlans/controller-v6.j2.yaml | 8 +++-- .../config/bond-with-vlans/role.role.j2.yaml | 8 +++-- .../config/multiple-nics/compute-dvr.j2.yaml | 8 +++-- .../multiple-nics/controller-v6.j2.yaml | 8 +++-- .../config/multiple-nics/role.role.j2.yaml | 8 +++-- .../controller-v6.j2.yaml | 8 +++-- .../role.role.j2.yaml | 8 +++-- .../controller-no-external.j2.yaml | 8 +++-- .../single-nic-vlans/controller-v6.j2.yaml | 8 +++-- .../config/single-nic-vlans/role.role.j2.yaml | 8 +++-- network/ports/ctlplane_vip.yaml | 6 ++++ network/ports/from_service.yaml | 6 ++++ network/ports/from_service_v6.yaml | 6 ++++ network/ports/net_ip_map.j2.yaml | 8 +++-- network/ports/noop.yaml | 8 +++-- network/ports/port.j2 | 6 ++++ network/ports/port_from_pool.j2 | 6 ++++ network/ports/vip.yaml | 6 ++++ network/ports/vip_v6.yaml | 6 ++++ overcloud.j2.yaml | 29 +++++++++++++++++++ puppet/role.role.j2.yaml | 26 +++++++++++++++++ ...-attrs-ctlplane-cidr-a02e14a251733726.yaml | 25 ++++++++++++++++ 56 files changed, 342 insertions(+), 115 deletions(-) create mode 100644 releasenotes/notes/use-subnet-attrs-ctlplane-cidr-a02e14a251733726.yaml diff --git a/ci/common/net-config-multinode-os-net-config.yaml b/ci/common/net-config-multinode-os-net-config.yaml index 6e31088482..5b600c6910 100644 --- a/ci/common/net-config-multinode-os-net-config.yaml +++ b/ci/common/net-config-multinode-os-net-config.yaml @@ -37,9 +37,11 @@ parameters: default: '' description: IP address/subnet on the management network type: string - ControlPlaneSubnetCidr: # Override this via parameter_defaults - default: '24' - description: The subnet CIDR of the control plane network. + ControlPlaneSubnetCidr: + default: '' + description: > + The subnet CIDR of the control plane network. (The parameter is + automatically resolved from the ctlplane subnet's cidr attribute.) type: string OvSBridgeMtu: default: 1300 diff --git a/ci/common/net-config-multinode.yaml b/ci/common/net-config-multinode.yaml index 6ba9cb9ead..eb74a39e8c 100644 --- a/ci/common/net-config-multinode.yaml +++ b/ci/common/net-config-multinode.yaml @@ -37,9 +37,11 @@ parameters: default: '' description: IP address/subnet on the management network type: string - ControlPlaneSubnetCidr: # Override this via parameter_defaults - default: '24' - description: The subnet CIDR of the control plane network. + ControlPlaneSubnetCidr: + default: '' + description: > + The subnet CIDR of the control plane network. (The parameter is + automatically resolved from the ctlplane subnet's cidr attribute.) type: string resources: diff --git a/ci/common/net-config-simple-bridge.yaml b/ci/common/net-config-simple-bridge.yaml index bbc88862b5..f777d74fdb 100644 --- a/ci/common/net-config-simple-bridge.yaml +++ b/ci/common/net-config-simple-bridge.yaml @@ -6,9 +6,11 @@ parameters: default: '' description: IP address/subnet on the ctlplane network type: string - ControlPlaneSubnetCidr: # Override this via parameter_defaults - default: '24' - description: The subnet CIDR of the control plane network. + ControlPlaneSubnetCidr: + default: '' + description: > + The subnet CIDR of the control plane network. (The parameter is + automatically resolved from the ctlplane subnet's cidr attribute.) type: string ExternalIpSubnet: default: '' diff --git a/ci/environments/network/multiple-nics-ipv6/network-environment.yaml b/ci/environments/network/multiple-nics-ipv6/network-environment.yaml index 1960c712b3..be1d57aa2b 100644 --- a/ci/environments/network/multiple-nics-ipv6/network-environment.yaml +++ b/ci/environments/network/multiple-nics-ipv6/network-environment.yaml @@ -7,7 +7,6 @@ resource_registry: OS::TripleO::CephStorage::Net::SoftwareConfig: nic-configs/ceph-storage.yaml parameter_defaults: - ControlPlaneSubnetCidr: '24' ControlPlaneDefaultRoute: 192.168.24.1 EC2MetadataIp: 192.168.24.1 ExternalNetCidr: 2001:db8:fd00:1000::/64 diff --git a/ci/environments/network/multiple-nics-ipv6/nic-configs/ceph-storage.yaml b/ci/environments/network/multiple-nics-ipv6/nic-configs/ceph-storage.yaml index 6a37859079..bfbfcc7e7b 100644 --- a/ci/environments/network/multiple-nics-ipv6/nic-configs/ceph-storage.yaml +++ b/ci/environments/network/multiple-nics-ipv6/nic-configs/ceph-storage.yaml @@ -62,9 +62,11 @@ parameters: default: '10.0.0.1' description: default route for the external network type: string - ControlPlaneSubnetCidr: # Override this via parameter_defaults - default: '24' - description: The subnet CIDR of the control plane network. + ControlPlaneSubnetCidr: + default: '' + description: > + The subnet CIDR of the control plane network. (The parameter is + automatically resolved from the ctlplane subnet's cidr attribute.) type: string ControlPlaneDefaultRoute: # Override this via parameter_defaults description: The default route of the control plane network. diff --git a/ci/environments/network/multiple-nics-ipv6/nic-configs/cinder-storage.yaml b/ci/environments/network/multiple-nics-ipv6/nic-configs/cinder-storage.yaml index 0bdbbba321..816accf974 100644 --- a/ci/environments/network/multiple-nics-ipv6/nic-configs/cinder-storage.yaml +++ b/ci/environments/network/multiple-nics-ipv6/nic-configs/cinder-storage.yaml @@ -62,9 +62,11 @@ parameters: default: '10.0.0.1' description: default route for the external network type: string - ControlPlaneSubnetCidr: # Override this via parameter_defaults - default: '24' - description: The subnet CIDR of the control plane network. + ControlPlaneSubnetCidr: + default: '' + description: > + The subnet CIDR of the control plane network. (The parameter is + automatically resolved from the ctlplane subnet's cidr attribute.) type: string ControlPlaneDefaultRoute: # Override this via parameter_defaults description: The default route of the control plane network. diff --git a/ci/environments/network/multiple-nics-ipv6/nic-configs/compute.yaml b/ci/environments/network/multiple-nics-ipv6/nic-configs/compute.yaml index d8a91325c7..157655e07e 100644 --- a/ci/environments/network/multiple-nics-ipv6/nic-configs/compute.yaml +++ b/ci/environments/network/multiple-nics-ipv6/nic-configs/compute.yaml @@ -62,9 +62,11 @@ parameters: default: '10.0.0.1' description: default route for the external network type: string - ControlPlaneSubnetCidr: # Override this via parameter_defaults - default: '24' - description: The subnet CIDR of the control plane network. + ControlPlaneSubnetCidr: + default: '' + description: > + The subnet CIDR of the control plane network. (The parameter is + automatically resolved from the ctlplane subnet's cidr attribute.) type: string ControlPlaneDefaultRoute: # Override this via parameter_defaults description: The default route of the control plane network. diff --git a/ci/environments/network/multiple-nics-ipv6/nic-configs/controller.yaml b/ci/environments/network/multiple-nics-ipv6/nic-configs/controller.yaml index cc54f76121..4df246f16e 100644 --- a/ci/environments/network/multiple-nics-ipv6/nic-configs/controller.yaml +++ b/ci/environments/network/multiple-nics-ipv6/nic-configs/controller.yaml @@ -62,9 +62,11 @@ parameters: default: '10.0.0.1' description: default route for the external network type: string - ControlPlaneSubnetCidr: # Override this via parameter_defaults - default: '24' - description: The subnet CIDR of the control plane network. + ControlPlaneSubnetCidr: + default: '' + description: > + The subnet CIDR of the control plane network. (The parameter is + automatically resolved from the ctlplane subnet's cidr attribute.) type: string ControlPlaneDefaultRoute: # Override this via parameter_defaults description: The default route of the control plane network. diff --git a/ci/environments/network/multiple-nics-ipv6/nic-configs/swift-storage.yaml b/ci/environments/network/multiple-nics-ipv6/nic-configs/swift-storage.yaml index 0bdbbba321..816accf974 100644 --- a/ci/environments/network/multiple-nics-ipv6/nic-configs/swift-storage.yaml +++ b/ci/environments/network/multiple-nics-ipv6/nic-configs/swift-storage.yaml @@ -62,9 +62,11 @@ parameters: default: '10.0.0.1' description: default route for the external network type: string - ControlPlaneSubnetCidr: # Override this via parameter_defaults - default: '24' - description: The subnet CIDR of the control plane network. + ControlPlaneSubnetCidr: + default: '' + description: > + The subnet CIDR of the control plane network. (The parameter is + automatically resolved from the ctlplane subnet's cidr attribute.) type: string ControlPlaneDefaultRoute: # Override this via parameter_defaults description: The default route of the control plane network. diff --git a/ci/environments/network/multiple-nics/network-environment.yaml b/ci/environments/network/multiple-nics/network-environment.yaml index 171adab680..6a9c160637 100644 --- a/ci/environments/network/multiple-nics/network-environment.yaml +++ b/ci/environments/network/multiple-nics/network-environment.yaml @@ -7,7 +7,6 @@ resource_registry: OS::TripleO::CephStorage::Net::SoftwareConfig: nic-configs/ceph-storage.yaml parameter_defaults: - ControlPlaneSubnetCidr: '24' ControlPlaneDefaultRoute: 192.168.24.1 EC2MetadataIp: 192.168.24.1 ExternalNetCidr: 10.0.0.0/24 diff --git a/ci/environments/network/multiple-nics/nic-configs/ceph-storage.yaml b/ci/environments/network/multiple-nics/nic-configs/ceph-storage.yaml index 26de71f81e..5aa345bc36 100644 --- a/ci/environments/network/multiple-nics/nic-configs/ceph-storage.yaml +++ b/ci/environments/network/multiple-nics/nic-configs/ceph-storage.yaml @@ -62,9 +62,11 @@ parameters: default: '10.0.0.1' description: default route for the external network type: string - ControlPlaneSubnetCidr: # Override this via parameter_defaults - default: '24' - description: The subnet CIDR of the control plane network. + ControlPlaneSubnetCidr: + default: '' + description: > + The subnet CIDR of the control plane network. (The parameter is + automatically resolved from the ctlplane subnet's cidr attribute.) type: string ControlPlaneDefaultRoute: # Override this via parameter_defaults description: The default route of the control plane network. diff --git a/ci/environments/network/multiple-nics/nic-configs/cinder-storage.yaml b/ci/environments/network/multiple-nics/nic-configs/cinder-storage.yaml index ec036bbc6a..efb41bf2cb 100644 --- a/ci/environments/network/multiple-nics/nic-configs/cinder-storage.yaml +++ b/ci/environments/network/multiple-nics/nic-configs/cinder-storage.yaml @@ -62,9 +62,11 @@ parameters: default: '10.0.0.1' description: default route for the external network type: string - ControlPlaneSubnetCidr: # Override this via parameter_defaults - default: '24' - description: The subnet CIDR of the control plane network. + ControlPlaneSubnetCidr: + default: '' + description: > + The subnet CIDR of the control plane network. (The parameter is + automatically resolved from the ctlplane subnet's cidr attribute.) type: string ControlPlaneDefaultRoute: # Override this via parameter_defaults description: The default route of the control plane network. diff --git a/ci/environments/network/multiple-nics/nic-configs/compute.yaml b/ci/environments/network/multiple-nics/nic-configs/compute.yaml index 1da83cfd0b..f2a729a19c 100644 --- a/ci/environments/network/multiple-nics/nic-configs/compute.yaml +++ b/ci/environments/network/multiple-nics/nic-configs/compute.yaml @@ -62,9 +62,11 @@ parameters: default: '10.0.0.1' description: default route for the external network type: string - ControlPlaneSubnetCidr: # Override this via parameter_defaults - default: '24' - description: The subnet CIDR of the control plane network. + ControlPlaneSubnetCidr: + default: '' + description: > + The subnet CIDR of the control plane network. (The parameter is + automatically resolved from the ctlplane subnet's cidr attribute.) type: string ControlPlaneDefaultRoute: # Override this via parameter_defaults description: The default route of the control plane network. diff --git a/ci/environments/network/multiple-nics/nic-configs/controller.yaml b/ci/environments/network/multiple-nics/nic-configs/controller.yaml index 09c6d01be9..67ff1982fe 100644 --- a/ci/environments/network/multiple-nics/nic-configs/controller.yaml +++ b/ci/environments/network/multiple-nics/nic-configs/controller.yaml @@ -62,9 +62,11 @@ parameters: default: '10.0.0.1' description: default route for the external network type: string - ControlPlaneSubnetCidr: # Override this via parameter_defaults - default: '24' - description: The subnet CIDR of the control plane network. + ControlPlaneSubnetCidr: + default: '' + description: > + The subnet CIDR of the control plane network. (The parameter is + automatically resolved from the ctlplane subnet's cidr attribute.) type: string ControlPlaneDefaultRoute: # Override this via parameter_defaults description: The default route of the control plane network. diff --git a/ci/environments/network/multiple-nics/nic-configs/swift-storage.yaml b/ci/environments/network/multiple-nics/nic-configs/swift-storage.yaml index ec036bbc6a..efb41bf2cb 100644 --- a/ci/environments/network/multiple-nics/nic-configs/swift-storage.yaml +++ b/ci/environments/network/multiple-nics/nic-configs/swift-storage.yaml @@ -62,9 +62,11 @@ parameters: default: '10.0.0.1' description: default route for the external network type: string - ControlPlaneSubnetCidr: # Override this via parameter_defaults - default: '24' - description: The subnet CIDR of the control plane network. + ControlPlaneSubnetCidr: + default: '' + description: > + The subnet CIDR of the control plane network. (The parameter is + automatically resolved from the ctlplane subnet's cidr attribute.) type: string ControlPlaneDefaultRoute: # Override this via parameter_defaults description: The default route of the control plane network. diff --git a/ci/environments/network/public-bond/network-environment.yaml b/ci/environments/network/public-bond/network-environment.yaml index 6f451d6d11..905a876082 100644 --- a/ci/environments/network/public-bond/network-environment.yaml +++ b/ci/environments/network/public-bond/network-environment.yaml @@ -7,7 +7,6 @@ resource_registry: OS::TripleO::CephStorage::Net::SoftwareConfig: nic-configs/ceph-storage.yaml parameter_defaults: - ControlPlaneSubnetCidr: '24' ControlPlaneDefaultRoute: 192.168.24.1 EC2MetadataIp: 192.168.24.1 ExternalNetCidr: 10.0.0.0/24 diff --git a/ci/environments/network/public-bond/nic-configs/ceph-storage.yaml b/ci/environments/network/public-bond/nic-configs/ceph-storage.yaml index 623c31e3d4..0f66ba81c8 100644 --- a/ci/environments/network/public-bond/nic-configs/ceph-storage.yaml +++ b/ci/environments/network/public-bond/nic-configs/ceph-storage.yaml @@ -62,9 +62,11 @@ parameters: default: '10.0.0.1' description: default route for the external network type: string - ControlPlaneSubnetCidr: # Override this via parameter_defaults - default: '24' - description: The subnet CIDR of the control plane network. + ControlPlaneSubnetCidr: + default: '' + description: > + The subnet CIDR of the control plane network. (The parameter is + automatically resolved from the ctlplane subnet's cidr attribute.) type: string ControlPlaneDefaultRoute: # Override this via parameter_defaults description: The default route of the control plane network. diff --git a/ci/environments/network/public-bond/nic-configs/cinder-storage.yaml b/ci/environments/network/public-bond/nic-configs/cinder-storage.yaml index 1cf2f6a3d1..441c84a37e 100644 --- a/ci/environments/network/public-bond/nic-configs/cinder-storage.yaml +++ b/ci/environments/network/public-bond/nic-configs/cinder-storage.yaml @@ -62,9 +62,11 @@ parameters: default: '10.0.0.1' description: default route for the external network type: string - ControlPlaneSubnetCidr: # Override this via parameter_defaults - default: '24' - description: The subnet CIDR of the control plane network. + ControlPlaneSubnetCidr: + default: '' + description: > + The subnet CIDR of the control plane network. (The parameter is + automatically resolved from the ctlplane subnet's cidr attribute.) type: string ControlPlaneDefaultRoute: # Override this via parameter_defaults description: The default route of the control plane network. diff --git a/ci/environments/network/public-bond/nic-configs/compute.yaml b/ci/environments/network/public-bond/nic-configs/compute.yaml index d4084aa867..e8bb722be9 100644 --- a/ci/environments/network/public-bond/nic-configs/compute.yaml +++ b/ci/environments/network/public-bond/nic-configs/compute.yaml @@ -62,9 +62,11 @@ parameters: default: '10.0.0.1' description: default route for the external network type: string - ControlPlaneSubnetCidr: # Override this via parameter_defaults - default: '24' - description: The subnet CIDR of the control plane network. + ControlPlaneSubnetCidr: + default: '' + description: > + The subnet CIDR of the control plane network. (The parameter is + automatically resolved from the ctlplane subnet's cidr attribute.) type: string ControlPlaneDefaultRoute: # Override this via parameter_defaults description: The default route of the control plane network. diff --git a/ci/environments/network/public-bond/nic-configs/controller.yaml b/ci/environments/network/public-bond/nic-configs/controller.yaml index 9ed1578c1a..968cd63835 100644 --- a/ci/environments/network/public-bond/nic-configs/controller.yaml +++ b/ci/environments/network/public-bond/nic-configs/controller.yaml @@ -62,9 +62,11 @@ parameters: default: '10.0.0.1' description: default route for the external network type: string - ControlPlaneSubnetCidr: # Override this via parameter_defaults - default: '24' - description: The subnet CIDR of the control plane network. + ControlPlaneSubnetCidr: + default: '' + description: > + The subnet CIDR of the control plane network. (The parameter is + automatically resolved from the ctlplane subnet's cidr attribute.) type: string ControlPlaneDefaultRoute: # Override this via parameter_defaults description: The default route of the control plane network. diff --git a/ci/environments/network/public-bond/nic-configs/swift-storage.yaml b/ci/environments/network/public-bond/nic-configs/swift-storage.yaml index 1cf2f6a3d1..441c84a37e 100644 --- a/ci/environments/network/public-bond/nic-configs/swift-storage.yaml +++ b/ci/environments/network/public-bond/nic-configs/swift-storage.yaml @@ -62,9 +62,11 @@ parameters: default: '10.0.0.1' description: default route for the external network type: string - ControlPlaneSubnetCidr: # Override this via parameter_defaults - default: '24' - description: The subnet CIDR of the control plane network. + ControlPlaneSubnetCidr: + default: '' + description: > + The subnet CIDR of the control plane network. (The parameter is + automatically resolved from the ctlplane subnet's cidr attribute.) type: string ControlPlaneDefaultRoute: # Override this via parameter_defaults description: The default route of the control plane network. diff --git a/deployed-server/deployed-server.yaml b/deployed-server/deployed-server.yaml index 2f7d975b96..a777662fba 100644 --- a/deployed-server/deployed-server.yaml +++ b/deployed-server/deployed-server.yaml @@ -154,6 +154,10 @@ outputs: value: ctlplane: - {get_attr: [ControlPlanePort, fixed_ips, 0, ip_address]} + addresses: + value: + ctlplane: + - subnets: {get_attr: [ControlPlanePort, subnets]} name: value: yaql: diff --git a/environments/network-environment-v6.j2.yaml b/environments/network-environment-v6.j2.yaml index b3bbb5ea7e..041bc4966b 100644 --- a/environments/network-environment-v6.j2.yaml +++ b/environments/network-environment-v6.j2.yaml @@ -16,8 +16,12 @@ resource_registry: parameter_defaults: # This section is where deployment-specific configuration is done - # CIDR subnet mask length for provisioning network - ControlPlaneSubnetCidr: '24' + # + # NOTE: (Since Rocky) + # ControlPlaneSubnetCidr: It is no longer a requirement to provide this + # parameter. The attribute is resolved from the + # ctlplane subnet(s). + # # Gateway router for the provisioning network (or Undercloud IP) ControlPlaneDefaultRoute: 192.168.24.254 EC2MetadataIp: 192.168.24.1 # Generally the IP of the Undercloud diff --git a/environments/network-environment.j2.yaml b/environments/network-environment.j2.yaml index 896eea40bd..a2adcfc32e 100644 --- a/environments/network-environment.j2.yaml +++ b/environments/network-environment.j2.yaml @@ -12,8 +12,12 @@ resource_registry: parameter_defaults: # This section is where deployment-specific configuration is done - # CIDR subnet mask length for provisioning network - ControlPlaneSubnetCidr: '24' + # + # NOTE: (Since Rocky) + # ControlPlaneSubnetCidr: It is no longer a requirement to provide the + # parameter. The attribute is resolved from the + # ctlplane subnet(s). + # # Gateway router for the provisioning network (or Undercloud IP) ControlPlaneDefaultRoute: 192.168.24.254 EC2MetadataIp: 192.168.24.1 # Generally the IP of the Undercloud diff --git a/net-config-bond.j2.yaml b/net-config-bond.j2.yaml index 474a5f2e3d..da0b5a61fe 100644 --- a/net-config-bond.j2.yaml +++ b/net-config-bond.j2.yaml @@ -16,6 +16,12 @@ parameters: default: '' description: IP address/subnet on the ctlplane network type: string + ControlPlaneSubnetCidr: + default: '' + description: > + The subnet CIDR of the control plane network. (The parameter is + automatically resolved from the ctlplane subnet's cidr attribute.) + type: string {%- for network in networks %} {{network.name}}IpSubnet: default: '' diff --git a/net-config-bridge.j2.yaml b/net-config-bridge.j2.yaml index 3dc892b064..7ef75b86d3 100644 --- a/net-config-bridge.j2.yaml +++ b/net-config-bridge.j2.yaml @@ -6,6 +6,12 @@ parameters: default: '' description: IP address/subnet on the ctlplane network type: string + ControlPlaneSubnetCidr: + default: '' + description: > + The subnet CIDR of the control plane network. (The parameter is + automatically resolved from the ctlplane subnet's cidr attribute.) + type: string {%- for network in networks %} {{network.name}}IpSubnet: default: '' diff --git a/net-config-linux-bridge.j2.yaml b/net-config-linux-bridge.j2.yaml index 2f213fac7f..5f822628ca 100644 --- a/net-config-linux-bridge.j2.yaml +++ b/net-config-linux-bridge.j2.yaml @@ -16,6 +16,12 @@ parameters: description: The default route of the control plane network. type: string default: 192.168.24.1 + ControlPlaneSubnetCidr: + default: '' + description: > + The subnet CIDR of the control plane network. (The parameter is + automatically resolved from the ctlplane subnet's cidr attribute.) + type: string EC2MetadataIp: # Override this via parameter_defaults description: The IP address of the EC2 metadata server. type: string diff --git a/net-config-noop.j2.yaml b/net-config-noop.j2.yaml index eca1387a73..2c032974e6 100644 --- a/net-config-noop.j2.yaml +++ b/net-config-noop.j2.yaml @@ -9,6 +9,12 @@ parameters: default: '' description: IP address/subnet on the ctlplane network type: string + ControlPlaneSubnetCidr: + default: '' + description: > + The subnet CIDR of the control plane network. (The parameter is + automatically resolved from the ctlplane subnet's cidr attribute.) + type: string {%- for network in networks %} {{network.name}}IpSubnet: default: '' diff --git a/net-config-standalone.j2.yaml b/net-config-standalone.j2.yaml index 5886300c2a..1e09c2ef16 100644 --- a/net-config-standalone.j2.yaml +++ b/net-config-standalone.j2.yaml @@ -13,9 +13,11 @@ parameters: description: IP address/subnet on the {{network.name_lower}} network type: string {%- endfor %} - ControlPlaneSubnetCidr: # Override this via parameter_defaults - default: '24' - description: The subnet CIDR of the control plane network. + ControlPlaneSubnetCidr: + default: '' + description: > + The subnet CIDR of the control plane network. (The parameter is + automatically resolved from the ctlplane subnet's cidr attribute.) type: string ControlPlaneStaticRoutes: default: [] diff --git a/net-config-static-bridge-with-external-dhcp.j2.yaml b/net-config-static-bridge-with-external-dhcp.j2.yaml index 46d708a92b..8b047e957a 100644 --- a/net-config-static-bridge-with-external-dhcp.j2.yaml +++ b/net-config-static-bridge-with-external-dhcp.j2.yaml @@ -13,9 +13,11 @@ parameters: description: IP address/subnet on the {{network.name_lower}} network type: string {%- endfor %} - ControlPlaneSubnetCidr: # Override this via parameter_defaults - default: '24' - description: The subnet CIDR of the control plane network. + ControlPlaneSubnetCidr: + default: '' + description: > + The subnet CIDR of the control plane network. (The parameter is + automatically resolved from the ctlplane subnet's cidr attribute.) type: string ControlPlaneDefaultRoute: # Override this via parameter_defaults description: The default route of the control plane network. diff --git a/net-config-static-bridge.j2.yaml b/net-config-static-bridge.j2.yaml index 92c759fad4..51d97653b0 100644 --- a/net-config-static-bridge.j2.yaml +++ b/net-config-static-bridge.j2.yaml @@ -13,9 +13,11 @@ parameters: description: IP address/subnet on the {{network.name_lower}} network type: string {%- endfor %} - ControlPlaneSubnetCidr: # Override this via parameter_defaults - default: '24' - description: The subnet CIDR of the control plane network. + ControlPlaneSubnetCidr: + default: '' + description: > + The subnet CIDR of the control plane network. (The parameter is + automatically resolved from the ctlplane subnet's cidr attribute.) type: string ControlPlaneDefaultRoute: # Override this via parameter_defaults description: The default route of the control plane network. diff --git a/net-config-static.j2.yaml b/net-config-static.j2.yaml index 284aba215d..0cda610a75 100644 --- a/net-config-static.j2.yaml +++ b/net-config-static.j2.yaml @@ -12,9 +12,11 @@ parameters: description: IP address/subnet on the {{network.name_lower}} network type: string {%- endfor %} - ControlPlaneSubnetCidr: # Override this via parameter_defaults - default: '24' - description: The subnet CIDR of the control plane network. + ControlPlaneSubnetCidr: + default: '' + description: > + The subnet CIDR of the control plane network. (The parameter is + automatically resolved from the ctlplane subnet's cidr attribute.) type: string ControlPlaneDefaultRoute: # Override this via parameter_defaults description: The default route of the control plane network. diff --git a/net-config-undercloud.j2.yaml b/net-config-undercloud.j2.yaml index 7c2c47f059..ea1c1882d8 100644 --- a/net-config-undercloud.j2.yaml +++ b/net-config-undercloud.j2.yaml @@ -13,9 +13,11 @@ parameters: description: IP address/subnet on the {{network.name_lower}} network type: string {%- endfor %} - ControlPlaneSubnetCidr: # Override this via parameter_defaults - default: '24' - description: The subnet CIDR of the control plane network. + ControlPlaneSubnetCidr: + default: '' + description: > + The subnet CIDR of the control plane network. (The parameter is + automatically resolved from the ctlplane subnet's cidr attribute.) type: string ControlPlaneStaticRoutes: default: [] diff --git a/network/config/bond-with-vlans/controller-no-external.j2.yaml b/network/config/bond-with-vlans/controller-no-external.j2.yaml index 541f14dccf..7358affea3 100644 --- a/network/config/bond-with-vlans/controller-no-external.j2.yaml +++ b/network/config/bond-with-vlans/controller-no-external.j2.yaml @@ -10,9 +10,11 @@ parameters: default: '' description: IP address/subnet on the ctlplane network type: string - ControlPlaneSubnetCidr: # Override this via parameter_defaults - default: '24' - description: The subnet CIDR of the control plane network. + ControlPlaneSubnetCidr: + default: '' + description: > + The subnet CIDR of the control plane network. (The parameter is + automatically resolved from the ctlplane subnet's cidr attribute.) type: string ControlPlaneDefaultRoute: # Override this via parameter_defaults description: The default route of the control plane network. diff --git a/network/config/bond-with-vlans/controller-v6.j2.yaml b/network/config/bond-with-vlans/controller-v6.j2.yaml index 5a9501987f..2403a40db0 100644 --- a/network/config/bond-with-vlans/controller-v6.j2.yaml +++ b/network/config/bond-with-vlans/controller-v6.j2.yaml @@ -8,9 +8,11 @@ parameters: default: '' description: IP address/subnet on the ctlplane network type: string - ControlPlaneSubnetCidr: # Override this via parameter_defaults - default: '24' - description: The subnet CIDR of the control plane network. + ControlPlaneSubnetCidr: + default: '' + description: > + The subnet CIDR of the control plane network. (The parameter is + automatically resolved from the ctlplane subnet's cidr attribute.) type: string ControlPlaneDefaultRoute: # Override this via parameter_defaults description: The default route of the control plane network. diff --git a/network/config/bond-with-vlans/role.role.j2.yaml b/network/config/bond-with-vlans/role.role.j2.yaml index d39c6170d2..0580a8b441 100644 --- a/network/config/bond-with-vlans/role.role.j2.yaml +++ b/network/config/bond-with-vlans/role.role.j2.yaml @@ -6,9 +6,11 @@ parameters: default: '' description: IP address/subnet on the ctlplane network type: string - ControlPlaneSubnetCidr: # Override this via parameter_defaults - default: '24' - description: The subnet CIDR of the control plane network. + ControlPlaneSubnetCidr: + default: '' + description: > + The subnet CIDR of the control plane network. (The parameter is + automatically resolved from the ctlplane subnet's cidr attribute.) type: string ControlPlaneDefaultRoute: # Override this via parameter_defaults description: The default route of the control plane network. diff --git a/network/config/multiple-nics/compute-dvr.j2.yaml b/network/config/multiple-nics/compute-dvr.j2.yaml index a01db95ce0..519f4b9937 100644 --- a/network/config/multiple-nics/compute-dvr.j2.yaml +++ b/network/config/multiple-nics/compute-dvr.j2.yaml @@ -8,9 +8,11 @@ parameters: default: '' description: IP address/subnet on the ctlplane network type: string - ControlPlaneSubnetCidr: # Override this via parameter_defaults - default: '24' - description: The subnet CIDR of the control plane network. + ControlPlaneSubnetCidr: + default: '' + description: > + The subnet CIDR of the control plane network. (The parameter is + automatically resolved from the ctlplane subnet's cidr attribute.) type: string ControlPlaneDefaultRoute: # Override this via parameter_defaults description: The default route of the control plane network. diff --git a/network/config/multiple-nics/controller-v6.j2.yaml b/network/config/multiple-nics/controller-v6.j2.yaml index cf1f5ae5b0..4441c4afaf 100644 --- a/network/config/multiple-nics/controller-v6.j2.yaml +++ b/network/config/multiple-nics/controller-v6.j2.yaml @@ -7,9 +7,11 @@ parameters: default: '' description: IP address/subnet on the ctlplane network type: string - ControlPlaneSubnetCidr: # Override this via parameter_defaults - default: '24' - description: The subnet CIDR of the control plane network. + ControlPlaneSubnetCidr: + default: '' + description: > + The subnet CIDR of the control plane network. (The parameter is + automatically resolved from the ctlplane subnet's cidr attribute.) type: string ControlPlaneDefaultRoute: # Override this via parameter_defaults description: The default route of the control plane network. diff --git a/network/config/multiple-nics/role.role.j2.yaml b/network/config/multiple-nics/role.role.j2.yaml index 2908c72dba..3b3452178c 100644 --- a/network/config/multiple-nics/role.role.j2.yaml +++ b/network/config/multiple-nics/role.role.j2.yaml @@ -6,9 +6,11 @@ parameters: default: '' description: IP address/subnet on the ctlplane network type: string - ControlPlaneSubnetCidr: # Override this via parameter_defaults - default: '24' - description: The subnet CIDR of the control plane network. + ControlPlaneSubnetCidr: + default: '' + description: > + The subnet CIDR of the control plane network. (The parameter is + automatically resolved from the ctlplane subnet's cidr attribute.) type: string ControlPlaneDefaultRoute: # Override this via parameter_defaults description: The default route of the control plane network. diff --git a/network/config/single-nic-linux-bridge-vlans/controller-v6.j2.yaml b/network/config/single-nic-linux-bridge-vlans/controller-v6.j2.yaml index 0c8320e023..9aea70c4c9 100644 --- a/network/config/single-nic-linux-bridge-vlans/controller-v6.j2.yaml +++ b/network/config/single-nic-linux-bridge-vlans/controller-v6.j2.yaml @@ -7,9 +7,11 @@ parameters: default: '' description: IP address/subnet on the ctlplane network type: string - ControlPlaneSubnetCidr: # Override this via parameter_defaults - default: '24' - description: The subnet CIDR of the control plane network. + ControlPlaneSubnetCidr: + default: '' + description: > + The subnet CIDR of the control plane network. (The parameter is + automatically resolved from the ctlplane subnet's cidr attribute.) type: string ControlPlaneDefaultRoute: # Override this via parameter_defaults description: The default route of the control plane network. diff --git a/network/config/single-nic-linux-bridge-vlans/role.role.j2.yaml b/network/config/single-nic-linux-bridge-vlans/role.role.j2.yaml index 6729463a89..30c9eed79a 100644 --- a/network/config/single-nic-linux-bridge-vlans/role.role.j2.yaml +++ b/network/config/single-nic-linux-bridge-vlans/role.role.j2.yaml @@ -6,9 +6,11 @@ parameters: default: '' description: IP address/subnet on the ctlplane network type: string - ControlPlaneSubnetCidr: # Override this via parameter_defaults - default: '24' - description: The subnet CIDR of the control plane network. + ControlPlaneSubnetCidr: + default: '' + description: > + The subnet CIDR of the control plane network. (The parameter is + automatically resolved from the ctlplane subnet's cidr attribute.) type: string ControlPlaneDefaultRoute: # Override this via parameter_defaults description: The default route of the control plane network. diff --git a/network/config/single-nic-vlans/controller-no-external.j2.yaml b/network/config/single-nic-vlans/controller-no-external.j2.yaml index 3f4f033be6..6ebb96f66e 100644 --- a/network/config/single-nic-vlans/controller-no-external.j2.yaml +++ b/network/config/single-nic-vlans/controller-no-external.j2.yaml @@ -10,9 +10,11 @@ parameters: default: '' description: IP address/subnet on the ctlplane network type: string - ControlPlaneSubnetCidr: # Override this via parameter_defaults - default: '24' - description: The subnet CIDR of the control plane network. + ControlPlaneSubnetCidr: + default: '' + description: > + The subnet CIDR of the control plane network. (The parameter is + automatically resolved from the ctlplane subnet's cidr attribute.) type: string ControlPlaneDefaultRoute: # Override this via parameter_defaults description: The default route of the control plane network. diff --git a/network/config/single-nic-vlans/controller-v6.j2.yaml b/network/config/single-nic-vlans/controller-v6.j2.yaml index 1b30749893..9dff4ad7b1 100644 --- a/network/config/single-nic-vlans/controller-v6.j2.yaml +++ b/network/config/single-nic-vlans/controller-v6.j2.yaml @@ -7,9 +7,11 @@ parameters: default: '' description: IP address/subnet on the ctlplane network type: string - ControlPlaneSubnetCidr: # Override this via parameter_defaults - default: '24' - description: The subnet CIDR of the control plane network. + ControlPlaneSubnetCidr: + default: '' + description: > + The subnet CIDR of the control plane network. (The parameter is + automatically resolved from the ctlplane subnet's cidr attribute.) type: string ControlPlaneDefaultRoute: # Override this via parameter_defaults description: The default route of the control plane network. diff --git a/network/config/single-nic-vlans/role.role.j2.yaml b/network/config/single-nic-vlans/role.role.j2.yaml index 27f5a11599..368fa2b259 100644 --- a/network/config/single-nic-vlans/role.role.j2.yaml +++ b/network/config/single-nic-vlans/role.role.j2.yaml @@ -6,9 +6,11 @@ parameters: default: '' description: IP address/subnet on the ctlplane network type: string - ControlPlaneSubnetCidr: # Override this via parameter_defaults - default: '24' - description: The subnet CIDR of the control plane network. + ControlPlaneSubnetCidr: + default: '' + description: > + The subnet CIDR of the control plane network. (The parameter is + automatically resolved from the ctlplane subnet's cidr attribute.) type: string ControlPlaneDefaultRoute: # Override this via parameter_defaults description: The default route of the control plane network. diff --git a/network/ports/ctlplane_vip.yaml b/network/ports/ctlplane_vip.yaml index 51934104f8..4d3aa589f7 100644 --- a/network/ports/ctlplane_vip.yaml +++ b/network/ports/ctlplane_vip.yaml @@ -21,6 +21,12 @@ parameters: description: IP address on the control plane default: '' type: string + ControlPlaneSubnetCidr: # Here for compatibility with ctlplane_vip.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: description: The name of the undercloud Neutron control plane default: ctlplane diff --git a/network/ports/from_service.yaml b/network/ports/from_service.yaml index 5f07d061d1..d9140c716d 100644 --- a/network/ports/from_service.yaml +++ b/network/ports/from_service.yaml @@ -20,6 +20,12 @@ parameters: description: IP address on the control plane default: '' type: string + ControlPlaneSubnetCidr: # Here for compatibility with ctlplane_vip.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 diff --git a/network/ports/from_service_v6.yaml b/network/ports/from_service_v6.yaml index cc01620c00..2047ef9576 100644 --- a/network/ports/from_service_v6.yaml +++ b/network/ports/from_service_v6.yaml @@ -20,6 +20,12 @@ parameters: description: IP address on the control plane default: '' type: string + ControlPlaneSubnetCidr: # Here for compatibility with ctlplane_vip.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 compatability with ctlplane_vip.yaml description: The name of the undercloud Neutron control plane default: ctlplane diff --git a/network/ports/net_ip_map.j2.yaml b/network/ports/net_ip_map.j2.yaml index 8046873c1b..d8e4cdfb2a 100644 --- a/network/ports/net_ip_map.j2.yaml +++ b/network/ports/net_ip_map.j2.yaml @@ -4,9 +4,11 @@ parameters: ControlPlaneIp: default: '' type: string - ControlPlaneSubnetCidr: # Override this via parameter_defaults - default: '24' - description: The subnet CIDR of the control plane network. + ControlPlaneSubnetCidr: + default: '' + description: > + The subnet CIDR of the control plane network. (The parameter is + automatically resolved from the ctlplane subnet's cidr attribute.) type: string {%- for network in networks %} {{network.name}}Ip: diff --git a/network/ports/noop.yaml b/network/ports/noop.yaml index c9569f5362..740a8cf736 100644 --- a/network/ports/noop.yaml +++ b/network/ports/noop.yaml @@ -33,9 +33,11 @@ parameters: [{'ip_address':'1.2.3.4'}] default: [] type: json - ControlPlaneSubnetCidr: # Override this via parameter_defaults - default: '24' - description: The subnet CIDR of the control plane network. + ControlPlaneSubnetCidr: + default: '' + description: > + The subnet CIDR of the control plane network. (The parameter is + automatically resolved from the ctlplane subnet's cidr attribute.) type: string IPPool: # Here for compatibility with from_pool.yaml default: {} diff --git a/network/ports/port.j2 b/network/ports/port.j2 index 079646d95f..a60d944e2a 100644 --- a/network/ports/port.j2 +++ b/network/ports/port.j2 @@ -17,6 +17,12 @@ parameters: 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 diff --git a/network/ports/port_from_pool.j2 b/network/ports/port_from_pool.j2 index caaa2de331..1fa2f97a29 100644 --- a/network/ports/port_from_pool.j2 +++ b/network/ports/port_from_pool.j2 @@ -28,6 +28,12 @@ parameters: description: IP address on the control plane default: '' type: string + ControlPlaneSubnetCidr: # Here for compatibility with noop.yaml + description: > + The subnet CIDR of the control plane network. (The parameter is + automatically resolved from the ctlplane subnet's cidr attribute.) + type: string + default: '' ControlPlaneNetwork: # Here for compatibility with ctlplane_vip.yaml description: The name of the undercloud Neutron control plane default: ctlplane diff --git a/network/ports/vip.yaml b/network/ports/vip.yaml index 0b29ac22a6..4cbe70ce43 100644 --- a/network/ports/vip.yaml +++ b/network/ports/vip.yaml @@ -21,6 +21,12 @@ parameters: 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: description: The name of the undercloud Neutron control plane default: ctlplane diff --git a/network/ports/vip_v6.yaml b/network/ports/vip_v6.yaml index a6042c6fee..6cc5510d3e 100644 --- a/network/ports/vip_v6.yaml +++ b/network/ports/vip_v6.yaml @@ -21,6 +21,12 @@ parameters: 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: description: The name of the undercloud Neutron control plane default: ctlplane diff --git a/overcloud.j2.yaml b/overcloud.j2.yaml index fbcd7a4cdd..6394acdb76 100644 --- a/overcloud.j2.yaml +++ b/overcloud.j2.yaml @@ -98,6 +98,12 @@ parameters: description: The name of the undercloud Neutron control plane subnet default: ctlplane-subnet type: string + ControlPlaneSubnetCidr: + default: '' + description: > + The subnet CIDR of the control plane network. (The parameter is + automatically resolved from the ctlplane subnet's cidr attribute.) + type: string ControlFixedIPs: default: [] description: > @@ -260,6 +266,9 @@ parameter_groups: conditions: add_vips_to_etc_hosts: {equals : [{get_param: AddVipsToEtcHosts}, True]} control_fixed_ip_not_set: {equals : [{get_param: ControlFixedIPs}, []]} + ctlplane_subnet_cidr_set: + not: + equals: [{get_param: ControlPlaneSubnetCidr}, ''] resources: @@ -777,6 +786,11 @@ resources: type: OS::TripleO::Network::Ports::RedisVipPort properties: ControlPlaneIP: {get_attr: [ControlVirtualIP, fixed_ips, 0, ip_address]} + ControlPlaneSubnetCidr: + if: + - ctlplane_subnet_cidr_set + - {get_param: ControlPlaneSubnetCidr} + - {str_split: ['/', {get_attr: [ControlVirtualIP, subnets, 0, cidr]}, 1]} ControlPlaneNetwork: {get_param: NeutronControlPlaneID} PortName: redis_virtual_ip NetworkName: {get_attr: [ServiceNetMap, service_net_map, RedisNetwork]} @@ -791,6 +805,11 @@ resources: type: OS::TripleO::Network::Ports::ExternalVipPort properties: ControlPlaneIP: {get_attr: [ControlVirtualIP, fixed_ips, 0, ip_address]} + ControlPlaneSubnetCidr: + if: + - ctlplane_subnet_cidr_set + - {get_param: ControlPlaneSubnetCidr} + - {str_split: ['/', {get_attr: [ControlVirtualIP, subnets, 0, cidr]}, 1]} ControlPlaneNetwork: {get_param: NeutronControlPlaneID} PortName: public_virtual_ip FixedIPs: {get_param: PublicVirtualFixedIPs} @@ -800,6 +819,11 @@ resources: type: OS::TripleO::Network::Ports::{{network.name}}VipPort properties: ControlPlaneIP: {get_attr: [ControlVirtualIP, fixed_ips, 0, ip_address]} + ControlPlaneSubnetCidr: + if: + - ctlplane_subnet_cidr_set + - {get_param: ControlPlaneSubnetCidr} + - {str_split: ['/', {get_attr: [ControlVirtualIP, subnets, 0, cidr]}, 1]} PortName: {{network.name_lower}}_virtual_ip FixedIPs: {get_param: {{network.name}}VirtualFixedIPs} {%- endif %} @@ -809,6 +833,11 @@ resources: type: OS::TripleO::Network::Ports::NetVipMap properties: ControlPlaneIp: {get_attr: [ControlVirtualIP, fixed_ips, 0, ip_address]} + ControlPlaneSubnetCidr: + if: + - ctlplane_subnet_cidr_set + - {get_param: ControlPlaneSubnetCidr} + - {str_split: ['/', {get_attr: [ControlVirtualIP, subnets, 0, cidr]}, 1]} {%- for network in networks if network.vip|default(false) %} {%- if network.name == 'External' %} ExternalIp: {get_attr: [PublicVirtualIP, ip_address]} diff --git a/puppet/role.role.j2.yaml b/puppet/role.role.j2.yaml index 9ff4da7992..84c8d9f06f 100644 --- a/puppet/role.role.j2.yaml +++ b/puppet/role.role.j2.yaml @@ -244,6 +244,12 @@ parameters: {{role.name}}MaxFailPercentage: default: 15 type: number + ControlPlaneSubnetCidr: + default: '' + description: > + The subnet CIDR of the control plane network. (The parameter is + automatically resolved from the ctlplane subnet's cidr attribute.) + type: string ServerDeletionPolicy: description: Whether to retain or delete servers on deletion of the stack @@ -315,6 +321,9 @@ conditions: - {get_param: [{{role.name}}IPs, '{{network.name_lower}}', {get_param: NodeIndex}]} - '' {%- endfor %} + ctlplane_subnet_cidr_set: + not: + equals: [{get_param: ControlPlaneSubnetCidr}, ''] resources: {{server_resource_name}}: @@ -417,6 +426,11 @@ resources: - {{role.name}}_{{network.name}}_fixed_ip_set - [{ip_address: {get_param: [{{role.name}}IPs, '{{network.name_lower}}', {get_param: NodeIndex}]}}] - [] + ControlPlaneSubnetCidr: + if: + - ctlplane_subnet_cidr_set + - {get_param: ControlPlaneSubnetCidr} + - {str_split: ['/', {get_attr: [{{server_resource_name}}, addresses, ctlplane, 0, subnets, 0, cidr]}, 1]} IPPool: map_merge: {%- if role.deprecated_param_ips is defined %} @@ -430,6 +444,11 @@ resources: type: OS::TripleO::{{role.name}}::Net::SoftwareConfig properties: ControlPlaneIp: {get_attr: [{{server_resource_name}}, networks, ctlplane, 0]} + ControlPlaneSubnetCidr: + if: + - ctlplane_subnet_cidr_set + - {get_param: ControlPlaneSubnetCidr} + - {str_split: ['/', {get_attr: [{{server_resource_name}}, addresses, ctlplane, 0, subnets, 0, cidr]}, 1]} {%- for network in networks %} {{network.name}}IpSubnet: {get_attr: [{{network.name}}Port, ip_subnet]} {%- endfor %} @@ -438,6 +457,11 @@ resources: type: OS::TripleO::Network::Ports::NetIpMap properties: ControlPlaneIp: {get_attr: [{{server_resource_name}}, networks, ctlplane, 0]} + ControlPlaneSubnetCidr: + if: + - ctlplane_subnet_cidr_set + - {get_param: ControlPlaneSubnetCidr} + - {str_split: ['/', {get_attr: [{{server_resource_name}}, addresses, ctlplane, 0, subnets, 0, cidr]}, 1]} {%- for network in networks %} {{network.name}}Ip: {get_attr: [{{network.name}}Port, ip_address]} {{network.name}}IpSubnet: {get_attr: [{{network.name}}Port, ip_subnet]} @@ -746,6 +770,8 @@ outputs: - hostname: fixed_ips: - ip_address: {get_attr: [{{server_resource_name}}, networks, ctlplane, 0]} + subnets: + - cidr: {get_attr: [{{server_resource_name}}, addresses, ctlplane, 0, subnets, 0, cidr]} - keys: hostname: list_join: diff --git a/releasenotes/notes/use-subnet-attrs-ctlplane-cidr-a02e14a251733726.yaml b/releasenotes/notes/use-subnet-attrs-ctlplane-cidr-a02e14a251733726.yaml new file mode 100644 index 0000000000..e5fb486f46 --- /dev/null +++ b/releasenotes/notes/use-subnet-attrs-ctlplane-cidr-a02e14a251733726.yaml @@ -0,0 +1,25 @@ +--- +features: + - | + It is no longer a requirement to provide the parameter: + ``ControlPlaneSubnetCidr`` in the environment when deploying. Now + ``get_attr`` on the server resource is used to resolve the value from the + ``ctlplane`` subnet's ``cidr`` attribute. A conditional is used to + determine if the user provided the parameter in the environment. If the + user provided the parameter, the user provided value is used. +upgrade: + - | + Since the the ``ControlPlaneSubnetCidr`` can now be resolved from the + ``ctlplane`` subnet(s) this parameter can be removed from the environment + (``network-environment.yaml``). + + .. Note:: Prior to removing the parameter, ensure that the property of + the ``ctlplane`` subnet(s) is correct. In case it is not, update + ``undercloud.conf`` with the correct configuration and re-run the + ``openstack undercloud install`` command to ensure the property + is set correctly. + + .. Note:: ``ControlPlaneSubnetCidr`` is now passed to the network config + template when the resource is created. Because of this the + parameter must be defined in the network config template, even if + it is not used.