EC2MetadatIp using get_attr

The route to metadata service is set up in host_routes
of ctlplane subnets by extraconf post deploy::
  extraconfig/post_deploy/undercloud_ctlplane_network.py

Use get_attr on the server resource to resolve attribute
value from the subnet(s) and pass it to the parameter
'EC2MetadatIp' used in the THT/network/config/* templates.

Changes the default for 'EC2MetadatIp' to ''.
Removes the comment that the 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 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
'EC2MetadatIpLeafX' parameters for each leaf.  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: I9c019ec840a44ca8c5f98be55daea365bc6554ec
This commit is contained in:
Harald Jensås 2018-06-30 21:07:55 +02:00
parent c649cf0545
commit 19381ecffb
45 changed files with 209 additions and 66 deletions

View File

@ -52,6 +52,11 @@ parameters:
default: 1300
description: The mtu of the OvS bridge
type: number
EC2MetadataIp:
default: ''
description: The IP address of the EC2 metadata server. (The parameter
is automatically resolved from the ctlplane subnet's host_routes attribute.)
type: string
resources:

View File

@ -48,6 +48,11 @@ parameters:
description: The default route of the control plane network. (The parameter
is automatically resolved from the ctlplane subnet's gateway_ip attribute.)
type: string
EC2MetadataIp:
default: ''
description: The IP address of the EC2 metadata server. (The parameter
is automatically resolved from the ctlplane subnet's host_routes attribute.)
type: string
resources:
OsNetConfigImpl:

View File

@ -41,6 +41,12 @@ parameters:
default: ''
description: IP address/subnet on the management network
type: string
EC2MetadataIp:
default: ''
description: The IP address of the EC2 metadata server. (The parameter
is automatically resolved from the ctlplane subnet's host_routes attribute.)
type: string
resources:
OsNetConfigImpl:
type: OS::Heat::SoftwareConfig

View File

@ -7,7 +7,6 @@ resource_registry:
OS::TripleO::CephStorage::Net::SoftwareConfig: nic-configs/ceph-storage.yaml
parameter_defaults:
EC2MetadataIp: 192.168.24.1
ExternalNetCidr: 2001:db8:fd00:1000::/64
ExternalAllocationPools: [{"start": "2001:db8:fd00:1000::10", "end": "2001:db8:fd00:1000:ffff:ffff:ffff:fffe"}]
ExternalInterfaceDefaultRoute: 2001:db8:fd00:1000::1

View File

@ -77,8 +77,10 @@ parameters:
default: []
description: A list of DNS servers (2 max for some implementations) that will be added to resolv.conf.
type: comma_delimited_list
EC2MetadataIp: # Override this via parameter_defaults
description: The IP address of the EC2 metadata server.
EC2MetadataIp:
default: ''
description: The IP address of the EC2 metadata server. (The parameter
is automatically resolved from the ctlplane subnet's host_routes attribute.)
type: string
resources:

View File

@ -77,8 +77,10 @@ parameters:
default: []
description: A list of DNS servers (2 max for some implementations) that will be added to resolv.conf.
type: comma_delimited_list
EC2MetadataIp: # Override this via parameter_defaults
description: The IP address of the EC2 metadata server.
EC2MetadataIp:
default: ''
description: The IP address of the EC2 metadata server. (The parameter
is automatically resolved from the ctlplane subnet's host_routes attribute.)
type: string
resources:

View File

@ -77,8 +77,10 @@ parameters:
default: []
description: A list of DNS servers (2 max for some implementations) that will be added to resolv.conf.
type: comma_delimited_list
EC2MetadataIp: # Override this via parameter_defaults
description: The IP address of the EC2 metadata server.
EC2MetadataIp:
default: ''
description: The IP address of the EC2 metadata server. (The parameter
is automatically resolved from the ctlplane subnet's host_routes attribute.)
type: string
resources:

View File

@ -77,8 +77,10 @@ parameters:
default: []
description: A list of DNS servers (2 max for some implementations) that will be added to resolv.conf.
type: comma_delimited_list
EC2MetadataIp: # Override this via parameter_defaults
description: The IP address of the EC2 metadata server.
EC2MetadataIp:
default: ''
description: The IP address of the EC2 metadata server. (The parameter
is automatically resolved from the ctlplane subnet's host_routes attribute.)
type: string
resources:

View File

@ -77,8 +77,10 @@ parameters:
default: []
description: A list of DNS servers (2 max for some implementations) that will be added to resolv.conf.
type: comma_delimited_list
EC2MetadataIp: # Override this via parameter_defaults
description: The IP address of the EC2 metadata server.
EC2MetadataIp:
default: ''
description: The IP address of the EC2 metadata server. (The parameter
is automatically resolved from the ctlplane subnet's host_routes attribute.)
type: string
resources:

View File

@ -7,7 +7,6 @@ resource_registry:
OS::TripleO::CephStorage::Net::SoftwareConfig: nic-configs/ceph-storage.yaml
parameter_defaults:
EC2MetadataIp: 192.168.24.1
ExternalNetCidr: 10.0.0.0/24
ExternalAllocationPools: [{"start": "10.0.0.10", "end": "10.0.0.50"}]
ExternalInterfaceDefaultRoute: 10.0.0.1

View File

@ -77,8 +77,10 @@ parameters:
default: []
description: A list of DNS servers (2 max for some implementations) that will be added to resolv.conf.
type: comma_delimited_list
EC2MetadataIp: # Override this via parameter_defaults
description: The IP address of the EC2 metadata server.
EC2MetadataIp:
default: ''
description: The IP address of the EC2 metadata server. (The parameter
is automatically resolved from the ctlplane subnet's host_routes attribute.)
type: string
resources:

View File

@ -77,8 +77,10 @@ parameters:
default: []
description: A list of DNS servers (2 max for some implementations) that will be added to resolv.conf.
type: comma_delimited_list
EC2MetadataIp: # Override this via parameter_defaults
description: The IP address of the EC2 metadata server.
EC2MetadataIp:
default: ''
description: The IP address of the EC2 metadata server. (The parameter
is automatically resolved from the ctlplane subnet's host_routes attribute.)
type: string
resources:

View File

@ -77,8 +77,10 @@ parameters:
default: []
description: A list of DNS servers (2 max for some implementations) that will be added to resolv.conf.
type: comma_delimited_list
EC2MetadataIp: # Override this via parameter_defaults
description: The IP address of the EC2 metadata server.
EC2MetadataIp:
default: ''
description: The IP address of the EC2 metadata server. (The parameter
is automatically resolved from the ctlplane subnet's host_routes attribute.)
type: string
resources:

View File

@ -77,8 +77,10 @@ parameters:
default: []
description: A list of DNS servers (2 max for some implementations) that will be added to resolv.conf.
type: comma_delimited_list
EC2MetadataIp: # Override this via parameter_defaults
description: The IP address of the EC2 metadata server.
EC2MetadataIp:
default: ''
description: The IP address of the EC2 metadata server. (The parameter
is automatically resolved from the ctlplane subnet's host_routes attribute.)
type: string
resources:

View File

@ -77,8 +77,10 @@ parameters:
default: []
description: A list of DNS servers (2 max for some implementations) that will be added to resolv.conf.
type: comma_delimited_list
EC2MetadataIp: # Override this via parameter_defaults
description: The IP address of the EC2 metadata server.
EC2MetadataIp:
default: ''
description: The IP address of the EC2 metadata server. (The parameter
is automatically resolved from the ctlplane subnet's host_routes attribute.)
type: string
resources:

View File

@ -7,7 +7,6 @@ resource_registry:
OS::TripleO::CephStorage::Net::SoftwareConfig: nic-configs/ceph-storage.yaml
parameter_defaults:
EC2MetadataIp: 192.168.24.1
ExternalNetCidr: 10.0.0.0/24
ExternalAllocationPools: [{"start": "10.0.0.10", "end": "10.0.0.50"}]
ExternalInterfaceDefaultRoute: 10.0.0.1

View File

@ -77,8 +77,10 @@ parameters:
default: []
description: A list of DNS servers (2 max for some implementations) that will be added to resolv.conf.
type: comma_delimited_list
EC2MetadataIp: # Override this via parameter_defaults
description: The IP address of the EC2 metadata server.
EC2MetadataIp:
default: ''
description: The IP address of the EC2 metadata server. (The parameter
is automatically resolved from the ctlplane subnet's host_routes attribute.)
type: string
resources:

View File

@ -77,8 +77,10 @@ parameters:
default: []
description: A list of DNS servers (2 max for some implementations) that will be added to resolv.conf.
type: comma_delimited_list
EC2MetadataIp: # Override this via parameter_defaults
description: The IP address of the EC2 metadata server.
EC2MetadataIp:
default: ''
description: The IP address of the EC2 metadata server. (The parameter
is automatically resolved from the ctlplane subnet's host_routes attribute.)
type: string
resources:

View File

@ -77,8 +77,10 @@ parameters:
default: []
description: A list of DNS servers (2 max for some implementations) that will be added to resolv.conf.
type: comma_delimited_list
EC2MetadataIp: # Override this via parameter_defaults
description: The IP address of the EC2 metadata server.
EC2MetadataIp:
default: ''
description: The IP address of the EC2 metadata server. (The parameter
is automatically resolved from the ctlplane subnet's host_routes attribute.)
type: string
resources:

View File

@ -77,8 +77,10 @@ parameters:
default: []
description: A list of DNS servers (2 max for some implementations) that will be added to resolv.conf.
type: comma_delimited_list
EC2MetadataIp: # Override this via parameter_defaults
description: The IP address of the EC2 metadata server.
EC2MetadataIp:
default: ''
description: The IP address of the EC2 metadata server. (The parameter
is automatically resolved from the ctlplane subnet's host_routes attribute.)
type: string
resources:

View File

@ -77,8 +77,10 @@ parameters:
default: []
description: A list of DNS servers (2 max for some implementations) that will be added to resolv.conf.
type: comma_delimited_list
EC2MetadataIp: # Override this via parameter_defaults
description: The IP address of the EC2 metadata server.
EC2MetadataIp:
default: ''
description: The IP address of the EC2 metadata server. (The parameter
is automatically resolved from the ctlplane subnet's host_routes attribute.)
type: string
resources:

View File

@ -24,8 +24,10 @@ parameter_defaults:
# ControlPlaneDefaultRoute: It is no longer a requirement to provide this
# parameter. The attribute is resolved from the
# ctlplane subnet(s).
# EC2MetadataIp: It is no longer a requirement to provide this parameter. The
# attribute is resolved from the ctlplane subnet(s).
#
#
EC2MetadataIp: 192.168.24.1 # Generally the IP of the Undercloud
{% for network in networks if network.enabled|default(true) %}
{%- if network.name != 'Tenant' %}
# Customize the IP subnets to match the local environment

View File

@ -20,8 +20,9 @@ parameter_defaults:
# ControlPlaneDefaultRoute: It is no longer a requirement to provide this
# parameter. The attribute is resolved from the
# ctlplane subnet(s).
# EC2MetadataIp: It is no longer a requirement to provide this parameter. The
# attribute is resolved from the ctlplane subnet(s).
#
EC2MetadataIp: 192.168.24.1 # Generally the IP of the Undercloud
{% for network in networks if network.enabled|default(true) %}
# Customize the IP subnet to match the local environment
{%- if network.ipv6|default(false) %}

View File

@ -27,6 +27,11 @@ parameters:
description: The default route of the control plane network. (The parameter
is automatically resolved from the ctlplane subnet's gateway_ip attribute.)
type: string
EC2MetadataIp: # Here for compatability, not used.
default: ''
description: The IP address of the EC2 metadata server. (The parameter
is automatically resolved from the ctlplane subnet's host_routes attribute.)
type: string
{%- for network in networks %}
{{network.name}}IpSubnet:
default: ''

View File

@ -17,6 +17,11 @@ parameters:
description: The default route of the control plane network. (The parameter
is automatically resolved from the ctlplane subnet's gateway_ip attribute.)
type: string
EC2MetadataIp: # Here for compatability, not used.
default: ''
description: The IP address of the EC2 metadata server. (The parameter
is automatically resolved from the ctlplane subnet's host_routes attribute.)
type: string
{%- for network in networks %}
{{network.name}}IpSubnet:
default: ''

View File

@ -23,10 +23,11 @@ parameters:
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.
EC2MetadataIp:
default: ''
description: The IP address of the EC2 metadata server. (The parameter
is automatically resolved from the ctlplane subnet's host_routes attribute.)
type: string
default: 169.254.169.254/32
resources:
OsNetConfigImpl:
type: OS::Heat::SoftwareConfig

View File

@ -20,6 +20,11 @@ parameters:
description: The default route of the control plane network. (The parameter
is automatically resolved from the ctlplane subnet's gateway_ip attribute.)
type: string
EC2MetadataIp: # Here for compatability, not used.
default: ''
description: The IP address of the EC2 metadata server. (The parameter
is automatically resolved from the ctlplane subnet's host_routes attribute.)
type: string
{%- for network in networks %}
{{network.name}}IpSubnet:
default: ''

View File

@ -46,6 +46,11 @@ parameters:
tripleoclient to provide an easy means to pass in custom net configs
for a standalone node.
type: json
EC2MetadataIp: # Here for compatability, not used.
default: ''
description: The IP address of the EC2 metadata server. (The parameter
is automatically resolved from the ctlplane subnet's host_routes attribute.)
type: string
conditions:
standalone_net_config_override:

View File

@ -28,8 +28,10 @@ parameters:
default: []
description: A list of DNS servers (2 max for some implementations) that will be added to resolv.conf.
type: comma_delimited_list
EC2MetadataIp: # Override this via parameter_defaults
description: The IP address of the EC2 metadata server.
EC2MetadataIp:
default: ''
description: The IP address of the EC2 metadata server. (The parameter
is automatically resolved from the ctlplane subnet's host_routes attribute.)
type: string
resources:
OsNetConfigImpl:

View File

@ -28,8 +28,10 @@ parameters:
default: []
description: A list of DNS servers (2 max for some implementations) that will be added to resolv.conf.
type: comma_delimited_list
EC2MetadataIp: # Override this via parameter_defaults
description: The IP address of the EC2 metadata server.
EC2MetadataIp:
default: ''
description: The IP address of the EC2 metadata server. (The parameter
is automatically resolved from the ctlplane subnet's host_routes attribute.)
type: string
resources:
OsNetConfigImpl:

View File

@ -27,8 +27,10 @@ parameters:
default: []
description: A list of DNS servers (2 max for some implementations) that will be added to resolv.conf.
type: comma_delimited_list
EC2MetadataIp: # Override this via parameter_defaults
description: The IP address of the EC2 metadata server.
EC2MetadataIp:
default: ''
description: The IP address of the EC2 metadata server. (The parameter
is automatically resolved from the ctlplane subnet's host_routes attribute.)
type: string
resources:
OsNetConfigImpl:

View File

@ -42,6 +42,11 @@ parameters:
default: {}
description: Custom JSON data to be used to override the os-net-config data in this template. This is meant to be used by net_config_override parameter in tripleoclient to provide an easy means to pass in custom net configs for the Undercloud.
type: json
EC2MetadataIp: # Here for compatability, not used.
default: ''
description: The IP address of the EC2 metadata server. (The parameter
is automatically resolved from the ctlplane subnet's host_routes attribute.)
type: string
conditions:
undercloud_net_config_override:

View File

@ -46,8 +46,10 @@ parameters:
default: []
description: A list of DNS servers (2 max for some implementations) that will be added to resolv.conf.
type: comma_delimited_list
EC2MetadataIp: # Override this via parameter_defaults
description: The IP address of the EC2 metadata server.
EC2MetadataIp:
default: ''
description: The IP address of the EC2 metadata server. (The parameter
is automatically resolved from the ctlplane subnet's host_routes attribute.)
type: string
BondInterfaceOvsOptions:
default: ''

View File

@ -44,8 +44,10 @@ parameters:
default: []
description: A list of DNS servers (2 max for some implementations) that will be added to resolv.conf.
type: comma_delimited_list
EC2MetadataIp: # Override this via parameter_defaults
description: The IP address of the EC2 metadata server.
EC2MetadataIp:
default: ''
description: The IP address of the EC2 metadata server. (The parameter
is automatically resolved from the ctlplane subnet's host_routes attribute.)
type: string
BondInterfaceOvsOptions:
default: bond_mode=active-backup

View File

@ -42,8 +42,10 @@ parameters:
default: []
description: A list of DNS servers (2 max for some implementations) that will be added to resolv.conf.
type: comma_delimited_list
EC2MetadataIp: # Override this via parameter_defaults
description: The IP address of the EC2 metadata server.
EC2MetadataIp:
default: ''
description: The IP address of the EC2 metadata server. (The parameter
is automatically resolved from the ctlplane subnet's host_routes attribute.)
type: string
BondInterfaceOvsOptions:
default: bond_mode=active-backup

View File

@ -44,8 +44,10 @@ parameters:
default: []
description: A list of DNS servers (2 max for some implementations) that will be added to resolv.conf.
type: comma_delimited_list
EC2MetadataIp: # Override this via parameter_defaults
description: The IP address of the EC2 metadata server.
EC2MetadataIp:
default: ''
description: The IP address of the EC2 metadata server. (The parameter
is automatically resolved from the ctlplane subnet's host_routes attribute.)
type: string
resources:
OsNetConfigImpl:

View File

@ -43,8 +43,10 @@ parameters:
default: []
description: A list of DNS servers (2 max for some implementations) that will be added to resolv.conf.
type: comma_delimited_list
EC2MetadataIp: # Override this via parameter_defaults
description: The IP address of the EC2 metadata server.
EC2MetadataIp:
default: ''
description: The IP address of the EC2 metadata server. (The parameter
is automatically resolved from the ctlplane subnet's host_routes attribute.)
type: string
resources:
OsNetConfigImpl:

View File

@ -42,8 +42,10 @@ parameters:
default: []
description: A list of DNS servers (2 max for some implementations) that will be added to resolv.conf.
type: comma_delimited_list
EC2MetadataIp: # Override this via parameter_defaults
description: The IP address of the EC2 metadata server.
EC2MetadataIp:
default: ''
description: The IP address of the EC2 metadata server. (The parameter
is automatically resolved from the ctlplane subnet's host_routes attribute.)
type: string
{%- if role.name == 'ComputeOvsDpdk' %}
NumDpdkInterfaceRxQueues:

View File

@ -43,8 +43,10 @@ parameters:
default: []
description: A list of DNS servers (2 max for some implementations) that will be added to resolv.conf.
type: comma_delimited_list
EC2MetadataIp: # Override this via parameter_defaults
description: The IP address of the EC2 metadata server.
EC2MetadataIp:
default: ''
description: The IP address of the EC2 metadata server. (The parameter
is automatically resolved from the ctlplane subnet's host_routes attribute.)
type: string
resources:
OsNetConfigImpl:

View File

@ -42,8 +42,10 @@ parameters:
default: []
description: A list of DNS servers (2 max for some implementations) that will be added to resolv.conf.
type: comma_delimited_list
EC2MetadataIp: # Override this via parameter_defaults
description: The IP address of the EC2 metadata server.
EC2MetadataIp:
default: ''
description: The IP address of the EC2 metadata server. (The parameter
is automatically resolved from the ctlplane subnet's host_routes attribute.)
type: string
resources:
OsNetConfigImpl:

View File

@ -46,8 +46,10 @@ parameters:
default: []
description: A list of DNS servers (2 max for some implementations) that will be added to resolv.conf.
type: comma_delimited_list
EC2MetadataIp: # Override this via parameter_defaults
description: The IP address of the EC2 metadata server.
EC2MetadataIp:
default: ''
description: The IP address of the EC2 metadata server. (The parameter
is automatically resolved from the ctlplane subnet's host_routes attribute.)
type: string
resources:
OsNetConfigImpl:

View File

@ -43,8 +43,10 @@ parameters:
default: []
description: A list of DNS servers (2 max for some implementations) that will be added to resolv.conf.
type: comma_delimited_list
EC2MetadataIp: # Override this via parameter_defaults
description: The IP address of the EC2 metadata server.
EC2MetadataIp:
default: ''
description: The IP address of the EC2 metadata server. (The parameter
is automatically resolved from the ctlplane subnet's host_routes attribute.)
type: string
resources:
OsNetConfigImpl:

View File

@ -42,8 +42,10 @@ parameters:
default: []
description: A list of DNS servers (2 max for some implementations) that will be added to resolv.conf.
type: comma_delimited_list
EC2MetadataIp: # Override this via parameter_defaults
description: The IP address of the EC2 metadata server.
EC2MetadataIp:
default: ''
description: The IP address of the EC2 metadata server. (The parameter
is automatically resolved from the ctlplane subnet's host_routes attribute.)
type: string
resources:
OsNetConfigImpl:

View File

@ -255,6 +255,11 @@ parameters:
description: The default route of the control plane network. (The parameter
is automatically resolved from the ctlplane subnet's gateway_ip attribute.)
type: string
EC2MetadataIp:
default: ''
description: The IP address of the EC2 metadata server. (The parameter
is automatically resolved from the ctlplane subnet's host_routes attribute.)
type: string
ServerDeletionPolicy:
description: Whether to retain or delete servers on deletion of the stack
@ -332,6 +337,9 @@ conditions:
ctlplane_default_route_set:
not:
equals: [{get_param: ControlPlaneDefaultRoute}, '']
ec2metadaip_set:
not:
equals: [{get_param: EC2MetadataIp}, '']
resources:
{{server_resource_name}}:
@ -462,6 +470,16 @@ resources:
- ctlplane_default_route_set
- {get_param: ControlPlaneDefaultRoute}
- {get_attr: [{{server_resource_name}}, addresses, ctlplane, 0, subnets, 0, gateway_ip]}
EC2MetadataIp:
if:
- ec2metadaip_set
- {get_param: EC2MetadataIp}
- yaql:
# NOTE(hjensas): DeployedServer sets the EC2MetadataIp in DeployedServerEnvironment.
# Return an empty string if there are no host_routes in the subnet. (Standalone and Container Undercloud)
expression: switch($.data = null => '', $.data != null => $.data.where($.destination = "169.254.169.254/32").nexthop.first())
data: {get_attr: [{{server_resource_name}}, addresses, ctlplane, 0, subnets, 0, host_routes]}
{%- for network in networks %}
{{network.name}}IpSubnet: {get_attr: [{{network.name}}Port, ip_subnet]}
{%- endfor %}

View File

@ -0,0 +1,25 @@
---
features:
- |
It is no longer a requirement to provide the parameter: ``EC2MetadataIp``
in the environment when deploying. Now ``get_attr`` on the server resource
is used to resolve the value from the ``ctlplane`` subnet's ``host_routes``
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 ``EC2MetadataIp`` 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:: ``EC2MetadataIp`` 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.