Browse Source

Check for available networks for a role

For network isolation, we specifcy available networks for role.
Therefore, there is no point in creating noop network resources for
networks that are not available/connected. This results in redundant
host entries for not available networks on overcloud nodes.

If a network is not available for a role we don't need to create
those extra noop resources.

For Undercloud/Standalone role we keep all networks in roles data
as the default ServiceNetMap specifies non ctlplane networks though
they map to ctlplane.

Change-Id: I07822ec0cba7eed352c0010eb893b5e5a522e95c
Closes-Bug: #1800811
tags/10.3.0
Rabi Mishra 7 months ago
parent
commit
5d275fb922
5 changed files with 52 additions and 4 deletions
  1. 8
    4
      overcloud.j2.yaml
  2. 26
    0
      puppet/role.role.j2.yaml
  3. 6
    0
      roles/Standalone.yaml
  4. 6
    0
      roles/Undercloud.yaml
  5. 6
    0
      roles_data_undercloud.yaml

+ 8
- 4
overcloud.j2.yaml View File

@@ -523,7 +523,7 @@ resources:
523 523
     depends_on: {{role.name}}AllNodesDeployment
524 524
     properties:
525 525
       name: {{role.name}}AllNodesValidationDeployment
526
-      config: {get_resource: AllNodesValidationConfig}
526
+      config: {get_resource: {{role.name}}AllNodesValidationConfig}
527 527
       servers: {get_attr: [{{role.name}}Servers, value]}
528 528
 
529 529
   {{role.name}}IpListMap:
@@ -531,7 +531,7 @@ resources:
531 531
     properties:
532 532
       ControlPlaneIpList: {get_attr: [{{role.name}}, ip_address]}
533 533
 {%- for network in networks %}
534
-  {%- if network.enabled|default(true) %}
534
+  {%- if network.enabled|default(true) and network.name in role.networks|default([]) %}
535 535
       {{network.name}}IpList: {get_attr: [{{role.name}}, {{network.name_lower}}_ip_address]}
536 536
   {%- else %}
537 537
       {{network.name}}IpList: {get_attr: [{{role.name}}, ip_address]}
@@ -851,18 +851,22 @@ resources:
851 851
     # ServiceNetMap's attribute values are available.
852 852
     depends_on: ServiceNetMap
853 853
 
854
+{%- for role in roles %}
854 855
   # All Nodes Validations
855
-  AllNodesValidationConfig:
856
+  {{role.name}}AllNodesValidationConfig:
856 857
     type: OS::TripleO::AllNodes::Validation
857 858
     properties:
858 859
       PingTestIps:
859 860
         list_join:
860 861
         - ' '
861 862
         -
862
-{%- for network in networks if network.enabled|default(true) %}
863
+{%- for network in networks %}
864
+  {%- if network.enabled|default(true) and network.name in role.networks|default([]) %}
863 865
           - yaql:
864 866
               expression: coalesce($.data, []).first(null)
865 867
               data: {get_attr: [{{primary_role_name}}, {{network.name_lower}}_ip_address]}
868
+  {%- endif %}
869
+{%- endfor %}
866 870
 {%- endfor %}
867 871
 
868 872
   # Optional ExtraConfig for all nodes - all roles are passed in here, but

+ 26
- 0
puppet/role.role.j2.yaml View File

@@ -262,6 +262,7 @@ parameters:
262 262
       dns_nameservers attribute will be used.
263 263
     type: comma_delimited_list
264 264
 {%- for network in networks %}
265
+{%- if network.enabled|default(true) and network.name in role.networks|default([]) %}
265 266
   {{network.name}}InterfaceRoutes:
266 267
     default: []
267 268
     description: >
@@ -270,6 +271,7 @@ parameters:
270 271
       Unless the default is changed, the parameter is automatically resolved
271 272
       from the subnet host_routes attribute.
272 273
     type: json
274
+{%- endif %}
273 275
 {%- endfor %}
274 276
 
275 277
   ServerDeletionPolicy:
@@ -336,6 +338,7 @@ conditions:
336 338
 {%- endif %}
337 339
         - ""
338 340
 {%- for network in networks %}
341
+{%- if network.enabled|default(true) and network.name in role.networks|default([]) %}
339 342
   {{role.name}}_{{network.name}}_fixed_ip_set:
340 343
     not:
341 344
       equals:
@@ -346,6 +349,7 @@ conditions:
346 349
       equals:
347 350
         - {get_param: {{network.name}}InterfaceRoutes}
348 351
         - []
352
+{%- endif %}
349 353
 {%- endfor %}
350 354
   ctlplane_subnet_cidr_set:
351 355
     not:
@@ -454,6 +458,7 @@ resources:
454 458
     type: OS::TripleO::{{role.name}}::NodeUserData
455 459
 
456 460
   {%- for network in networks %}
461
+  {%- if network.enabled|default(true) and network.name in role.networks|default([]) %}
457 462
   {{network.name}}Port:
458 463
     type: OS::TripleO::{{role.name}}::Ports::{{network.name}}Port
459 464
     properties:
@@ -485,6 +490,7 @@ resources:
485 490
 {%- endif %}
486 491
           - {get_param: {{role.name}}IPs}
487 492
       NodeIndex: {get_param: NodeIndex}
493
+  {%- endif %}
488 494
   {%- endfor %}
489 495
 
490 496
   NetworkConfig:
@@ -520,12 +526,14 @@ resources:
520 526
           - {get_attr: [{{server_resource_name}}, addresses, ctlplane, 0, subnets, 0, dns_nameservers]}
521 527
 
522 528
   {%- for network in networks %}
529
+  {%- if network.enabled|default(true) and network.name in role.networks|default([]) %}
523 530
       {{network.name}}IpSubnet: {get_attr: [{{network.name}}Port, ip_subnet]}
524 531
       {{network.name}}InterfaceRoutes:
525 532
         if:
526 533
           - {{network.name_lower}}_interface_routes_set
527 534
           - {get_param: {{network.name}}InterfaceRoutes}
528 535
           - {get_attr: [{{network.name}}Port, host_routes]}
536
+  {%- endif %}
529 537
   {%- endfor %}
530 538
 
531 539
   NetIpMap:
@@ -542,9 +550,11 @@ resources:
542 550
 
543 551
 
544 552
   {%- for network in networks %}
553
+  {%- if network.enabled|default(true) and network.name in role.networks|default([]) %}
545 554
       {{network.name}}Ip: {get_attr: [{{network.name}}Port, ip_address]}
546 555
       {{network.name}}IpSubnet: {get_attr: [{{network.name}}Port, ip_subnet]}
547 556
       {{network.name}}IpUri: {get_attr: [{{network.name}}Port, ip_address_uri]}
557
+  {%- endif %}
548 558
   {%- endfor %}
549 559
 
550 560
   NetHostMap:
@@ -553,6 +563,7 @@ resources:
553 563
       type: json
554 564
       value:
555 565
   {%- for network in networks %}
566
+  {%- if network.enabled|default(true) and network.name in role.networks|default([]) %}
556 567
         {{network.name_lower}}:
557 568
           fqdn:
558 569
             list_join:
@@ -565,6 +576,7 @@ resources:
565 576
             - '.'
566 577
             - - {get_attr: [{{server_resource_name}}, name]}
567 578
               - {{network.name.lower()}}
579
+  {%- endif %}
568 580
   {%- endfor %}
569 581
         ctlplane:
570 582
           fqdn:
@@ -698,7 +710,9 @@ resources:
698 710
           {{role.name.lower()}}:
699 711
             tripleo::clouddomain: {get_param: CloudDomain}
700 712
   {%- for network in networks %}
713
+  {%- if network.enabled|default(true) and network.name in role.networks|default([]) %}
701 714
             fqdn_{{network.name_lower}}: {get_attr: [NetHostMap, value, {{network.name_lower}}, fqdn]}
715
+  {%- endif %}
702 716
   {%- endfor %}
703 717
             fqdn_ctlplane: {get_attr: [NetHostMap, value, ctlplane, fqdn]}
704 718
             fqdn_canonical: {get_attr: [NetHostMap, value, canonical, fqdn]}
@@ -756,8 +770,10 @@ resources:
756 770
         str_replace:
757 771
           template: "[PRIMARYIP]*,[PRIMARYHOST.DOMAIN]*,[PRIMARYHOST]*,\
758 772
     {%- for network in networks %}
773
+    {%- if network.enabled|default(true) and network.name in role.networks|default([]) %}
759 774
     [{{network.name}}IP]*,[{{network.name}}HOST.DOMAIN]*,\
760 775
     [{{network.name}}HOST]*,\
776
+    {%- endif %}
761 777
     {%- endfor %}
762 778
     [CTLPLANEIP]*,[CTLPLANEHOST.DOMAIN]*,[CTLPLANEHOST]*"
763 779
           params:
@@ -765,8 +781,10 @@ resources:
765 781
             DOMAIN: {get_param: CloudDomain}
766 782
             PRIMARYHOST: {get_attr: [{{server_resource_name}}, name]}
767 783
     {%- for network in networks %}
784
+    {%- if network.enabled|default(true) and network.name in role.networks|default([]) %}
768 785
             {{network.name}}IP: {get_attr: [{{network.name}}Port, ip_address]}
769 786
             {{network.name}}HOST: {get_attr: [NetHostMap, value, {{network.name_lower|default(network.name.lower())}}, short]}
787
+    {%- endif %}
770 788
     {%- endfor %}
771 789
             CTLPLANEIP: {get_attr: [{{server_resource_name}}, networks, ctlplane, 0]}
772 790
             CTLPLANEHOST: {get_attr: [NetHostMap, value, ctlplane, short]}
@@ -796,7 +814,9 @@ outputs:
796 814
     description: Mapping of network names to hostnames
797 815
     value:
798 816
   {%- for network in networks %}
817
+  {%- if network.enabled|default(true) and network.name in role.networks|default([]) %}
799 818
       {{network.name_lower|default(network.name.lower())}}: {get_attr: [NetHostMap, value, {{network.name_lower|default(network.name.lower()) }}, fqdn]}
819
+  {%- endif %}
800 820
   {%- endfor %}
801 821
       ctlplane: {get_attr: [NetHostMap, value, ctlplane, fqdn]}
802 822
       canonical: {get_attr: [NetHostMap, value, canonical, fqdn]}
@@ -806,7 +826,9 @@ outputs:
806 826
         template: |
807 827
           PRIMARYIP PRIMARYHOST.DOMAIN PRIMARYHOST
808 828
   {%- for network in networks %}
829
+  {%- if network.enabled|default(true) and network.name in role.networks|default([]) %}
809 830
           {{network.name}}IP {{network.name}}HOST.DOMAIN {{network.name}}HOST
831
+  {%- endif %}
810 832
   {%- endfor %}
811 833
           CTLPLANEIP CTLPLANEHOST.DOMAIN CTLPLANEHOST
812 834
         params:
@@ -814,8 +836,10 @@ outputs:
814 836
           DOMAIN: {get_param: CloudDomain}
815 837
           PRIMARYHOST: {get_attr: [{{server_resource_name}}, name]}
816 838
   {%- for network in networks %}
839
+  {%- if network.enabled|default(true) and network.name in role.networks|default([]) %}
817 840
           {{network.name}}IP: {get_attr: [{{network.name}}Port, ip_address]}
818 841
           {{network.name}}HOST: {get_attr: [NetHostMap, value, {{network.name_lower|default(network.name.lower())}}, short]}
842
+  {%- endif %}
819 843
   {%- endfor %}
820 844
           CTLPLANEIP: {get_attr: [{{server_resource_name}}, networks, ctlplane, 0]}
821 845
           CTLPLANEHOST: {get_attr: [NetHostMap, value, ctlplane, short]}
@@ -883,9 +907,11 @@ outputs:
883 907
     description: The os-collect-config configuration associated with this server resource
884 908
     value: {get_attr: [{{server_resource_name}}, os_collect_config]}
885 909
   {%- for network in networks %}
910
+  {%- if network.enabled|default(true) and network.name in role.networks|default([]) %}
886 911
   {{network.name_lower|default(network.name.lower())}}_ip_address:
887 912
     description: IP address of the server in the {{network.name}} network
888 913
     value: {get_attr: [{{network.name}}Port, ip_address]}
914
+  {%- endif %}
889 915
   {%- endfor %}
890 916
   role_group_vars:
891 917
     value:

+ 6
- 0
roles/Standalone.yaml View File

@@ -11,6 +11,12 @@
11 11
   tags:
12 12
     - primary
13 13
     - controller
14
+  networks:
15
+    - External
16
+    - InternalApi
17
+    - Storage
18
+    - StorageMgmt
19
+    - Tenant
14 20
   disable_constraints: True
15 21
   ServicesDefault:
16 22
     - OS::TripleO::Services::Aide

+ 6
- 0
roles/Undercloud.yaml View File

@@ -10,6 +10,12 @@
10 10
   tags:
11 11
     - primary
12 12
     - controller
13
+  networks:
14
+    - External
15
+    - InternalApi
16
+    - Storage
17
+    - StorageMgmt
18
+    - Tenant
13 19
   ServicesDefault:
14 20
     - OS::TripleO::Services::Aide
15 21
     - OS::TripleO::Services::AodhApi

+ 6
- 0
roles_data_undercloud.yaml View File

@@ -13,6 +13,12 @@
13 13
   tags:
14 14
     - primary
15 15
     - controller
16
+  networks:
17
+    - External
18
+    - InternalApi
19
+    - Storage
20
+    - StorageMgmt
21
+    - Tenant
16 22
   ServicesDefault:
17 23
     - OS::TripleO::Services::Aide
18 24
     - OS::TripleO::Services::AodhApi

Loading…
Cancel
Save