diff --git a/config/samples/dataplane_v1beta1_openstackdataplane.yaml b/config/samples/dataplane_v1beta1_openstackdataplane.yaml index f819a24d5..ab7cf19ba 100644 --- a/config/samples/dataplane_v1beta1_openstackdataplane.yaml +++ b/config/samples/dataplane_v1beta1_openstackdataplane.yaml @@ -63,6 +63,39 @@ spec: # Default nic config template for a EDPM compute node # These vars are edpm_network_config role vars edpm_network_config_hide_sensitive_logs: false + edpm_network_config_template: | + --- + {% set control_virtual_ip = net_vip_map.ctlplane %} + {% set public_virtual_ip = vip_port_map.external.ip_address %} + {% if ':' in control_virtual_ip %} + {% set control_virtual_cidr = 128 %} + {% else %} + {% set control_virtual_cidr = 32 %} + {% endif %} + {% if ':' in public_virtual_ip %} + {% set public_virtual_cidr = 128 %} + {% else %} + {% set public_virtual_cidr = 32 %} + {% endif %} + network_config: + - type: ovs_bridge + name: br-ctlplane + use_dhcp: false + mtu: {{ ctlplane_mtu }} + ovs_extra: + - br-set-external-id br-ctlplane bridge-id br-ctlplane + addresses: + - ip_netmask: {{ ctlplane_ip }}/{{ ctlplane_subnet_cidr }} + - ip_netmask: {{ control_virtual_ip}}/{{ control_virtual_cidr }} + - ip_netmask: {{ public_virtual_ip}}/{{ public_virtual_cidr }} + routes: {{ ctlplane_host_routes }} + dns_servers: {{ ctlplane_dns_nameservers }} + domain: {{ dns_search_domains }} + members: + - type: interface + name: {{ neutron_public_interface_name }} + primary: true + mtu: {{ ctlplane_mtu }} # # These vars are for the network config templates themselves and are # considered EDPM network defaults. diff --git a/config/samples/dataplane_v1beta1_openstackdataplane_baremetal.yaml b/config/samples/dataplane_v1beta1_openstackdataplane_baremetal.yaml index 4d7b5e680..2b8c4c1f2 100644 --- a/config/samples/dataplane_v1beta1_openstackdataplane_baremetal.yaml +++ b/config/samples/dataplane_v1beta1_openstackdataplane_baremetal.yaml @@ -54,6 +54,40 @@ spec: ansibleUser: cloud-admin ansiblePort: 22 ansibleSSHPrivateKeySecret: dataplane-ansible-ssh-private-key-secret + networkConfig: + template: | + --- + {% set control_virtual_ip = net_vip_map.ctlplane %} + {% set public_virtual_ip = vip_port_map.external.ip_address %} + {% if ':' in control_virtual_ip %} + {% set control_virtual_cidr = 128 %} + {% else %} + {% set control_virtual_cidr = 32 %} + {% endif %} + {% if ':' in public_virtual_ip %} + {% set public_virtual_cidr = 128 %} + {% else %} + {% set public_virtual_cidr = 32 %} + {% endif %} + network_config: + - type: ovs_bridge + name: br-ctlplane + use_dhcp: false + mtu: {{ ctlplane_mtu }} + ovs_extra: + - br-set-external-id br-ctlplane bridge-id br-ctlplane + addresses: + - ip_netmask: {{ ctlplane_ip }}/{{ ctlplane_subnet_cidr }} + - ip_netmask: {{ control_virtual_ip}}/{{ control_virtual_cidr }} + - ip_netmask: {{ public_virtual_ip}}/{{ public_virtual_cidr }} + routes: {{ ctlplane_host_routes }} + dns_servers: {{ ctlplane_dns_nameservers }} + domain: {{ dns_search_domains }} + members: + - type: interface + name: {{ neutron_public_interface_name }} + primary: true + mtu: {{ ctlplane_mtu }} ansibleVars: service_net_map: nova_api_network: internal_api diff --git a/config/samples/dataplane_v1beta1_openstackdataplane_baremetal_with_ipam.yaml b/config/samples/dataplane_v1beta1_openstackdataplane_baremetal_with_ipam.yaml index 2f90982b1..e83618ee2 100644 --- a/config/samples/dataplane_v1beta1_openstackdataplane_baremetal_with_ipam.yaml +++ b/config/samples/dataplane_v1beta1_openstackdataplane_baremetal_with_ipam.yaml @@ -48,6 +48,40 @@ spec: managementNetwork: CtlPlane ansibleUser: cloud-admin ansiblePort: 22 + networkConfig: + template: | + --- + {% set control_virtual_ip = net_vip_map.ctlplane %} + {% set public_virtual_ip = vip_port_map.external.ip_address %} + {% if ':' in control_virtual_ip %} + {% set control_virtual_cidr = 128 %} + {% else %} + {% set control_virtual_cidr = 32 %} + {% endif %} + {% if ':' in public_virtual_ip %} + {% set public_virtual_cidr = 128 %} + {% else %} + {% set public_virtual_cidr = 32 %} + {% endif %} + network_config: + - type: ovs_bridge + name: br-ctlplane + use_dhcp: false + mtu: {{ ctlplane_mtu }} + ovs_extra: + - br-set-external-id br-ctlplane bridge-id br-ctlplane + addresses: + - ip_netmask: {{ ctlplane_ip }}/{{ ctlplane_subnet_cidr }} + - ip_netmask: {{ control_virtual_ip}}/{{ control_virtual_cidr }} + - ip_netmask: {{ public_virtual_ip}}/{{ public_virtual_cidr }} + routes: {{ ctlplane_host_routes }} + dns_servers: {{ ctlplane_dns_nameservers }} + domain: {{ dns_search_domains }} + members: + - type: interface + name: {{ neutron_public_interface_name }} + primary: true + mtu: {{ ctlplane_mtu }} ansibleVars: service_net_map: nova_api_network: internal_api diff --git a/config/samples/dataplane_v1beta1_openstackdataplane_ceph.yaml b/config/samples/dataplane_v1beta1_openstackdataplane_ceph.yaml index a66822e5e..9a2a3a5e7 100644 --- a/config/samples/dataplane_v1beta1_openstackdataplane_ceph.yaml +++ b/config/samples/dataplane_v1beta1_openstackdataplane_ceph.yaml @@ -89,6 +89,40 @@ spec: ansibleUser: root ansiblePort: 22 ansibleSSHPrivateKeySecret: dataplane-ansible-ssh-private-key-secret + networkConfig: + template: | + --- + {% set control_virtual_ip = net_vip_map.ctlplane %} + {% set public_virtual_ip = vip_port_map.external.ip_address %} + {% if ':' in control_virtual_ip %} + {% set control_virtual_cidr = 128 %} + {% else %} + {% set control_virtual_cidr = 32 %} + {% endif %} + {% if ':' in public_virtual_ip %} + {% set public_virtual_cidr = 128 %} + {% else %} + {% set public_virtual_cidr = 32 %} + {% endif %} + network_config: + - type: ovs_bridge + name: br-ctlplane + use_dhcp: false + mtu: {{ ctlplane_mtu }} + ovs_extra: + - br-set-external-id br-ctlplane bridge-id br-ctlplane + addresses: + - ip_netmask: {{ ctlplane_ip }}/{{ ctlplane_subnet_cidr }} + - ip_netmask: {{ control_virtual_ip}}/{{ control_virtual_cidr }} + - ip_netmask: {{ public_virtual_ip}}/{{ public_virtual_cidr }} + routes: {{ ctlplane_host_routes }} + dns_servers: {{ ctlplane_dns_nameservers }} + domain: {{ dns_search_domains }} + members: + - type: interface + name: {{ neutron_public_interface_name }} + primary: true + mtu: {{ ctlplane_mtu }} ansibleVars: service_net_map: nova_api_network: internal_api diff --git a/config/samples/dataplane_v1beta1_openstackdataplane_customnetworks.yaml b/config/samples/dataplane_v1beta1_openstackdataplane_customnetworks.yaml index d28aa2656..9139b134b 100644 --- a/config/samples/dataplane_v1beta1_openstackdataplane_customnetworks.yaml +++ b/config/samples/dataplane_v1beta1_openstackdataplane_customnetworks.yaml @@ -43,32 +43,26 @@ spec: ansibleSSHPrivateKeySecret: dataplane-ansible-ssh-private-key-secret networkConfig: template: | - --- - network_config: - - type: interface - name: nic2 - mtu: 1500 - addresses: - - ip_netmask: - {{ ctlplane_ip }}/{{ ctlplane_subnet_cidr }} - - type: ovs_bridge - name: {{ neutron_physical_bridge_name }} - mtu: 1500 - use_dhcp: false - dns_servers: {{ ctlplane_dns_nameservers }} - domain: [] - addresses: - - ip_netmask: {{ lookup('vars', networks_lower["External"] ~ '_ip') }}/{{ lookup('vars', networks_lower["External"] ~ '_cidr') }} - routes: [{'ip_netmask': '0.0.0.0/0', 'next_hop': '192.168.1.254'}] - members: - - type: interface - name: nic1 - mtu: 1500 - # force the MAC address of the bridge to this interface - primary: true - - type: vlan - mtu: 1500 - vlan_id: 20 + --- + {% set control_virtual_ip = net_vip_map.ctlplane %} + {% set public_virtual_ip = vip_port_map.external.ip_address %} + {% if ':' in control_virtual_ip %} + {% set control_virtual_cidr = 128 %} + {% else %} + {% set control_virtual_cidr = 32 %} + {% endif %} + {% if ':' in public_virtual_ip %} + {% set public_virtual_cidr = 128 %} + {% else %} + {% set public_virtual_cidr = 32 %} + {% endif %} + network_config: + - type: ovs_bridge + name: br-ctlplane + use_dhcp: false + mtu: {{ ctlplane_mtu }} + ovs_extra: + - br-set-external-id br-ctlplane bridge-id br-ctlplane addresses: - ip_netmask: 172.17.0.101/24 @@ -87,6 +81,17 @@ spec: - ip_netmask: 172.19.0.101/24 routes: [] + - ip_netmask: {{ ctlplane_ip }}/{{ ctlplane_subnet_cidr }} + - ip_netmask: {{ control_virtual_ip}}/{{ control_virtual_cidr }} + - ip_netmask: {{ public_virtual_ip}}/{{ public_virtual_cidr }} + routes: {{ ctlplane_host_routes }} + dns_servers: {{ ctlplane_dns_nameservers }} + domain: {{ dns_search_domains }} + members: + - type: interface + name: {{ neutron_public_interface_name }} + primary: true + mtu: {{ ctlplane_mtu }} ansibleVars: # edpm_network_config # Default nic config template for a EDPM compute node diff --git a/config/samples/dataplane_v1beta1_openstackdataplanenode.yaml b/config/samples/dataplane_v1beta1_openstackdataplanenode.yaml index cb1a15d53..819e25a81 100644 --- a/config/samples/dataplane_v1beta1_openstackdataplanenode.yaml +++ b/config/samples/dataplane_v1beta1_openstackdataplanenode.yaml @@ -11,3 +11,37 @@ spec: - network: ctlplane fixedIP: 192.168.122.18 ansibleSSHPrivateKeySecret: dataplane-ansible-ssh-private-key-secret + networkConfig: + template: | + --- + {% set control_virtual_ip = net_vip_map.ctlplane %} + {% set public_virtual_ip = vip_port_map.external.ip_address %} + {% if ':' in control_virtual_ip %} + {% set control_virtual_cidr = 128 %} + {% else %} + {% set control_virtual_cidr = 32 %} + {% endif %} + {% if ':' in public_virtual_ip %} + {% set public_virtual_cidr = 128 %} + {% else %} + {% set public_virtual_cidr = 32 %} + {% endif %} + network_config: + - type: ovs_bridge + name: br-ctlplane + use_dhcp: false + mtu: {{ ctlplane_mtu }} + ovs_extra: + - br-set-external-id br-ctlplane bridge-id br-ctlplane + addresses: + - ip_netmask: {{ ctlplane_ip }}/{{ ctlplane_subnet_cidr }} + - ip_netmask: {{ control_virtual_ip}}/{{ control_virtual_cidr }} + - ip_netmask: {{ public_virtual_ip}}/{{ public_virtual_cidr }} + routes: {{ ctlplane_host_routes }} + dns_servers: {{ ctlplane_dns_nameservers }} + domain: {{ dns_search_domains }} + members: + - type: interface + name: {{ neutron_public_interface_name }} + primary: true + mtu: {{ ctlplane_mtu }} diff --git a/config/samples/dataplane_v1beta1_openstackdataplanenode_edpm_compute_0.yaml b/config/samples/dataplane_v1beta1_openstackdataplanenode_edpm_compute_0.yaml index d9993f3f6..65b86a0bd 100644 --- a/config/samples/dataplane_v1beta1_openstackdataplanenode_edpm_compute_0.yaml +++ b/config/samples/dataplane_v1beta1_openstackdataplanenode_edpm_compute_0.yaml @@ -11,5 +11,39 @@ spec: ansibleVars: tenant_ip: 192.168.24.100 ansibleSSHPrivateKeySecret: dataplane-ansible-ssh-private-key-secret + networkConfig: + template: | + --- + {% set control_virtual_ip = net_vip_map.ctlplane %} + {% set public_virtual_ip = vip_port_map.external.ip_address %} + {% if ':' in control_virtual_ip %} + {% set control_virtual_cidr = 128 %} + {% else %} + {% set control_virtual_cidr = 32 %} + {% endif %} + {% if ':' in public_virtual_ip %} + {% set public_virtual_cidr = 128 %} + {% else %} + {% set public_virtual_cidr = 32 %} + {% endif %} + network_config: + - type: ovs_bridge + name: br-ctlplane + use_dhcp: false + mtu: {{ ctlplane_mtu }} + ovs_extra: + - br-set-external-id br-ctlplane bridge-id br-ctlplane + addresses: + - ip_netmask: {{ ctlplane_ip }}/{{ ctlplane_subnet_cidr }} + - ip_netmask: {{ control_virtual_ip}}/{{ control_virtual_cidr }} + - ip_netmask: {{ public_virtual_ip}}/{{ public_virtual_cidr }} + routes: {{ ctlplane_host_routes }} + dns_servers: {{ ctlplane_dns_nameservers }} + domain: {{ dns_search_domains }} + members: + - type: interface + name: {{ neutron_public_interface_name }} + primary: true + mtu: {{ ctlplane_mtu }} deployStrategy: deploy: false diff --git a/config/samples/dataplane_v1beta1_openstackdataplanenode_edpm_compute_0_full.yaml b/config/samples/dataplane_v1beta1_openstackdataplanenode_edpm_compute_0_full.yaml index 91a202272..da67c2b27 100644 --- a/config/samples/dataplane_v1beta1_openstackdataplanenode_edpm_compute_0_full.yaml +++ b/config/samples/dataplane_v1beta1_openstackdataplanenode_edpm_compute_0_full.yaml @@ -11,6 +11,40 @@ spec: ansibleUser: root ansiblePort: 22 ansibleSSHPrivateKeySecret: dataplane-ansible-ssh-private-key-secret + networkConfig: + template: | + --- + {% set control_virtual_ip = net_vip_map.ctlplane %} + {% set public_virtual_ip = vip_port_map.external.ip_address %} + {% if ':' in control_virtual_ip %} + {% set control_virtual_cidr = 128 %} + {% else %} + {% set control_virtual_cidr = 32 %} + {% endif %} + {% if ':' in public_virtual_ip %} + {% set public_virtual_cidr = 128 %} + {% else %} + {% set public_virtual_cidr = 32 %} + {% endif %} + network_config: + - type: ovs_bridge + name: br-ctlplane + use_dhcp: false + mtu: {{ ctlplane_mtu }} + ovs_extra: + - br-set-external-id br-ctlplane bridge-id br-ctlplane + addresses: + - ip_netmask: {{ ctlplane_ip }}/{{ ctlplane_subnet_cidr }} + - ip_netmask: {{ control_virtual_ip}}/{{ control_virtual_cidr }} + - ip_netmask: {{ public_virtual_ip}}/{{ public_virtual_cidr }} + routes: {{ ctlplane_host_routes }} + dns_servers: {{ ctlplane_dns_nameservers }} + domain: {{ dns_search_domains }} + members: + - type: interface + name: {{ neutron_public_interface_name }} + primary: true + mtu: {{ ctlplane_mtu }} ansibleVars: tenant_ip: 192.168.24.100 edpm_network_config_hide_sensitive_logs: false diff --git a/config/samples/dataplane_v1beta1_openstackdataplanenode_edpm_compute_1.yaml b/config/samples/dataplane_v1beta1_openstackdataplanenode_edpm_compute_1.yaml index 2e6f11128..7a0ba14c6 100644 --- a/config/samples/dataplane_v1beta1_openstackdataplanenode_edpm_compute_1.yaml +++ b/config/samples/dataplane_v1beta1_openstackdataplanenode_edpm_compute_1.yaml @@ -11,5 +11,39 @@ spec: ansibleVars: tenant_ip: 192.168.24.101 ansibleSSHPrivateKeySecret: dataplane-ansible-ssh-private-key-secret + networkConfig: + template: | + --- + {% set control_virtual_ip = net_vip_map.ctlplane %} + {% set public_virtual_ip = vip_port_map.external.ip_address %} + {% if ':' in control_virtual_ip %} + {% set control_virtual_cidr = 128 %} + {% else %} + {% set control_virtual_cidr = 32 %} + {% endif %} + {% if ':' in public_virtual_ip %} + {% set public_virtual_cidr = 128 %} + {% else %} + {% set public_virtual_cidr = 32 %} + {% endif %} + network_config: + - type: ovs_bridge + name: br-ctlplane + use_dhcp: false + mtu: {{ ctlplane_mtu }} + ovs_extra: + - br-set-external-id br-ctlplane bridge-id br-ctlplane + addresses: + - ip_netmask: {{ ctlplane_ip }}/{{ ctlplane_subnet_cidr }} + - ip_netmask: {{ control_virtual_ip}}/{{ control_virtual_cidr }} + - ip_netmask: {{ public_virtual_ip}}/{{ public_virtual_cidr }} + routes: {{ ctlplane_host_routes }} + dns_servers: {{ ctlplane_dns_nameservers }} + domain: {{ dns_search_domains }} + members: + - type: interface + name: {{ neutron_public_interface_name }} + primary: true + mtu: {{ ctlplane_mtu }} deployStrategy: deploy: false diff --git a/config/samples/dataplane_v1beta1_openstackdataplanenode_from.yaml b/config/samples/dataplane_v1beta1_openstackdataplanenode_from.yaml index 6d9bd65c8..84201d5f8 100644 --- a/config/samples/dataplane_v1beta1_openstackdataplanenode_from.yaml +++ b/config/samples/dataplane_v1beta1_openstackdataplanenode_from.yaml @@ -10,3 +10,37 @@ spec: networks: - network: ctlplane fixedIP: 192.168.122.18 + networkConfig: + template: | + --- + {% set control_virtual_ip = net_vip_map.ctlplane %} + {% set public_virtual_ip = vip_port_map.external.ip_address %} + {% if ':' in control_virtual_ip %} + {% set control_virtual_cidr = 128 %} + {% else %} + {% set control_virtual_cidr = 32 %} + {% endif %} + {% if ':' in public_virtual_ip %} + {% set public_virtual_cidr = 128 %} + {% else %} + {% set public_virtual_cidr = 32 %} + {% endif %} + network_config: + - type: ovs_bridge + name: br-ctlplane + use_dhcp: false + mtu: {{ ctlplane_mtu }} + ovs_extra: + - br-set-external-id br-ctlplane bridge-id br-ctlplane + addresses: + - ip_netmask: {{ ctlplane_ip }}/{{ ctlplane_subnet_cidr }} + - ip_netmask: {{ control_virtual_ip}}/{{ control_virtual_cidr }} + - ip_netmask: {{ public_virtual_ip}}/{{ public_virtual_cidr }} + routes: {{ ctlplane_host_routes }} + dns_servers: {{ ctlplane_dns_nameservers }} + domain: {{ dns_search_domains }} + members: + - type: interface + name: {{ neutron_public_interface_name }} + primary: true + mtu: {{ ctlplane_mtu }} diff --git a/config/samples/dataplane_v1beta1_openstackdataplanerole.yaml b/config/samples/dataplane_v1beta1_openstackdataplanerole.yaml index e884e6a12..691ae9213 100644 --- a/config/samples/dataplane_v1beta1_openstackdataplanerole.yaml +++ b/config/samples/dataplane_v1beta1_openstackdataplanerole.yaml @@ -12,50 +12,38 @@ spec: nodeTemplate: networkConfig: template: | - --- - network_config: - - type: interface - name: nic2 - mtu: 1500 - addresses: - - ip_netmask: - {{ ctlplane_ip }}/{{ ctlplane_subnet_cidr }} - - type: ovs_bridge - name: {{ neutron_physical_bridge_name }} - mtu: 1500 - use_dhcp: false - dns_servers: {{ ctlplane_dns_nameservers }} - domain: [] - addresses: - - ip_netmask: {{ lookup('vars', networks_lower["External"] ~ '_ip') }}/{{ lookup('vars', networks_lower["External"] ~ '_cidr') }} - routes: [{'ip_netmask': '0.0.0.0/0', 'next_hop': '192.168.1.254'}] - members: - - type: interface - name: nic1 - mtu: 1500 - # force the MAC address of the bridge to this interface - primary: true - - type: vlan - mtu: 1500 - vlan_id: 20 - addresses: - - ip_netmask: - 172.17.0.101/24 - routes: [] - - type: vlan - mtu: 1500 - vlan_id: 25 - addresses: - - ip_netmask: - 172.18.0.101/24 - routes: [] - - type: vlan - mtu: 1500 - vlan_id: 22 - addresses: - - ip_netmask: - 172.19.0.101/24 - routes: [] + --- + {% set control_virtual_ip = net_vip_map.ctlplane %} + {% set public_virtual_ip = vip_port_map.external.ip_address %} + {% if ':' in control_virtual_ip %} + {% set control_virtual_cidr = 128 %} + {% else %} + {% set control_virtual_cidr = 32 %} + {% endif %} + {% if ':' in public_virtual_ip %} + {% set public_virtual_cidr = 128 %} + {% else %} + {% set public_virtual_cidr = 32 %} + {% endif %} + network_config: + - type: ovs_bridge + name: br-ctlplane + use_dhcp: false + mtu: {{ ctlplane_mtu }} + ovs_extra: + - br-set-external-id br-ctlplane bridge-id br-ctlplane + addresses: + - ip_netmask: {{ ctlplane_ip }}/{{ ctlplane_subnet_cidr }} + - ip_netmask: {{ control_virtual_ip}}/{{ control_virtual_cidr }} + - ip_netmask: {{ public_virtual_ip}}/{{ public_virtual_cidr }} + routes: {{ ctlplane_host_routes }} + dns_servers: {{ ctlplane_dns_nameservers }} + domain: {{ dns_search_domains }} + members: + - type: interface + name: {{ neutron_public_interface_name }} + primary: true + mtu: {{ ctlplane_mtu }} managed: false managementNetwork: ctlplane ansibleUser: root diff --git a/config/samples/dataplane_v1beta1_openstackdataplanerole_edpm_compute.yaml b/config/samples/dataplane_v1beta1_openstackdataplanerole_edpm_compute.yaml index e4e44698e..6b88cbf50 100644 --- a/config/samples/dataplane_v1beta1_openstackdataplanerole_edpm_compute.yaml +++ b/config/samples/dataplane_v1beta1_openstackdataplanerole_edpm_compute.yaml @@ -16,6 +16,40 @@ spec: ansibleUser: root ansiblePort: 22 ansibleSSHPrivateKeySecret: dataplane-ansible-ssh-private-key-secret + networkConfig: + template: | + --- + {% set control_virtual_ip = net_vip_map.ctlplane %} + {% set public_virtual_ip = vip_port_map.external.ip_address %} + {% if ':' in control_virtual_ip %} + {% set control_virtual_cidr = 128 %} + {% else %} + {% set control_virtual_cidr = 32 %} + {% endif %} + {% if ':' in public_virtual_ip %} + {% set public_virtual_cidr = 128 %} + {% else %} + {% set public_virtual_cidr = 32 %} + {% endif %} + network_config: + - type: ovs_bridge + name: br-ctlplane + use_dhcp: false + mtu: {{ ctlplane_mtu }} + ovs_extra: + - br-set-external-id br-ctlplane bridge-id br-ctlplane + addresses: + - ip_netmask: {{ ctlplane_ip }}/{{ ctlplane_subnet_cidr }} + - ip_netmask: {{ control_virtual_ip}}/{{ control_virtual_cidr }} + - ip_netmask: {{ public_virtual_ip}}/{{ public_virtual_cidr }} + routes: {{ ctlplane_host_routes }} + dns_servers: {{ ctlplane_dns_nameservers }} + domain: {{ dns_search_domains }} + members: + - type: interface + name: {{ neutron_public_interface_name }} + primary: true + mtu: {{ ctlplane_mtu }} ansibleVars: edpm_network_config_hide_sensitive_logs: false neutron_physical_bridge_name: br-ex diff --git a/docs/common_configurations.md b/docs/common_configurations.md index e77149be0..eccc54574 100644 --- a/docs/common_configurations.md +++ b/docs/common_configurations.md @@ -59,8 +59,8 @@ The [edpm_network_config](https://github.com/openstack-k8s-operators/edpm-ansible/tree/main/roles/edpm_network_config) ansible role is responsible for configuring networking on dataplane nodes. -The `edpm_network_config_template` variable specifies the path to an ansible -template that describes the networking configuration to be applied. The +The `edpm_network_config_template` variable specifies the template that +describes the networking configuration to be applied. The template itself also contains variables that can be used to customize the networking configuration for a specific node (IP addresses, interface names, routes, etc). Templates provided with the edpm_network_config role are at @@ -77,7 +77,51 @@ field that shows defining the variables that configure the `edpm_network_config` role. ansibleVars: - edpm_network_config_template: templates/single_nic_vlans/single_nic_vlans.j2 + edpm_network_config_template: | + --- + network_config: + - type: interface + name: nic2 + mtu: 1500 + addresses: + - ip_netmask: + {{ ctlplane_ip }}/{{ ctlplane_subnet_cidr }} + - type: ovs_bridge + name: {{ neutron_physical_bridge_name }} + mtu: 1500 + use_dhcp: false + dns_servers: {{ ctlplane_dns_nameservers }} + domain: [] + addresses: + - ip_netmask: {{ lookup('vars', networks_lower["External"] ~ '_ip') }}/{{ lookup('vars', networks_lower["External"] ~ '_cidr') }} + routes: [{'ip_netmask': '0.0.0.0/0', 'next_hop': '192.168.1.254'}] + members: + - type: interface + name: nic1 + mtu: 1500 + # force the MAC address of the bridge to this interface + primary: true + - type: vlan + mtu: 1500 + vlan_id: 20 + addresses: + - ip_netmask: + 172.17.0.101/24 + routes: [] + - type: vlan + mtu: 1500 + vlan_id: 25 + addresses: + - ip_netmask: + 172.18.0.101/24 + routes: [] + - type: vlan + mtu: 1500 + vlan_id: 22 + addresses: + - ip_netmask: + 172.19.0.101/24 + routes: [] ctlplane_ip: 192.168.122.100 internal_api_ip: 172.17.0.100 storage_ip: 172.18.0.100 diff --git a/docs/deploying.md b/docs/deploying.md index 88995392f..3736c11ac 100644 --- a/docs/deploying.md +++ b/docs/deploying.md @@ -137,7 +137,6 @@ inline in the example. # edpm_network_config # Default nic config template for a EDPM compute node # These vars are edpm_network_config role vars - edpm_network_config_template: templates/single_nic_vlans/single_nic_vlans.j2 # See config/samples/dataplane_v1beta1_openstackdataplane.yaml # for the other most common ansible varialbes that need to be set. diff --git a/tests/functional/base_test.go b/tests/functional/base_test.go index e3f5583af..b3ccfc26f 100644 --- a/tests/functional/base_test.go +++ b/tests/functional/base_test.go @@ -1,8 +1,11 @@ package functional import ( + "encoding/json" + "github.com/onsi/gomega" . "github.com/onsi/gomega" + "gopkg.in/yaml.v3" corev1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/types" @@ -99,6 +102,12 @@ func DataPlaneWithNodeSpec() dataplanev1.OpenStackDataPlaneSpec { 172.19.0.101/24 routes: [] ` + var val interface{} + yaml.Unmarshal([]byte(customNicConfigTemplate), &val) + customNicConfigTemplateJSON, err := json.Marshal(val) + if err != nil { + return dataplanev1.OpenStackDataPlaneSpec{} + } return dataplanev1.OpenStackDataPlaneSpec{ DeployStrategy: dataplanev1.DeployStrategySection{ Deploy: false, @@ -114,10 +123,10 @@ func DataPlaneWithNodeSpec() dataplanev1.OpenStackDataPlaneSpec { Nodes: map[string]dataplanev1.OpenStackDataPlaneNodeSpec{ "edpm-compute-0": { Node: dataplanev1.NodeSection{ - NetworkConfig: dataplanev1.NetworkConfigSection{ - Template: customNicConfigTemplate, - }, AnsibleSSHPrivateKeySecret: "ssh-key-secret", + AnsibleVars: map[string]json.RawMessage{ + "edpm_network_config_template": customNicConfigTemplateJSON, + }, }, Role: "edpm-compute", }, diff --git a/tests/kuttl/tests/dataplane-create-test/00-assert.yaml b/tests/kuttl/tests/dataplane-create-test/00-assert.yaml index af366a8dd..9c384a028 100644 --- a/tests/kuttl/tests/dataplane-create-test/00-assert.yaml +++ b/tests/kuttl/tests/dataplane-create-test/00-assert.yaml @@ -57,6 +57,39 @@ spec: # Default nic config template for a EDPM compute node # These vars are edpm_network_config role vars edpm_network_config_hide_sensitive_logs: false + edpm_network_config_template: | + --- + {% set control_virtual_ip = net_vip_map.ctlplane %} + {% set public_virtual_ip = vip_port_map.external.ip_address %} + {% if ':' in control_virtual_ip %} + {% set control_virtual_cidr = 128 %} + {% else %} + {% set control_virtual_cidr = 32 %} + {% endif %} + {% if ':' in public_virtual_ip %} + {% set public_virtual_cidr = 128 %} + {% else %} + {% set public_virtual_cidr = 32 %} + {% endif %} + network_config: + - type: ovs_bridge + name: br-ctlplane + use_dhcp: false + mtu: {{ ctlplane_mtu }} + ovs_extra: + - br-set-external-id br-ctlplane bridge-id br-ctlplane + addresses: + - ip_netmask: {{ ctlplane_ip }}/{{ ctlplane_subnet_cidr }} + - ip_netmask: {{ control_virtual_ip}}/{{ control_virtual_cidr }} + - ip_netmask: {{ public_virtual_ip}}/{{ public_virtual_cidr }} + routes: {{ ctlplane_host_routes }} + dns_servers: {{ ctlplane_dns_nameservers }} + domain: {{ dns_search_domains }} + members: + - type: interface + name: {{ neutron_public_interface_name }} + primary: true + mtu: {{ ctlplane_mtu }} # # These vars are for the network config templates themselves and are # considered EDPM network defaults. @@ -334,6 +367,39 @@ data: edpm_iscsid_image: '{{ registry_url }}/openstack-iscsid:{{ image_tag }}' edpm_logrotate_crond_image: '{{ registry_url }}/openstack-cron:{{ image_tag }}' edpm_network_config_hide_sensitive_logs: false + edpm_network_config_template: | + --- + {% set control_virtual_ip = net_vip_map.ctlplane %} + {% set public_virtual_ip = vip_port_map.external.ip_address %} + {% if ':' in control_virtual_ip %} + {% set control_virtual_cidr = 128 %} + {% else %} + {% set control_virtual_cidr = 32 %} + {% endif %} + {% if ':' in public_virtual_ip %} + {% set public_virtual_cidr = 128 %} + {% else %} + {% set public_virtual_cidr = 32 %} + {% endif %} + network_config: + - type: ovs_bridge + name: br-ctlplane + use_dhcp: false + mtu: {{ ctlplane_mtu }} + ovs_extra: + - br-set-external-id br-ctlplane bridge-id br-ctlplane + addresses: + - ip_netmask: {{ ctlplane_ip }}/{{ ctlplane_subnet_cidr }} + - ip_netmask: {{ control_virtual_ip}}/{{ control_virtual_cidr }} + - ip_netmask: {{ public_virtual_ip}}/{{ public_virtual_cidr }} + routes: {{ ctlplane_host_routes }} + dns_servers: {{ ctlplane_dns_nameservers }} + domain: {{ dns_search_domains }} + members: + - type: interface + name: {{ neutron_public_interface_name }} + primary: true + mtu: {{ ctlplane_mtu }} edpm_nodes_validation_validate_controllers_icmp: false edpm_nodes_validation_validate_gateway_icmp: false edpm_nova_compute_container_image: '{{ registry_url }}/openstack-nova-compute:{{ image_tag }}' @@ -432,6 +498,39 @@ data: edpm_iscsid_image: '{{ registry_url }}/openstack-iscsid:{{ image_tag }}' edpm_logrotate_crond_image: '{{ registry_url }}/openstack-cron:{{ image_tag }}' edpm_network_config_hide_sensitive_logs: false + edpm_network_config_template: | + --- + {% set control_virtual_ip = net_vip_map.ctlplane %} + {% set public_virtual_ip = vip_port_map.external.ip_address %} + {% if ':' in control_virtual_ip %} + {% set control_virtual_cidr = 128 %} + {% else %} + {% set control_virtual_cidr = 32 %} + {% endif %} + {% if ':' in public_virtual_ip %} + {% set public_virtual_cidr = 128 %} + {% else %} + {% set public_virtual_cidr = 32 %} + {% endif %} + network_config: + - type: ovs_bridge + name: br-ctlplane + use_dhcp: false + mtu: {{ ctlplane_mtu }} + ovs_extra: + - br-set-external-id br-ctlplane bridge-id br-ctlplane + addresses: + - ip_netmask: {{ ctlplane_ip }}/{{ ctlplane_subnet_cidr }} + - ip_netmask: {{ control_virtual_ip}}/{{ control_virtual_cidr }} + - ip_netmask: {{ public_virtual_ip}}/{{ public_virtual_cidr }} + routes: {{ ctlplane_host_routes }} + dns_servers: {{ ctlplane_dns_nameservers }} + domain: {{ dns_search_domains }} + members: + - type: interface + name: {{ neutron_public_interface_name }} + primary: true + mtu: {{ ctlplane_mtu }} edpm_nodes_validation_validate_controllers_icmp: false edpm_nodes_validation_validate_gateway_icmp: false edpm_nova_compute_container_image: '{{ registry_url }}/openstack-nova-compute:{{ image_tag }}' @@ -520,6 +619,39 @@ data: edpm_iscsid_image: '{{ registry_url }}/openstack-iscsid:{{ image_tag }}' edpm_logrotate_crond_image: '{{ registry_url }}/openstack-cron:{{ image_tag }}' edpm_network_config_hide_sensitive_logs: false + edpm_network_config_template: | + --- + {% set control_virtual_ip = net_vip_map.ctlplane %} + {% set public_virtual_ip = vip_port_map.external.ip_address %} + {% if ':' in control_virtual_ip %} + {% set control_virtual_cidr = 128 %} + {% else %} + {% set control_virtual_cidr = 32 %} + {% endif %} + {% if ':' in public_virtual_ip %} + {% set public_virtual_cidr = 128 %} + {% else %} + {% set public_virtual_cidr = 32 %} + {% endif %} + network_config: + - type: ovs_bridge + name: br-ctlplane + use_dhcp: false + mtu: {{ ctlplane_mtu }} + ovs_extra: + - br-set-external-id br-ctlplane bridge-id br-ctlplane + addresses: + - ip_netmask: {{ ctlplane_ip }}/{{ ctlplane_subnet_cidr }} + - ip_netmask: {{ control_virtual_ip}}/{{ control_virtual_cidr }} + - ip_netmask: {{ public_virtual_ip}}/{{ public_virtual_cidr }} + routes: {{ ctlplane_host_routes }} + dns_servers: {{ ctlplane_dns_nameservers }} + domain: {{ dns_search_domains }} + members: + - type: interface + name: {{ neutron_public_interface_name }} + primary: true + mtu: {{ ctlplane_mtu }} edpm_nodes_validation_validate_controllers_icmp: false edpm_nodes_validation_validate_gateway_icmp: false edpm_nova_compute_container_image: '{{ registry_url }}/openstack-nova-compute:{{ image_tag }}'