Set dns_name propery on ports and networks

Neutron's dns_assignments field includes a nice pice of
structured data. This is a prerequirement for Designate
usage. (No plan's to use that, but being a bit ready
does'nt hurt.)

  {"hostname": "my-vm",
   "ip_address": "192.0.2.16",
   "fqdn": "my-vm.example.org."}

Enable for the undercloud:
 - dns_domain_ports ml2 extension driver

Change-Id: I46eb9a24dd66821b27524fe4d1fdab617b6fa948
This commit is contained in:
Harald Jensås 2020-03-28 03:47:06 +01:00
parent 05afba671d
commit 679ecaada0
16 changed files with 89 additions and 20 deletions

View File

@ -9,6 +9,9 @@ parameters:
type: json
name:
type: string
dns_name:
default: ''
type: string
replacement_policy:
type: string
default: AUTO

View File

@ -21,6 +21,9 @@ parameters:
name:
default: ''
type: string
dns_name:
default: ''
type: string
network:
default: ''
type: string

View File

@ -153,7 +153,7 @@ parameter_defaults:
NeutronServicePlugins: router,segments
NeutronMechanismDrivers: ['openvswitch', 'baremetal']
NeutronNetworkVLANRanges: 'physnet1:1000:2999'
NeutronPluginExtensions: 'port_security'
NeutronPluginExtensions: port_security,dns_domain_ports
NeutronFirewallDriver: ''
NeutronNetworkType: ['local','flat','vlan','gre','vxlan']
NeutronTunnelIdRanges: '20:100'

View File

@ -18,6 +18,9 @@ import subprocess
CTLPLANE_NETWORK_NAME = 'ctlplane'
CONF = json.loads(os.environ['config'])
CLOUD_DOMAIN = 'ctlplane.' + (CONF['cloud_domain'] + '.'
if not CONF['cloud_domain'].endswith('.')
else CONF['cloud_domain'])
def _run_command(args, env=None, name=None):
@ -57,13 +60,15 @@ def _ensure_neutron_network(sdk):
name=CTLPLANE_NETWORK_NAME,
provider_network_type='flat',
provider_physical_network=CONF['physical_network'],
mtu=CONF['mtu'])
mtu=CONF['mtu'],
dns_domain=CLOUD_DOMAIN)
print('INFO: Network created %s' % network)
else:
network = sdk.network.update_network(
network[0].id,
name=CTLPLANE_NETWORK_NAME,
mtu=CONF['mtu'])
mtu=CONF['mtu'],
dns_domain=CLOUD_DOMAIN)
print('INFO: Network updated %s' % network)
except Exception:
print('ERROR: Network create/update failed.')

View File

@ -87,6 +87,12 @@ parameters:
description: Mapping of service endpoint -> protocol. Typically set
via parameter_defaults in the resource registry.
type: json
CloudDomain:
default: 'localdomain'
type: string
description: >
The DNS domain used for the hosts. This must match the
overcloud_domain_name configured on the undercloud.
conditions:
@ -190,6 +196,7 @@ resources:
params:
JSON:
cloud_name: {get_param: UndercloudCloudName}
cloud_domain: {get_param: CloudDomain}
local_ip: {get_param: [DeployedServerPortMap, 'control_virtual_ip', fixed_ips, 0, ip_address]}
local_subnet: {get_param: UndercloudCtlplaneLocalSubnet}
physical_network: {get_param: CtlplaneLocalPhysicalNetwork}

View File

@ -137,6 +137,12 @@ parameters:
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.
conditions:
manage_networks: {get_param: ManageNetworks}
@ -151,6 +157,12 @@ resources:
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:

View File

@ -17,6 +17,10 @@ parameters:
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: ''
@ -56,6 +60,7 @@ resources:
properties:
network: {get_param: ControlPlaneNetwork}
name: {get_param: PortName}
dns_name: {get_param: DnsName}
fixed_ips:
if:
- fixed_ip_not_set

View File

@ -16,6 +16,10 @@ parameters:
description: Name of the port
default: ''
type: string
DnsName:
description: DNS name of the port
default: ''
type: string
ControlPlaneIP: # Here for compatibility with ctlplane_vip.yaml
description: IP address on the control plane
default: ''

View File

@ -16,6 +16,10 @@ parameters:
description: Name of the port
default: ''
type: string
DnsName:
description: DNS name of the port
default: ''
type: string
ControlPlaneIP: # Here for compatability with ctlplane_vip.yaml
description: IP address on the control plane
default: ''

View File

@ -29,6 +29,10 @@ parameters:
description: Name of the port
default: ''
type: string
DnsName:
description: DNS name of the port
default: ''
type: string
NetworkName: # Here for compatibility with vip.yaml
description: Name of the network where the VIP will be created
default: ctlplane

View File

@ -13,6 +13,10 @@ parameters:
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: ''
@ -70,6 +74,7 @@ resources:
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

View File

@ -18,6 +18,10 @@ parameters:
description: Name of the port
default: ''
type: string
DnsName:
description: DNS name of the port
default: ''
type: string
FixedIPs:
description: >
Control the IP allocation for the VIP port. E.g.

View File

@ -17,6 +17,10 @@ parameters:
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: ''

View File

@ -17,6 +17,10 @@ parameters:
description: Name of the port
default: ''
type: string
DnsName:
description: DNS name of the port
default: ''
type: string
ControlPlaneIP: # Here for compatability with noop.yaml
description: IP address on the control plane
default: ''

View File

@ -917,6 +917,7 @@ resources:
type: OS::TripleO::Network::Ports::ControlPlaneVipPort
properties:
name: control_virtual_ip
dns_name: {str_split: ['.', {get_param: CloudNameCtlplane}, 0]}
network: {get_param: NeutronControlPlaneID}
fixed_ips:
if:
@ -937,6 +938,7 @@ resources:
- {str_split: ['/', {get_attr: [ControlVirtualIP, subnets, 0, cidr]}, 1]}
ControlPlaneNetwork: {get_param: NeutronControlPlaneID}
PortName: redis_virtual_ip
DnsName: null
NetworkName: {get_attr: [ServiceNetMap, service_net_map, RedisNetwork]}
ServiceName: redis
FixedIPs:
@ -957,6 +959,7 @@ resources:
- {str_split: ['/', {get_attr: [ControlVirtualIP, subnets, 0, cidr]}, 1]}
ControlPlaneNetwork: {get_param: NeutronControlPlaneID}
PortName: ovn_dbs_virtual_ip
DnsName: null
NetworkName: {get_attr: [ServiceNetMap, service_net_map, OvnDbsNetwork]}
ServiceName: ovn_dbs
FixedIPs:
@ -969,24 +972,9 @@ resources:
{%- if network.name == 'External' %}
# The public VIP is on the External net, falls back to ctlplane
PublicVirtualIP:
depends_on: [Networks, ServiceNetMap]
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:
if:
- public_virtual_fixed_ip_set
- {get_param: PublicVirtualFixedIPs}
- [{subnet: {get_attr: [ServiceNetMap, vip_subnet_map, {{network.name}}]}}]
{%- else %}
{{network.name}}VirtualIP:
{%- endif %}
depends_on: [Networks, ServiceNetMap]
type: OS::TripleO::Network::Ports::{{network.name}}VipPort
properties:
@ -996,13 +984,29 @@ resources:
- ctlplane_subnet_cidr_set
- {get_param: ControlPlaneSubnetCidr}
- {str_split: ['/', {get_attr: [ControlVirtualIP, subnets, 0, cidr]}, 1]}
{%- if network.name == 'External' %}
PortName: public_virtual_ip
DnsName: {str_split: ['.', {get_param: CloudName}, 0]}
{%- else %}
PortName: {{network.name_lower}}_virtual_ip
{%- endif %}
{%- if network.name == 'InternalApi' %}
DnsName: {str_split: ['.', {get_param: CloudNameInternal}, 0]}
{%- elif network.name == 'StorageMgmt' %}
DnsName: {str_split: ['.', {get_param: CloudNameStorageManagement}, 0]}
{%- elif network.name not in ['External', 'InternalApi', 'StorageMgmt'] %}
DnsName: {str_split: ['.', {get_param: CloudName{{network.name}}}, 0]}
{%- endif %}
FixedIPs:
if:
{%- if network.name == 'External' %}
- public_virtual_fixed_ip_set
- {get_param: PublicVirtualFixedIPs}
{%- else %}
- {{network.name_lower}}_virtual_fixed_ip_set
- {get_param: {{network.name}}VirtualFixedIPs}
{%- endif %}
- [{subnet: {get_attr: [ServiceNetMap, vip_subnet_map, {{network.name}}]}}]
{% endif %}
{%- endfor %}
VipMap:

View File

@ -374,6 +374,7 @@ resources:
- '_'
- - {get_attr: [{{server_resource_name}}, name]}
- {{network.name}}
DnsName: {get_attr: [{{server_resource_name}}, name]}
ControlPlaneIP: {get_attr: [{{server_resource_name}}, networks, ctlplane, 0]}
FixedIPs:
if: