Browse Source

Use tags instead of role names

Role names can be customized, yet in THT jinja2 we
have several places where conditions are based on
the role name. By using tag's such as 'storage',
'ceph' and 'ovsdpdk' we the role names become truly
customizable.

The depends-on change in TripleO common will
dynamically add tag's to role's based on role.name
for backward compatibility during deprecation
period.

Depends-On: https://review.opendev.org/758124
Change-Id: I5ab4e4a220294245f95d328391bfffec87781a09
changes/44/757744/5
Harald Jensås 8 months ago
committed by Rabi Mishra
parent
commit
ff4d1fbb66
43 changed files with 161 additions and 14 deletions
  1. +2
    -2
      network/config/2-linux-bonds-vlans/role.role.j2.yaml
  2. +3
    -3
      network/config/bond-with-vlans/role.role.j2.yaml
  3. +2
    -2
      network/config/multiple-nics-vlans/role.role.j2.yaml
  4. +2
    -2
      network/config/multiple-nics/role.role.j2.yaml
  5. +2
    -2
      network/config/single-nic-linux-bridge-vlans/role.role.j2.yaml
  6. +1
    -1
      network/config/single-nic-vlans/role.role.j2.yaml
  7. +1
    -1
      network/service_net_map.j2.yaml
  8. +22
    -0
      releasenotes/notes/use-tags-for-condition-instead-of-role-name-3c15f9faaa59362e.yaml
  9. +2
    -0
      roles/BlockStorage.yaml
  10. +3
    -0
      roles/CephAll.yaml
  11. +3
    -0
      roles/CephFile.yaml
  12. +3
    -0
      roles/CephObject.yaml
  13. +3
    -0
      roles/CephStorage.yaml
  14. +1
    -0
      roles/Compute.yaml
  15. +2
    -0
      roles/ComputeAlt.yaml
  16. +1
    -0
      roles/ComputeDVR.yaml
  17. +2
    -0
      roles/ComputeHCI.yaml
  18. +3
    -0
      roles/ComputeHCIOvsDpdk.yaml
  19. +2
    -0
      roles/ComputeHCISriov.yaml
  20. +2
    -0
      roles/ComputeInstanceHA.yaml
  21. +2
    -0
      roles/ComputeLiquidio.yaml
  22. +1
    -0
      roles/ComputeLocalEphemeral.yaml
  23. +3
    -0
      roles/ComputeOvsDpdk.yaml
  24. +3
    -0
      roles/ComputeOvsDpdkRT.yaml
  25. +3
    -0
      roles/ComputeOvsDpdkSriov.yaml
  26. +3
    -0
      roles/ComputeOvsDpdkSriovRT.yaml
  27. +2
    -0
      roles/ComputePPC64LE.yaml
  28. +1
    -0
      roles/ComputeRBDEphemeral.yaml
  29. +2
    -0
      roles/ComputeRealTime.yaml
  30. +2
    -0
      roles/ComputeSriov.yaml
  31. +2
    -0
      roles/ComputeSriovIB.yaml
  32. +2
    -0
      roles/ComputeSriovRT.yaml
  33. +2
    -0
      roles/DistributedCompute.yaml
  34. +2
    -0
      roles/DistributedComputeHCI.yaml
  35. +2
    -0
      roles/DistributedComputeHCIScaleOut.yaml
  36. +2
    -0
      roles/DistributedComputeScaleOut.yaml
  37. +2
    -0
      roles/HciCephAll.yaml
  38. +2
    -0
      roles/HciCephFile.yaml
  39. +2
    -0
      roles/HciCephMon.yaml
  40. +2
    -0
      roles/HciCephObject.yaml
  41. +2
    -0
      roles/ObjectStorage.yaml
  42. +8
    -0
      roles_data.yaml
  43. +47
    -1
      tools/process-templates.py

+ 2
- 2
network/config/2-linux-bonds-vlans/role.role.j2.yaml View File

@ -92,7 +92,7 @@ parameters:
interface. Set things like lacp=active and/or bond_mode=balance-slb
for OVS bonds or like mode=4 for Linux bonds using this option.'
type: string
{%- if role.name == 'ComputeOvsDpdk' %}
{%- if 'ovsdpdk' in role.tags %}
NumDpdkInterfaceRxQueues:
description: Number of Rx Queues required for DPDK bond or DPDK ports
default: 1
@ -191,7 +191,7 @@ resources:
routes:
get_param: {{network.name}}InterfaceRoutes
{%- endfor %}
{%- if not role.name.startswith('ComputeOvsDpdk') %}
{%- if not 'ovsdpdk' in role.tags %}
- type: ovs_bridge
name: {get_param: NeutronPhysicalBridge}
dns_servers:


+ 3
- 3
network/config/bond-with-vlans/role.role.j2.yaml View File

@ -89,7 +89,7 @@ parameters:
interface. Set things like lacp=active and/or bond_mode=balance-slb
for OVS bonds or like mode=4 for Linux bonds using this option.'
type: string
{%- if role.name == 'ComputeOvsDpdk' %}
{%- if 'ovsdpdk' in role.tags %}
NumDpdkInterfaceRxQueues:
description: Number of Rx Queues required for DPDK bond or DPDK ports
default: 1
@ -137,9 +137,9 @@ resources:
- get_param: ControlPlaneSubnetCidr
routes:
get_param: ControlPlaneStaticRoutes
{%- if not role.name.startswith('ComputeOvsDpdk') %}
{%- if not 'ovsdpdk' in role.tags %}
- type: ovs_bridge
{%- if role.name.startswith('CephStorage') or role.name.startswith('ObjectStorage') or role.name.startswith('BlockStorage') %}
{%- if 'ceph' in role.tags or 'storage' in role.tags %}
name: br-bond
{%- else %}
name: {get_param: NeutronPhysicalBridge}


+ 2
- 2
network/config/multiple-nics-vlans/role.role.j2.yaml View File

@ -93,7 +93,7 @@ parameters:
default: []
description: A list of DNS search domains to be added (in order) to resolv.conf.
type: comma_delimited_list
{%- if role.name == 'ComputeOvsDpdk' %}
{%- if 'ovsdpdk' in role.tags %}
NumDpdkInterfaceRxQueues:
description: Number of Rx Queues required for DPDK bond or DPDK ports
default: 1
@ -184,7 +184,7 @@ resources:
{#- This hack gets around Jinja scope limitations to update nics_used within loop. #}
{%- set _ = nics_used.append(loop.index) %}
{%- endfor %}
{%- if role.name == 'ComputeOvsDpdk' %}
{%- if 'ovsdpdk' in role.tags %}
# Used as a provider network with external DHCP
- type: ovs_user_bridge
name: br-dpdk0


+ 2
- 2
network/config/multiple-nics/role.role.j2.yaml View File

@ -93,7 +93,7 @@ parameters:
default: []
description: A list of DNS search domains to be added (in order) to resolv.conf.
type: comma_delimited_list
{%- if role.name == 'ComputeOvsDpdk' %}
{%- if 'ovsdpdk' in role.tags %}
NumDpdkInterfaceRxQueues:
description: Number of Rx Queues required for DPDK bond or DPDK ports
default: 1
@ -173,7 +173,7 @@ resources:
{#- This hack gets around Jinja scope limitations to update nics_used within loop. #}
{%- set _ = nics_used.append(loop.index) %}
{%- endfor %}
{%- if role.name == 'ComputeOvsDpdk' %}
{%- if 'ovsdpdk' in role.tags %}
# Used as a provider network with external DHCP
- type: ovs_user_bridge
name: br-dpdk0


+ 2
- 2
network/config/single-nic-linux-bridge-vlans/role.role.j2.yaml View File

@ -117,7 +117,7 @@ resources:
value:
network_config:
- type: linux_bridge
{%- if role.name.startswith('CephStorage') or role.name.startswith('ObjectStorage') or role.name.startswith('BlockStorage') %}
{%- if 'ceph' in role.tags or 'storage' in role.tags %}
name: br-storage
{%- else %}
name: {get_param: NeutronPhysicalBridge}
@ -150,7 +150,7 @@ and network.name not in role.networks_skip_config|default([]) %}
get_param: {{network.name}}Mtu
vlan_id:
get_param: {{network.name}}NetworkVlanID
{%- if role.name.startswith('CephStorage') or role.name.startswith('ObjectStorage') or role.name.startswith('BlockStorage') %}
{%- if 'ceph' in role.tags or 'storage' in role.tags %}
device: br-storage
{%- else %}
device: {get_param: NeutronPhysicalBridge}


+ 1
- 1
network/config/single-nic-vlans/role.role.j2.yaml View File

@ -113,7 +113,7 @@ resources:
value:
network_config:
- type: ovs_bridge
{%- if role.name.startswith('CephStorage') or role.name.startswith('ObjectStorage') or role.name.startswith('BlockStorage') %}
{%- if 'ceph' in role.tags or 'storage' in role.tags %}
name: br-storage
{%- else %}
name: {get_param: NeutronPhysicalBridge}


+ 1
- 1
network/service_net_map.j2.yaml View File

@ -93,7 +93,7 @@ parameters:
# We special-case the default ResolveNetwork and MetricsQdrNetwork for the Ceph roles
# for backwards compatibility, all other roles default to internal_api
{%- for role in roles %}
{%- if role.name.startswith('Ceph') %}
{%- if 'ceph' in role.tags|default([]) %}
{%- if 'Storage' in role.networks %}
{{role.name}}HostnameResolveNetwork: {{ _service_nets.get('storage', 'ctlplane') }}
{{role.name}}MetricsQdrNetwork: {{ _service_nets.get('storage', 'ctlplane') }}


+ 22
- 0
releasenotes/notes/use-tags-for-condition-instead-of-role-name-3c15f9faaa59362e.yaml View File

@ -0,0 +1,22 @@
---
upgrade:
- |
Use of the role name in jinja2 tripleo heat templates has been replaced with
the use of role tags. Users of custom role data should update the tags for
their custom roles data file adding the relevant tags. The following tag
should be added, depending on the role:
* **Compute** roles: add the ``compute`` tag.
* **HciCeph** roles: add the ``compute`` tag.
* **DistributedCompute** roles: add the ``compute`` tag.
* **Ceph** roles: add the ``ceph`` and ``storage`` tag.
* **ObjectStorage** roles: add the ``storage`` tag.
* **BlockStorage** roles: add the ``storage`` tag.
* **ComputeOvsDpdk** roles: add the ``ovsdpdk`` tag.
deprecations:
- |
Use of the role name in jinja2 tripleo heat templates has been replaced
with the use of role tags. By using tags the role name become truly
customizable. To keep backward compatiblity tags will be added
automatically to roles based on the role name until the next release.

+ 2
- 0
roles/BlockStorage.yaml View File

@ -4,6 +4,8 @@
- name: BlockStorage
description: |
Cinder Block Storage node role
tags:
- storage
networks:
InternalApi:
subnet: internal_api_subnet


+ 3
- 0
roles/CephAll.yaml View File

@ -4,6 +4,9 @@
- name: CephAll
description: |
Standalone Storage Full Role (OSD + MON + RGW + MDS + MGR + RBD Mirroring)
tags:
- ceph
- storage
networks:
Storage:
subnet: storage_subnet


+ 3
- 0
roles/CephFile.yaml View File

@ -4,6 +4,9 @@
- name: CephFile
description: |
Standalone Scale-out File Role (OSD + MDS)
tags:
- ceph
- storage
networks:
Storage:
subnet: storage_subnet


+ 3
- 0
roles/CephObject.yaml View File

@ -4,6 +4,9 @@
- name: CephObject
description: |
Standalone Scale-out Object Role (OSD + RGW)
tags:
- ceph
- storage
networks:
Storage:
subnet: storage_subnet


+ 3
- 0
roles/CephStorage.yaml View File

@ -4,6 +4,9 @@
- name: CephStorage
description: |
Ceph OSD Storage node role
tags:
- ceph
- storage
networks:
Storage:
subnet: storage_subnet


+ 1
- 0
roles/Compute.yaml View File

@ -7,6 +7,7 @@
CountDefault: 1
# Create external Neutron bridge (unset if using ML2/OVS without DVR)
tags:
- compute
- external_bridge
networks:
InternalApi:


+ 2
- 0
roles/ComputeAlt.yaml View File

@ -5,6 +5,8 @@
description: |
Alternate Compute Node role
CountDefault: 0
tags:
- compute
networks:
InternalApi:
subnet: internal_api_subnet


+ 1
- 0
roles/ComputeDVR.yaml View File

@ -6,6 +6,7 @@
DVR enabled Compute Node role
CountDefault: 1
tags:
- compute
- external_bridge
networks:
InternalApi:


+ 2
- 0
roles/ComputeHCI.yaml View File

@ -4,6 +4,8 @@
- name: ComputeHCI
description: |
Compute Node role hosting Ceph OSD too
tags:
- compute
networks:
InternalApi:
subnet: internal_api_subnet


+ 3
- 0
roles/ComputeHCIOvsDpdk.yaml View File

@ -4,6 +4,9 @@
- name: ComputeHCIOvsDpdk
description: |
ComputeOvsDpdk Node role hosting Ceph OSD too
tags:
- compute
- dpdk
networks:
InternalApi:
subnet: internal_api_subnet


+ 2
- 0
roles/ComputeHCISriov.yaml View File

@ -4,6 +4,8 @@
- name: ComputeHCISriov
description: |
Compute Node with SR-IOV role hosting Ceph OSD too
tags:
- compute
networks:
InternalApi:
subnet: internal_api_subnet


+ 2
- 0
roles/ComputeInstanceHA.yaml View File

@ -5,6 +5,8 @@
description: |
Compute Instance HA Node role to be used with -e environments/compute-instanceha.yaml
CountDefault: 1
tags:
- compute
networks:
InternalApi:
subnet: internal_api_subnet


+ 2
- 0
roles/ComputeLiquidio.yaml View File

@ -5,6 +5,8 @@
description: |
Compute Node with Cavium Liquidio smart NIC
CountDefault: 1
tags:
- compute
networks:
InternalApi:
subnet: internal_api_subnet


+ 1
- 0
roles/ComputeLocalEphemeral.yaml View File

@ -7,6 +7,7 @@
CountDefault: 0
# Create external Neutron bridge (unset if using ML2/OVS without DVR)
tags:
- compute
- external_bridge
networks:
InternalApi:


+ 3
- 0
roles/ComputeOvsDpdk.yaml View File

@ -5,6 +5,9 @@
description: |
Compute OvS DPDK Role
CountDefault: 1
tags:
- compute
- dpdk
networks:
InternalApi:
subnet: internal_api_subnet


+ 3
- 0
roles/ComputeOvsDpdkRT.yaml View File

@ -5,6 +5,9 @@
description: |
Compute OvS DPDK RealTime Role
CountDefault: 1
tags:
- compute
- dpdk
networks:
InternalApi:
subnet: internal_api_subnet


+ 3
- 0
roles/ComputeOvsDpdkSriov.yaml View File

@ -5,6 +5,9 @@
description: |
Compute role with OvS-DPDK and SR-IOV services
CountDefault: 1
tags:
- compute
- dpdk
networks:
- InternalApi
- Tenant


+ 3
- 0
roles/ComputeOvsDpdkSriovRT.yaml View File

@ -5,6 +5,9 @@
description: |
Compute Realtime role with OvS-DPDK and SR-IOV services
CountDefault: 1
tags:
- compute
- dpdk
networks:
- InternalApi
- Tenant


+ 2
- 0
roles/ComputePPC64LE.yaml View File

@ -5,6 +5,8 @@
description: |
Basic Compute Node role for ppc64le servers
CountDefault: 0
tags:
- compute
networks:
InternalApi:
subnet: internal_api_subnet


+ 1
- 0
roles/ComputeRBDEphemeral.yaml View File

@ -7,6 +7,7 @@
CountDefault: 0
# Create external Neutron bridge (unset if using ML2/OVS without DVR)
tags:
- compute
- external_bridge
networks:
InternalApi:


+ 2
- 0
roles/ComputeRealTime.yaml View File

@ -9,6 +9,8 @@
and NovaComputeCpuSharedSet are set according to the hardware of the
real-time compute nodes.
CountDefault: 1
tags:
- compute
networks:
InternalApi:
subnet: internal_api_subnet


+ 2
- 0
roles/ComputeSriov.yaml View File

@ -5,6 +5,8 @@
description: |
Compute SR-IOV Role
CountDefault: 1
tags:
- compute
networks:
InternalApi:
subnet: internal_api_subnet


+ 2
- 0
roles/ComputeSriovIB.yaml View File

@ -5,6 +5,8 @@
description: |
Compute SR-IOV Infiniband Role
CountDefault: 1
tags:
- compute
networks:
InternalApi:
subnet: internal_api_subnet


+ 2
- 0
roles/ComputeSriovRT.yaml View File

@ -5,6 +5,8 @@
description: |
Compute SR-IOV RealTime Role
CountDefault: 1
tags:
- compute
networks:
InternalApi:
subnet: internal_api_subnet


+ 2
- 0
roles/DistributedCompute.yaml View File

@ -5,6 +5,8 @@
description: |
Distributed Compute Node role with Glance.
CountDefault: 1
tags:
- compute
networks:
InternalApi:
subnet: internal_api_subnet


+ 2
- 0
roles/DistributedComputeHCI.yaml View File

@ -4,6 +4,8 @@
- name: DistributedComputeHCI
description: |
Distributed Compute Node role with Ceph, Cinder volume, and Glance.
tags:
- compute
networks:
InternalApi:
subnet: internal_api_subnet


+ 2
- 0
roles/DistributedComputeHCIScaleOut.yaml View File

@ -4,6 +4,8 @@
- name: DistributedComputeHCIScaleOut
description: |
Distributed Compute Node role with CephOSD and HAproxy for Glance.
tags:
- compute
networks:
InternalApi:
subnet: internal_api_subnet


+ 2
- 0
roles/DistributedComputeScaleOut.yaml View File

@ -5,6 +5,8 @@
description: |
Distributed Compute Node role with HAproxy for Glance.
CountDefault: 1
tags:
- compute
networks:
InternalApi:
subnet: internal_api_subnet


+ 2
- 0
roles/HciCephAll.yaml View File

@ -4,6 +4,8 @@
- name: HciCephAll
description: |
HCI Full Stack Role (OSD + MON + Nova + RGW + MDS + MGR + RBD Mirroring + Dashboard)
tags:
- compute
networks:
InternalApi:
subnet: internal_api_subnet


+ 2
- 0
roles/HciCephFile.yaml View File

@ -4,6 +4,8 @@
- name: HciCephFile
description: |
HCI Scale-out File Role (OSD + Nova + MDS)
tags:
- compute
networks:
InternalApi:
subnet: internal_api_subnet


+ 2
- 0
roles/HciCephMon.yaml View File

@ -4,6 +4,8 @@
- name: HciCephMon
description: |
HCI Scale-out Block Full Role (OSD + MON + MGR + Nova)
tags:
- compute
networks:
InternalApi:
subnet: internal_api_subnet


+ 2
- 0
roles/HciCephObject.yaml View File

@ -4,6 +4,8 @@
- name: HciCephObject
description: |
HCI Scale-out Object Role (OSD + Nova + RGW)
tags:
- computecompute
networks:
InternalApi:
subnet: internal_api_subnet


+ 2
- 0
roles/ObjectStorage.yaml View File

@ -4,6 +4,8 @@
- name: ObjectStorage
description: |
Swift Object Storage node role
tags:
- storage
networks:
InternalApi:
subnet: internal_api_subnet


+ 8
- 0
roles_data.yaml View File

@ -196,6 +196,7 @@
CountDefault: 1
# Create external Neutron bridge (unset if using ML2/OVS without DVR)
tags:
- compute
- external_bridge
networks:
InternalApi:
@ -273,6 +274,8 @@
- name: BlockStorage
description: |
Cinder Block Storage node role
tags:
- storage
networks:
InternalApi:
subnet: internal_api_subnet
@ -320,6 +323,8 @@
- name: ObjectStorage
description: |
Swift Object Storage node role
tags:
- storage
networks:
InternalApi:
subnet: internal_api_subnet
@ -374,6 +379,9 @@
- name: CephStorage
description: |
Ceph OSD Storage node role
tags:
- ceph
- storage
networks:
Storage:
subnet: storage_subnet


+ 47
- 1
tools/process-templates.py View File

@ -106,6 +106,47 @@ def _j2_render_to_file(j2_template, j2_data, outfile_name=None,
out_f.write(r_template)
def _set_tags_based_on_role_name(role_data):
for role in role_data:
role['tags'] = role.get('tags', [])
role_name = role.get('name', str())
if ((role_name.startswith('Compute') or role_name.startswith('HciCeph')
or role_name.startswith('DistributedCompute'))
and 'compute' not in role['tags']):
role['tags'].append('compute')
print("DEPRECATED: Role '%s' without the 'compute' tag "
"detected, the tag was added automatically. Please "
"add the 'compute' tag in roles data. The function to "
"automatically add tags based on role name will be "
"removed in the next release." % role_name)
if role_name.startswith('Ceph') and 'ceph' not in role['tags']:
role['tags'].append('ceph')
print("DEPRECATED: Role '%s' without the 'ceph' tag "
"detected, the tag was added automatically. Please "
"add the 'ceph' tag in roles data. The function to "
"automatically add tags based on role name will be "
"removed in the next release." % role_name)
if (role_name.startswith('ComputeOvsDpdk')
and 'ovsdpdk' not in role['tags']):
role['tags'].append('ovsdpdk')
print("DEPRECATED: Role '%s' without the 'ovsdpdk' tag "
"detected, the tag was added automatically. Please "
"add the 'ovsdpdk' tag in roles data. The function to "
"automatically add tags based on role name will be "
"removed in the next release." % role_name)
if ((role_name.startswith('ObjectStorage')
or role_name.startswith('BlockStorage')
or role_name.startswith('Ceph'))
and 'storage' not in role['tags']):
role['tags'].append('storage')
print("DEPRECATED: Role '%s' without the 'storage' tag "
"detected, the tag was added automatically. Please "
"add the 'storage' tag in roles data. The function to "
"automatically add tags based on role name will be "
"removed in the next release." % role_name)
def process_templates(template_path, role_data_path, output_dir,
network_data_path, overwrite, dry_run):
@ -128,6 +169,10 @@ def process_templates(template_path, role_data_path, output_dir,
raise RuntimeError('Output dir %s is not a directory' % output_dir)
os.mkdir(output_dir)
# TODO(hjensas): In next release remove the function to automatically add
# tags based on role name.
_set_tags_based_on_role_name(role_data)
role_names = [r.get('name') for r in role_data]
r_map = {}
for r in role_data:
@ -204,7 +249,8 @@ def process_templates(template_path, role_data_path, output_dir,
'.yaml')])
out_f_path = os.path.join(out_dir, out_f)
if ('network/config' in file_path and
r_map[role].get('deprecated_nic_config_name')):
r_map[role].get(
'deprecated_nic_config_name')):
d_name = r_map[role].get(
'deprecated_nic_config_name')
out_f_path = os.path.join(out_dir, d_name)


Loading…
Cancel
Save